1

I am using TestRunner class which extends AbstractTestNGCucumberTests to run cucumber feature files in Testng. I have a Issue in the last step where I am using ApprovalTests to verify the response I get from database. I am seeing an exception

"com.spun.util.FormattedException: Didn't find cucumber.api.testng.AbstractTestNGCucumberTests under C:\Users\nsyed\Awris2\LearnDatabase"

Does anyone know why is this exception coming?? My Runner class is:

@CucumberOptions(features = {"src/test/java/Features/ValidateStagingDB.feature"}
,glue={"StepDefinition"}
,dryRun=false
,strict=true
,public class TestRunner extends AbstractTestNGCucumberTests{}`

And Exceptions is here at Approvals.VerifyAsJso

@Then("^the response should match the golden copy$") public void the_response_should_match_the_golden_copy() throws Throwable {

    try {

        Approvals.verifyAsJson(DbHelper2.getJsonRepresentationFor(TableData));
    }
    catch(Exception e) {
        System.err.println(e);
    }
    finally {
        System.out.println("Closing the database connection");
        connection.close();
    }
Arshad
  • 51
  • 4

1 Answers1

0

Can you try to include the cucumber-jvm.jar in your path folder. Here is the location to download: https://mvnrepository.com/artifact/info.cukes/cucumber-jvm

If you maven based project please add this dependency.

If the issue is not fixed, can you try pasting the cucumber-jvm in the path which is shown in the error message. That way we will be sure that it is the missing binaries in the path. If the succeeds you have to figure out the right path where all you jars should go in.

virusrocks
  • 861
  • 1
  • 5
  • 19
  • Didnt work.I am bit new to Java. I downloaded the dependency in pom.xml file and reran it again. Same Issue.How to paste the cucumber-jvm in the path??? – Arshad Sep 19 '18 at 05:18
  • Just copy the jar in the path which you got in the error. cucumber-jvm.jar – virusrocks Sep 19 '18 at 09:45
  • No Luck yet :-(. I copied the jar file to the path and I see the same Issue. what Am I doing wrong? Also putting ojdbc8 dependency on pom.xml file is showing an error "missing artifact com.oracle:ojdbc14:jar:10.2.0.4.0" – Arshad Sep 19 '18 at 22:43
  • Can you share your project or a sample project which can produce this issue ? It seems like missing dependencies to me. – virusrocks Sep 20 '18 at 00:05
  • package runner; import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; import cucumber.api.CucumberOptions; @RunWith(Cucumber.class) @CucumberOptions(features = {"src/test/java/Features/ValidateStagingDB.feature"} ,glue={"StepDefinition"} ,dryRun=false ,strict=true ,monochrome=true) public class TestRunner extends AbstractTestNGCucumberTests{} – Arshad Sep 20 '18 at 00:07
  • When I use run using Junit I get the following below error-------------------------------java.lang.RuntimeException: Could not find Junit/TestNg TestCase you are running – Arshad Sep 20 '18 at 00:09
  • I am getting this issue only If I use Approvaltests dependency to compare the results – Arshad Sep 20 '18 at 00:15
  • Then I would suggest that you check the dependency tree. It may be possible that ApprovalTests is depending on a different version of jvm binary. If that is the case you will get into this issue. – virusrocks Sep 20 '18 at 03:18