Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.7k views
by The go-to Tester (222 points)
edited by

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 like 0 dislike
by

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


 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...