i have created java test (i can convert junit if required). want invoke when project build. added dependency in pom.xml on building project, test not triggered. think surefire plugin not invoked in first place because can not see reports in target folder.
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.19.1</version> <configuration> <includes> <include>com.configtests/configtests.java</include> </includes> </configuration> </plugin>
generally, have kind of structure:
module -- src -- main -- java -- com.module -- (classes) -- test -- java -- com.module -- (test classes) -- pom.xml
then plugin syntax looks this:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.19.1</version> <configuration> <includes> <include>*</include> </includes> </configuration> </plugin>
i assume want have configtests.java
under package have named com.configtests
in test directory. should suffice do:
<include>configtests.java</include>
no reason declare package prepended. should find class long have pom.xml @ top-level , class under folder in same directory accordingly (in test folder!)
edit: also, run tests part of build should running tests auto-magically with: mvn clean install
or, can run tests isolated mvn test
. output in console indicate if tests run or not.
Comments
Post a Comment