Run maven cucumber tests from IntelliJ - maven

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

Related

How to run maven command line tests in Intellij to resolve testSuiteXmlFiles0 has null value ERROR

I have a maven project which can be run from command line (in IntelliJ). Yet, when I try to in the UI, I get the following error.
testSuiteXmlFiles0 has null value
Attached is the screenshot of error and maven runtime configuration. Again, the command line (in the runtime configuration) works fine from command line.
mvn clean test -Dsurefire.suiteXmlFile=src/test/resources/legacy/bddsSmoke.xml -Dbrowser=chrome -Denvironment=sit03

Maven - What is the windows equivalent of .file to pass a file containing properties from the command line

Newby Maven question...
I am trying to run some tests in a Java Test Automation Framework.
This commmand works fine in linux:
mvn test -Denv.file=src/test/resources/env/.env
However, when I try to run it in Windows I get this error:
Unknown lifecycle phase ".file=src/test/resources/env/.env". You must specify a valid lifecycle phase or a goal in the format
I am presuming that -Denv.file works on Linux but you need a different command on Windows?
I've tried googling but can't find anything.

How pass Gradle command parameters to execute a task through Buildship

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.

Maven cucumber.options argument usage in Teamcity

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

Jasmine maven plugin parsing test result Atlassian Bamboo

So I've managed to get jasmine maven plugin to work with maven and our js unit test.
All is running well, but i found when there's a test that failed, bamboo will say it failed, but the error is "No failed tests found, possible compilation error ocurred".
I've tried to get it to parse TEST-jasmine.xml result by specifically specify the folder JUnit parser needed, and get jasmine to write to that folder using jasmineTargetDir tag in pom.xml, but it's still not finding the right result. Jasmine faithfully write the test result to the folder, but seemingly JUnit is not parsing it?
Any clue as to why and how to solve the issue?
Running on Bamboo v 5.14.3.1 I've configured the Maven task of Default Stage to search for test result files:
And then produced fake failing test. After that the build failed with failing test:
Hope this helps

Resources