Comments (6)
Hi @Shivin89. Apologies for the delay i've been very busy.
We initially tried to use "after scenario" but had many issues when running tests in parallel. The results posted to RP were reported incorrectly. I spent a lot of time on this to see what others were doing and understand RP code. Ultimately the safest option and what I saw others doing was to take advantage of Java "synchronize" and to report results using "after feature" where we could still access all of the scenario level detail, but it would get reported all at once per feature.
I would suggest keeping what is in place as you have full capability to spin through the scenarios in the "after feature" hook. If you really need to use "after scenario" feel free to try, but be very careful, test parallel execution, verify results are always correct. The other issue we saw sporadically when using "after scenario" is that execution runs would not complete as well and we had to force finish test runs in the RP UI.
from karate-maven-gradle.
Hi @kirksl
Thanks for the explanation, appreciate it !! I had one question not related to this issue but in general, Is the Calling Java class working in your framework? like example below
def JavaDemo = Java.type('com.cdk.runner.RPReporter').SL_DC
- json result = JavaDemo.getSlDc("HelloWorld")
- print JavaDemo
Thanks
Shivin
from karate-maven-gradle.
@Shivin89 are you having trouble with a specific Java class or calling all Java classes? I am able to call Java classes within karate-maven-gradle.
from karate-maven-gradle.
Hi @kirksl I was trying to call Report Porter Class using
def JavaDemo = Java.type('com.cdk.runner.RPReporter')
I have defined the below variables in the Report Portal class and
public static String SL_JOB_ID;
public static String SL_DC = "US";
I have this method (Setter and Getter)
public void setSlJobId(String slJobId) {
SL_JOB_ID = slJobId;
}
public static String getSlDc() {
return SL_DC;
}
I am trying to set the value of SL_JOB_ID to session-id in my feature file
(
Given driver baseUrl
* def sessionId = driver.sessionId
* print sessionId
def JavaDemo = Java.type('com.cdk.runner.RPReporter')
* def test = JavaDemo.setSlJobId("Testing")
But when I run the test it says
01: JavaDemo.setSlJobId("Testing")
<<<<
org.graalvm.polyglot.PolyglotException: TypeError: invokeMember (setSlJobId) on com.cdk.runner.RPReporter failed due to: Unknown identifier: setSlJobId
- .:program(Unnamed:1)
I have also tried to get the value of SL_DC too but it also failed with the same error
I have also tried def JavaDemo = Java.type('com.cdk.runner.RPReporter').SL_DC and test passes but the value of JavaDemo is Null when I print it
I am able to call a library called Faker and use methods inside that library
in karate-config.js
config.faker = Java.type('com.github.javafaker.Faker');
- def fakerObj = new faker()
- def fName = fakerObj.name().firstName()
And this works fine , I have tried creating obj of the class too but then it failed saying message not supported .
This is a static method so we don't need to create object .
from karate-maven-gradle.
@Shivin89 this thread is going out of scope of the issue reported.
But below is an example of how I use local/project classes if that helps. I'd suggest talking to Karate developers if you can't solve this. Also try other versions of Karate maybe it's a bug?
karate-config.js
var dbService = Java.type('common.DBService');
config.db = new dbService();
return config;
// now db class and methods are available everywhere
from karate-maven-gradle.
Closing due to inactivity
from karate-maven-gradle.
Related Issues (8)
- about allure report support HOT 3
- Adding screenshot to Report Portal via Karate 1.0.1 HOT 19
- Setting up attribute values at test level in RP HOT 2
- Add option to attach files at launch level within reportportal HOT 1
- Multiple Scenarios in Report Portal If we call a Scenario in another Feature HOT 2
- in RPReporter.java this statement is giving me issue -import rp.com.google.common.base.Supplier; HOT 1
- in RPReporter.java this statement is giving me issue -import rp.com.google.common.base.Supplier; what dependency have you used to get this "rp". HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karate-maven-gradle.