i have created a cucumber framework using Java and Maven. i execute cukesRunner.java locally in eclipse. now i wanted to execute it command line and thru jenkins. could some one please guide me.
cd to your project direct (the one containing pom.xml) and type
mvn test
Your runner class ends in Test, right? E.g. RunCukeTest.java
Related
I have a test project built in Intellij IDEA 2021.1 using Selenium, Cucumber and Maven
The project runs fine from within Intellij but now I want to call the tests from the command line and only those with a specific tag. Below is the project layout
There is only 1 feature file at present and I only want to call the scenarios with the "regression" tag from the command line.
I have run command line with Visual Studio/Selenium in the past but this is my first go with Java so any advice on how to get this started would be great.
try to execute following
mvn verify -Dcucumber.options="--tags not #ignore"
Or
mvn verify -Dcucumber.options="--tags #runme"
where #runme is a tag over Scenario or Feature.
you can try this command:
mvn clean install "-Dcucumber.options=--tags #yourtagName"
I imported a maven project to intellij with two modules under a parent project.
The test I want to run is made with TestNg and when I run it I just get a single line of:
java.lang.NullPointerException
No stacktrace, nothing.
If I run it from the command line it works, but only if I cd into the directory of one of the modules.
So basically thats the command that actually works:
cd server
mvn -Dtest=ConversionServiceT2 test
I'm pretty sure I didn't configure IntelliJ in the right way, but I have no idea where to start.
Here a few infos that might help:
I use the openJDK 11
I tried to set the working directory of the test config in IntelliJ to the server directory, which results in the same error
So how can I get this test (or tests in general) to run?
I downloaded and successfully ran this project:
https://github.com/spring-guides/gs-accessing-data-mongodb
I noticed it has some test cases on the file:
https://github.com/spring-guides/gs-accessing-data-mongodb/blob/master/complete/src/test/java/hello/CustomerRepositoryTests.java
To run the main application from the command line, I do:
$ ./mvnw spring-boot:run
Now, I would like to know what command do I need to execute in order to run the test cases?
Thanks!
You just need to run this command to run your tests.
mvn test
https://spring.io/guides/gs/testing-web/ can give you more information about testing.
I am trying to write unit test cases for an eclipse plugin. Went through http://www.vogella.com/tutorials/EclipseTycho/article.html#run-the-build-with-the-tests and created a eclipse-test-plugin.
So, the test plugin (let's call is plugin-b) has a dependency on another plugin for which the test is written (plugin-a).
When I run mvn clean install, I can see that tycho-surefire is trying to run the tests and in the process is trying to launch plugin-a. However, plugin-a requires a set of VM args to start correctly. Am trying to pass the arguments like below:
mvn -Dabc.properties=bridge\bundles\com.blah.blah.blah.blah.bridge\abc.properties clean install
but they aren't going through to plugin-a.
Any help is greatly appreciated.
Finally figured this out:
mvn clean install -Dtycho.testArgLine="-Dabc.properties=../../bundles/com.blah.blah.blah.blah.bridge/abc.properties"
That'll pass the system properties to the test runtime.
I had been introduced to concept of CI lately and was trying to work on jenkins CI. I was stuck up in one thing . How to trigger executable testng files in jenkins CI. For ex locally in our machines we just run testng.xml to execute couple of test cases. In the same way how can we trigger this xml file to run in jenkins CI ?
In most cases with jenkins you wouldn't use an executable. Normally you'd run the wrapper for the tests (Junit/Nunit etc.) which Jenkins is fully capable of running on it's own.
You can use this article to run TestNG tests using Maven:
Running TestNG tests using maven
After configuration is completed just add Invoke top-level Maven targets step to the Build Steps in Jenkins (Maven plugin should be installed). The target should be test in this case.
If you will face with any errors during configuration, try to google them.
If you are not using any build tool like maven or ant, you can invoke it from command line as we'll and specify your suite file. Make sure to set the correct class paths http://testng.org/doc/documentation-main.html#running-testng
You can put this as a build step in Jenkins.
Add a compilation step prior to this step. I haven't ever tried it - have always used ant or maven, but that is where I would start exploring.