I have a citrusframework test, which when run with
mvn verify
it is able to find a json template file which is required to run the test, but when run with
mvn test -Dtest=SampleXmlIT#saveGroupTrips
suddenly it throws me following error:
Caused by: java.io.FileNotFoundException: src/test/templates/json/api/config/saveGroupTrips.json (No such file or directory)
my folder structure is as follows:
citrus-scada
|-src
| |-main
| |-test
| |-java
| | |- com : *.java testclasses
| |
| |-resources
| | |-com : xml-files which describes the testcases and reference the files required
| |
| |-templates : referenced files
|-target
does the working directory change?
src/test/templates is no Maven Standard Directory so there must exist some configuration which adds it to the classpath for test.
Because your test is named SampleXmlIT (IT is the important part, see here why) the test is executed with maven-failsafe-plugin in phase integration-test when you execute mvn verify
Now you call mvn test -Dtest=SampleXmlIT#saveGroupTrips
but now it is executed with maven-surefire-plugin.
If you want to execute tests isolated with maven-failsafe-plugin try:
mvn verify -Dit.test=SampleXmlIT#saveGroupTrips
See also here