Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Updating test step result for BDD test case



I have created a cucumber-jvm, selenium automation framework where test cases are written in Gherkin style(BDD) in feature file and i’m using scenario outline to execute same test case with multiple data set(data driven).
Now every input data from feature file represents test step in testrail.
Now consider i have a invalid login test case which gets executed for 2 invalid login credentials

  1. Invalid username & valid password
  2. valid username & invalid password
    so currently what is happening is when this test gets executed it updates the result twice in testrail since it executes the same test twice with different data.

My Requirement:

when the test case gets executed for varied input data set it should update only individual test step as pass/fail.
If all steps are passed then mark test case as passed and if one of the test step fails mark test case as failed.

so is it possible to achieve what i’m looking for? if yes can you please guide the way.

i had posted this question earlier as well but didn’t get any response.

any help on this much appreciated.!



Hi Yogiraj,

Thanks for your post! The TestRail API’s add_result method would support setting step-level statuses, and you would just need to be sure to include the custom_step_results field in your API request. You can see an example of how to accomplish this on our documentation here (just expand the ‘Request Example’ section):

Hope this helps!



Thanks Marco for the reply.

There is still some gray area here, please bear with me.

currently this is my code looks like for updating each scenario result, now when i get the scenario object how do i retrieve the steps count and details from it to iterate through each step result.
what is the method that will give me the count?
public void uploadTestRailResult(Scenario scenario)
Map data = new HashMap();
String caseID = scenario.getSourceTagNames();
data.put(“status_id”, scenario.getStatus());
data.put(“comment”, “Automation framework”);
client.sendPost(“add_result_for_case/123/” + caseID + “”, data);