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.Filter
Filter 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
-
Field Summary
Fields inherited from class org.junit.runner.manipulation.Filter
ALL -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAnnotationFilter(String includedList, String excludedList, boolean defaultAllowed) DefaultAnnotationFilter(org.junit.runner.manipulation.Filter existingFilter) -
Method Summary
Methods inherited from class org.junit.runner.manipulation.Filter
apply, intersect, matchMethodDescription
-
Constructor Details
-
DefaultAnnotationFilter
public DefaultAnnotationFilter(org.junit.runner.manipulation.Filter existingFilter) -
DefaultAnnotationFilter
-
-
Method Details
-
getExcludedAnnotations
-
getIncludedAnnotations
-
shouldRun
public boolean shouldRun(org.junit.runner.Description description) - Specified by:
shouldRunin classorg.junit.runner.manipulation.Filter
-
describe
- Specified by:
describein classorg.junit.runner.manipulation.Filter
-