Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Karate test in Java API method #1074

Closed
arulkumarkandasamy opened this issue Mar 10, 2020 · 2 comments
Closed

Running Karate test in Java API method #1074

arulkumarkandasamy opened this issue Mar 10, 2020 · 2 comments
Labels

Comments

@arulkumarkandasamy
Copy link

I want to run karate tests in API call so that it can be integrated to our automation framework. However I am getting below error. Attached project source file.
KarateAPITest.zip

java.lang.NullPointerException
com.intuit.karate.core.ScenarioExecutionUnit.init(ScenarioExecutionUnit.java:147)
com.intuit.karate.core.ScenarioExecutionUnit.run(ScenarioExecutionUnit.java:236)
com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:164)
com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:73)
com.intuit.karate.core.Engine.executeFeatureSync(Engine.java:109)
com.intuit.karate.Runner.runFeature(Runner.java:163)
com.intuit.karate.Runner.runFeature(Runner.java:172)
org.arul.service.JavaAPITest.testCallingFeatureFromJava(JavaAPITest.java:27)
org.arul.controller.KarateController.getDataDrivenResult(KarateController.java:27)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)

Steps to reproduce
Unzip the attached project
run "mvn clean install"
Deploy the war file in tomcat
Running curl command curl http://localhost:8080/KarateAPITest/karate/datadriven should display output as "Hello World".

I have created UI with ExtJS and want to integrate karate with that. That is why I am trying to execute test cases through REST API call. If this is not possible please let me know whether this integration is possible by some other way.

@ptrthomas
Copy link
Member

@arulkumarkandasamy

Deploy the war file in tomcat

sorry, this is out of scope of this project, and I don't have tomcat installed

we know some people have been able to run karate inside a spring boot project, so you can look at that thread and / or ask them for help: #520

@sinha-sameer
Copy link

Any update on the same. I am getting similar error

java.lang.NullPointerException
com.intuit.karate.core.ScenarioExecutionUnit.init(ScenarioExecutionUnit.java:147)
com.intuit.karate.core.ScenarioExecutionUnit.run(ScenarioExecutionUnit.java:236)
com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:164)
com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:73)

and from here the stack trace differs to

com.intuit.karate.core.Engine.executeFeatureSynce
com.intuit.karate.core.IdeUtils.exec
cucumber.api.cli.Main.main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants