don't run first/last suites if nothing to test

This commit is contained in:
Sergey Ignatov
2018-05-18 12:12:01 +03:00
parent 25c5cdb755
commit dcf6c814a7
@@ -235,9 +235,9 @@ public class TestCaseLoader {
}
// PlatformLiteFixture is the very special test case because it doesn't load all the XMLs with component/extension declarations
// (that is, uses a mock application). Instead, it allows to declare them manually using its registerComponent/registerExtension
// methods. The goal is to make tests which extend PlatformLiteFixture extremely fast. The problem appears when such tests are invoked
// together with other tests which rely on declarations in XML files (that is, use a real application). The nature of the IDEA
// (that is, uses a mock application). Instead, it allows to declare them manually using its registerComponent/registerExtension
// methods. The goal is to make tests which extend PlatformLiteFixture extremely fast. The problem appears when such tests are invoked
// together with other tests which rely on declarations in XML files (that is, use a real application). The nature of the IDEA
// application is such that static final fields are often used to cache extensions. While having a positive effect on performance,
// it creates problems during testing. Simply speaking, if the instance of PlatformLiteFixture is the first one in a suite, it pollutes
// static final fields (and all other kinds of caches) with invalid values. To avoid it, such tests should always be the last.
@@ -283,8 +283,10 @@ public class TestCaseLoader {
return result;
}
public void clearClasses() {
private void clearClasses() {
myClassList.clear();
myFirstTestClass = null;
myLastTestClass = null;
}
static boolean isPerformanceTestsRun() {
@@ -315,7 +317,7 @@ public class TestCaseLoader {
}
}
if (getClasses().size() == 1) {
if (myClassList.isEmpty()) { // nothing valuable to test
clearClasses();
}
long after = System.currentTimeMillis();