0

I have a BDD maven project for API testing. I want to execute the cucumber tests independently by/from anywhere. To do this I required two things:

1. A jar (I have built it via assembly plugin and maven-jar-plugin also ) enter image description here

2. A class having main() method OR Runner classes. (I have defined both in my framework)

Java class containing main() method

Runner Class:

enter image description here

3. While running the command in cmd it is giving the error

  • java -jar dealflow-bdd-1.0.4-SNAPSHOT.jar enter image description here

Note: By following the approach discussed in this question Running Cucumber tests directly from executable jar I am able to create the jar by maven-assembly-plugin but the error seems to change. Now by running

java -jar dealflow-bdd-1.0.4-SNAPSHOT.jar

it is giving this

enter image description here

Comment: Tests are running if I run the main() method directly from the IDE itself or Run the Runner class

Vaibhav_Sharma
  • 546
  • 1
  • 9
  • 22
  • For running from jar file, Just pass the features folder name instead of full path. The features folder should be kept under resources folder. – Sureshmani Kalirajan Jul 11 '19 at 14:49
  • for the first option u need to add the relevant cucumber jars to the classpath – Grasshopper Jul 12 '19 at 05:33
  • @Grasshopper I tried command with classpath as well "java -cp dealflow-bdd-1.0.4-SNAPSHOT-tests.jar;lib/* com.project.dealflow.bdd.runner.Execute" but it is also giving the same error – Vaibhav_Sharma Jul 12 '19 at 07:16

0 Answers0