Inspection TestCase start failing after upgrade

Answered

Hello,

After we upgrade to 2019.1 one of the test cases started to fail and I found it's a side effect from another test case, like it not cleaning up it's own state after it self.

The following haven't been reported as expected: <?xml version="1.0" encoding="UTF-8"?>
<problem>
<file>BarRoute.java</file>
<line>34</line>
<description>Illegal syntax: $.store.book[* xxxxxxx]</description>
</problem>

 

Both test cases are testing inspection and if I comment out this line in the first test case the second run fine.

PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_JSONPATH_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());

Both test cases are simple and don't do much

public class CamelInspectXmlSimpleTestIT extends InspectionTestCase {
public static final String CAMEL_CORE_MAVEN_ARTIFACT = "org.apache.camel:camel-core:2.22.0";

@Override
protected void setUp() throws Exception {
super.setUp();
File[] mavenArtifacts = Maven.resolver().resolve(CAMEL_CORE_MAVEN_ARTIFACT).withoutTransitivity().asFile();
PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_CORE_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
}

@Override
protected String getTestDataPath() {
return "src/test/resources/";
}

public void testSimpleInspection() {
// force Camel enabled so the inspection test can run
CamelInspection inspection = new CamelInspection(true);
doTest("testData/inspectionsimplexml/", new LocalInspectionToolWrapper(inspection));
}

}

The second test case that fails of side effect from the first.

public class CamelInspectJavaJSonPathTestIT extends InspectionTestCase {
public static final String CAMEL_JSONPATH_MAVEN_ARTIFACT = "org.apache.camel:camel-jsonpath:2.22.0";

@Override
protected void setUp() throws Exception {
super.setUp();
File[] mavenArtifacts = Maven.resolver().resolve(CAMEL_JSONPATH_MAVEN_ARTIFACT).withTransitivity().asFile();
PsiTestUtil.addLibrary(myFixture.getProjectDisposable(), myFixture.getModule(), "Maven: " + CAMEL_JSONPATH_MAVEN_ARTIFACT, mavenArtifacts[0].getParent(), mavenArtifacts[0].getName());
}

@Override
protected String getTestDataPath() {
return "src/test/resources/";
}

public void testJSonPathInspection() {

// force Camel enabled so the inspection test can run
CamelInspection inspection = new CamelInspection(true);

// must be called fooroute as inspectionsimplejava fails for some odd reason
doTest("testData/barroute/", new LocalInspectionToolWrapper(inspection));
}
}

 

Any idea what is going on here ?

Thanks,

Flemming

0
1 comment

InspectionTestCase has become "light" test in 2019.1, so modifications to the test project like adding libraries etc. are "sticking". You'll need to undo any (temporary) changes to your project setp carefully in tearDown() or use dedicated LightProjectDescriptor instead.

0

Please sign in to leave a comment.