Last Updated: February 25, 2016
· alvarogarcia7

Make maven execute other tests

By default, maven's surefire plugin will only execute a set of tests (matching a regex).

In my team, we name our test files ending in "Should", eg:

* LinkedListShould, with methods
   * not_have_any_object_by_default
   * have_one_element_after_being_empty_then_adding_it
   * etc
*  BinarySearchTreeShould, with methods
   * search_in_logN_time


Theses tests are not executed by default by surefire, so we add this building configuration to pom.xml:


Then, you execute by default the tests ending in Should and ending in Test