Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
how can we trigger cucumber java runner file from cmd line?

Open 1 Answers 49 Views
0 1

I have written a automated test sute using Java Cucumber. Can you tell me how can we trigger cucumber java runner file from cmd line? I am neither using maven nor ant?

I can use JUnit runner.

1 Answer

0
0

You can run the test the same way you would run a JUnit test on the command line:

java -cp <classpath> org.junit.runner.JUnitCore com.example.test.RunCukesTest

where RunCukesTest is the unit test that sets all the cucumber options, e.g.:

package com.example.test;

import org.junit.runner.RunWith;

import cucumber.api.junit.Cucumber;
import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(plugin = "json:target/report.json")
public class RunCukesTest {
}

<classpath> is where you can mention your JAR files.

If all your JAR files are inside lib folder, your command can be:

java -cp "lib/*" org.junit.runner.JUnitCore com.example.test.RunCukesTest


 

answered by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...