kirksl / karate-maven-gradle Goto Github PK
View Code? Open in Web Editor NEWMaven, Gradle build systems, mocks and Jacoco code coverage and Report Portal integration with Karate
Maven, Gradle build systems, mocks and Jacoco code coverage and Report Portal integration with Karate
Hi @kirksl
Can we have the After Scenario Method in the RP class, I want to modify some things at the Scenario level in Report Portal, I know we have an after scenario in Hook Class, but wanted an After Scenario like we have after feature at Report Portal class.
Sometimes users might want to change attributes or like for me I want to integrate with Zephyr (I have already modified at launch level and other details, but I want to get test case id from scenario (@testcaseid=xxxx) and XXXX would be zephyr ticket which will update the status of that id ) I have implemented this in Report Portal Cucumber plugin and it works pretty well.
Cucumber plugin after scenario (Modified to update Zephyr with that test case)
protected void afterScenario(TestCaseFinished event) throws JSONException, IOException, InterruptedException {
RunningContext.ScenarioContext context = getCurrentScenarioContext();
URI featureUri = context.getFeatureUri();
currentScenarioContextMap.remove(Pair.of(context.getLine(), featureUri));
Date endTime = finishTestItem(context.getId(), event.getResult().getStatus());
featureEndTime.put(featureUri, endTime);
Collection<String> tags = event.getTestCase().getTags();
if (tags.isEmpty()) {
testCaseId = null;
}
for (String i : tags) {
testCaseId = i;
if ((testCaseId).contains("@testcase=")) {
testCaseId = testCaseId.substring("@testcase=".length());
break;
} else {
testCaseId = null;
}
}
if (testCaseId != null && launcName!=null)
try {
{
ZapiIntegration zapi = ZapiIntegration.getInstance();
zapi.UpdateZephyrStatus(testCaseId, event.getResult().getStatus().toString());
}
} catch (Exception e) {
e.printStackTrace();
}
else {
System.out.println("TestCase id is not added to Scenario in feature file, or Zephyr Test Cycle is not provided");
System.out.println("Zephyr Test execution will not get updated: Please update Test case id or add Test Cycle");
}
currentScenarioContext.set(null);
removeFromTree(currentFeatureContextMap.get(context.getFeatureUri()), context);
}
Please suggest what you think about this?
I have a use case where I need to set attribute values at the test level. As we all know we can set attribute values at the launch level in RP easily but to set attribute values at the test level dynamically it's a little tricky.
Use Case :
Scenario Outline: Google login and input values
Given URL
When the input ()
Then Do something
Example
CSV file
CSV file contents
Test1
Test2
Test3
So This test will run three times looping the contents in CSV file which is correct and we see results in Report Portal at Test level as
Google login and input values --Pass
Google login and input values -- Fail
Google login and input values -- Pass
So my use case is How I would differentiate between these test cases (Name is same in RP ) So setting up attribute values the same as CSV file values will help us to understand that this particular test is for this input.
I think we can do it "After Scenario" Hook in RP hook class extracting the contents somehow.
Hi @kirksl
Thanks for the work you did to integrate Report Portal with Karate 1.0.1. It works absolutely fine but I have a use case where I need to see attachments in the report portal as well ( Screenshots are attached fine with customer reports ).
Is there a way to achieve this in RPReporter class or KarateHook class?
Hi @kirksl
When we run our tests, we see called scenarios ( Scenarios called from another feature file ) also in Report Portal. But I want to see only Scenarios that I have run ( not the called scenarios, that should be steps inside the test scenario)
Hierarchy in Report Portal should be :
Launches > Features > Scenarios (Main Test Scenario) > steps and steps of reusable (Called scenario steps)
In the below Image,
Roadster Store Login
and other scenarios below that are called scenarios from another feature file and
the main scenario is "Quotes Comparison for Cash"
This is the code
* def login = read('classpath:com/cdk/reusable_hooks/roadsterStore_Login.feature@login')
@Basic_Cash
Scenario Outline: Cash with Basic Test
* call login
* delay(2000)
What changes Should we have to make?
Thanks
Shivin Saraf
Attempt to leverage Karate Suite object and integrate with https://github.com/reportportal/client-java/blob/develop/src/main/java/com/epam/reportportal/service/ReportPortal.java#L332
It's much better if we also support the allure report in the future.
The creator of the allure-framework has agreed and began to integrate karate 1.0.x:
allure-framework/allure-java#548
I am trying to use your code to integrate RP , but this import "rp.com..." is giving me issues , what dependency should i add into my gradle
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.