Package de.hybris.platform.testframework
Class DefaultAnnotationFilter
- java.lang.Object
-
- org.junit.runner.manipulation.Filter
-
- de.hybris.platform.testframework.DefaultAnnotationFilter
-
public class DefaultAnnotationFilter extends org.junit.runner.manipulation.FilterFilter is a tool which allow to exclude some test from the suite. The reason of creating such tool is to increase developers productivity by selecting which test should be run. The idea is to annotate all long-running tests with proper annotation (e.g. @PerformanceTest) and exclude them from execution during the development. If we remove these monsters from basic unit/integration tests we can try to run all tests before commit (all unit tests). It is very important to bring that possibility to mere developers again, because it is the foundation of test-driven development.Configuration
You can configure filter setting these properties:- hybris.junit4.annotations.included - list of comma separated annotations; tests with these annotations will be included in the test
- hybris.junit4.annotations.excluded - list of comma separated annotations; tests with these annotations will be excluded from the test
- hybris.junit4.annotations.defaultIncluded - true or false; if true - all tests will be run except those with annotations from excluded list; if false - only tests with annotations from included list will be run (except those with annotations from excluded list); default value is true;
Examples
Run only PerformanceTest and IntegrationTest
hybris.junit4.annotations.included=PerformanceTest,IntegrationTest
hybris.junit4.annotations.excluded=
hybris.junit4.annotations.defaultIncluded=false
Run all tests without PerformanceTest
hybris.junit4.annotations.included=
hybris.junit4.annotations.excluded=PerformanceTest
hybris.junit4.annotations.defaultIncluded=true
Run all tests
hybris.junit4.annotations.included=
hybris.junit4.annotations.excluded=
hybris.junit4.annotations.defaultIncluded=true
-
-
Constructor Summary
Constructors Constructor Description DefaultAnnotationFilter(java.lang.String includedList, java.lang.String excludedList, boolean defaultAllowed)DefaultAnnotationFilter(org.junit.runner.manipulation.Filter existingFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdescribe()java.util.Collection<java.lang.Class>getExcludedAnnotations()java.util.Collection<java.lang.Class>getIncludedAnnotations()booleanshouldRun(org.junit.runner.Description description)
-
-
-
Method Detail
-
getExcludedAnnotations
public java.util.Collection<java.lang.Class> getExcludedAnnotations()
-
getIncludedAnnotations
public java.util.Collection<java.lang.Class> getIncludedAnnotations()
-
shouldRun
public boolean shouldRun(org.junit.runner.Description description)
- Specified by:
shouldRunin classorg.junit.runner.manipulation.Filter
-
describe
public java.lang.String describe()
- Specified by:
describein classorg.junit.runner.manipulation.Filter
-
-