john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

junit category slow test exclusion

# define an empty interface

package net.kittyandbear;

public interface SlowTests {
}


# now unit tests can be labelled with a "category" across all source files

    @Test
    @Category( SlowTests.class )
    public void test_isExample() throws Exception {


mvn test -Dtest.categories=SlowTests // run only slow tests
mvn test -Dtest.categories=!SlowTests // run non-slow tests
mvn test -Dtest.categories=SlowTests,FastTests // run only slow tests and fast tests
mvn test // run all tests, including non-categorized

  • « log4j dynamic configuration
  • junit spring servlet handlerequest testing »

Published

Jan 11, 2013

Category

java

~60 words

Tags

  • category 1
  • exclusion 1
  • java 252
  • junit 8
  • slow 1
  • test 29