I have a test automation framework and I am able to run my tests from maven command line with the following without any error:
mvn clean test -Pdev -Dserver="remote" -Dbrowser="ie" -Dcucumber.options="--tags #test"
I try to integrate it to teamcity but there are some problem with the arguments.
My config in Build Step:Maven:
Goals: clean test
path to pom file: is correct
Additional maven Command Line Parameters:
-Pdev
-Dserver=remote
-Dbrowser=ie
"-Dcucumber.options=--tags #test"
When I start the job, the test has been started but never ends, just it runs continuously and the job is stucked.
Any idea why? I'm pretty sure, cucumber.options arguments syntax is wrong, but without quotes it doesn't work at all. Please note, locally everything is working fine, there is no any error in arguments/maven profile etc.
Thanks!
If your TeamCity instance is running on Windows, the below syntax for defining Cucumber Options in the Additional Maven Command Line Parameters should work:
"-Dcucumber.options= --tags #test"
Not sure if it matters, but notice I have a space in between the = character and --tags
Related
I am running an azure pipeline for a maven project which has windows commands for maven installation, by calling multiple methods i.e.,
call mvn ... clean install
call mvn ... clean package (authentication)
call mvn ... clean package (restapi)
The build environment is linux Hence I am converting all the commands in the batch file to sh commands. For maven installation I initially added a maven installation task by mentioning the path and commands in the task. This failed.
So I am currently changing the windows commands to sh commands. The other commands except for maven installation have been converted using a batch to sh commands reference article.
Could some one guide me to convert the above mentioned installation commands to sh commands?
If the Apache Maven has been installed and added to the system path on the agent machine where your pipeline runs, you can just try directly calling the mvn command in the bash script, like you call it on Windows.
For example:
mvn ... clean install
mvn ... clean package (authentication)
mvn ... clean package (restapi)
Before you execute the bash script in the pipeline, you firstly should try and debug it on your local machine to make sure it can work as expected on the local machine. Then move the bash script to the pipeline on Azure DevOps.
If the bash script runs failed in the pipeline, for us to investigate this issue further, please share us with the complete debug logs of the failed pipeline run. To get the debug logs, you need to set the pipeline variable System.Debug to true, then trigger the pipeline.
I know that if in Gradle I use: build -x test it builds and the test are not executed.
In STS with Buildship for support with Gradle, for example for Spring Integration
It has the following two tasks of my interest (build and test):
I can build with the following:
Because some test fails (randomly) I want skip the tests, so I tried
it fails with:
So I tried with:
And fails with
And with:
Nothing happens, only shows the following and stopping:
So how represent build -x test correctly with Buildship?
You must supply -x test as Program Arguments like this:
Or you just run assemble instead of build. assemble is a lifecycle task that aggregates all archive tasks in the project and, besides other tasks, does not execute check tasks, such as test.
I have a maven project, which run cucumber tests using JUnit runner. I can use the following syntax from command line to run the tests:
mvn -Dcucumber.options="--tags #Sanity" test
This works perfectly fine when run from the console. Now I'm trying to set up Maven runner configuration in IntelliJ IDEA to do the same - and I just can't get it to work. According to the IntelliJ documentation, I need to \-escape double quotes - so in the command line I specify -Dcucumber.options=\'--tags #Sanity\' test
Maven is executed - but produces this error message:
Unknown lifecycle phase "#Sanity""
It appears that the parameter is unescaped before being passed to maven. I then tried to putting the entire thing in quotes, specifying parameters as '-Dcucumber.options=\"--tags #Sanity\"' test. This results in the following error:
Unknown lifecycle phase "'-Dcucumber.options="--tags"
Again, I guess, something is with quoting/escaping. I then tried these options: "-Dcucumber.options='--tags #Sanity'" test - this time maven goes through the compilation stage and seemingly attempts to run tests - but then fails with the following error:
Tests in error:
initializationError(com.mycompany.mypackage.MyRunner): Unknown option: --tags #Sanity
I tried all sorts of quoting/escaping/double-escaping/double-quoting/etc. - to no avail.
Again, running maven from command line works fine - I am specifically interested in setting it up as a runner configuration in IntelliJ IDEA.
You need to escape space character: mvn "-Dcucumber.options=--tags\ #Sanity" test
kind of stuck here-
I can pass a single tag through maven command line like so-
mvn clean -Dcucumber.options="--tags #runThis"
However, I am unable to pass multiple tags through.
any help would be much appreciated
Thank you!
If want to run scenario with tag_1 and tag_2
mvn test -Dcucumber.options="--tags #tag_1 --tags #tag_1"
and if you want to run scenario with tag_1 or tag_2
mvn test -Dcucumber.options="--tags #tag_1,#tag_2"
I've set up a build on Jenkins for a Maven project, and I would like to build it without running any of the tests. I've tried entering "clean install -DskipTests" in the goals field, like this:
But it doesn't work. What am I doing incorrectly?
Note: I want to skip the tests without touching the pom. I have a separate build that DOES run the tests.
The problem is that I omitted =true. I was able to build without running tests by entering:
clean install -DskipTests=true
Just to extend the answer, maven has 2 options for skipping tests:
-DskipTests=true — The one that was mentioned. With this parameter, maven ignores tests completely.
-Dmaven.test.skip=true — With this option maven compiles the tests but doesn't launch them.
So you may want to use the second option instead as fast code compile validation. E.G.: if you develop some library or module that will be used by some one else you must be sure that you don't brake contract with the client. Tests compilation can help you with this.
Use either of these parameters depending on your needs.
use "Goals and options" value is "clean install -DskipTests=true".
it works like a Charm. I saved hours of time using this Option. :-)
I use option "-DskipTests=true" in "Invoke top-level Maven target" -> "JVM Options" and it works fine.