0

I have created a framework using java in POM format. i want to update the test run result in test rail after every test method is executed in my test file. I have created a class TestRail where there is a method updateTest. This method takes id of test case and status of test case and hit the post request which the update the status in test rail.

Now my confusion is how should i pass the test case id from test file after every test method? Should i add test id as tag in every test case? How will i fetch the test id from tag in after method?

for example:

@Test(groups = {"1","2"})
public void verifyLogin()
{
Assert.assertTrue(anyMthodHere());

}

@AfterMethod
public void after()
{
postTestResult("pass", i want id 1 and 2 here);

}
Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
  • So my requirement is like this. https://stackoverflow.com/questions/31344490/integrate-selenium-test-results-with-testrail-4-0 – Rajesh Chaudhary Oct 11 '17 at 12:51
  • But i dont know how to pass test case id to test rail function ? how to maintain test case id for each test case? – Rajesh Chaudhary Oct 11 '17 at 12:52
  • Possible duplicate of [Integrate Selenium test results with TestRail 4.0](https://stackoverflow.com/questions/31344490/integrate-selenium-test-results-with-testrail-4-0) – Krishnan Mahadevan Oct 13 '17 at 03:13
  • It looks like the question you shared exactly is what you want. So why not try out the solution detailed in that question ? It pretty much explains everything that needs to be done. – Krishnan Mahadevan Oct 13 '17 at 03:14
  • Yeah i have read the solutions at many places and i am clear that i have to use testnglistener but my question here is how would i get the id of test case which will be passed to test rail api? Like i have mentioned in my question that how will i get the id in after method or in listener class? – Rajesh Chaudhary Oct 14 '17 at 04:06
  • Can you please clarify what is the test case id you are referring to? How are you expressing that in your `TestNG` test ? – Krishnan Mahadevan Oct 14 '17 at 04:57

0 Answers0