I have successfully run the testcases in Katalon and result is showing in Testlink pass/fail. But now I wants to connect TestSuits and result must show in Testlink. But i am not able to do it. Here is my code and console log:
class ClickOnNextButtonListener {
public static String DEVKEY="e07a92432a43ebe74c68d6a960b866f9";
public static String URL="http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php";
String testProject="Workilo";
String testPlan="Workilo Test Plan";
//String testCase="click on Next button without changing date and time";
String testSuite="Book services with valid inputs";
String build="Beta Testing";
public static void reportResult(String TestProject,String TestPlan,String TestSuite,String Build,String Notes,String Result) throws TestLinkAPIException{
TestLinkAPIClient api=new TestLinkAPIClient(DEVKEY, URL);
api.reportTestCaseResult(TestProject, TestPlan, TestSuite, Build, Notes, Result);
}
@BeforeTestCase
def beforetestcase(TestCaseContext testCaseContext) {
println testCaseContext.getTestCaseId()
//println testCaseContext.getTestCaseVariable()
println testCaseContext.getTestCaseStatus()
//testCaseContext.TestCaseId()
}
@AfterTestSuite
def sampleAfterTestSuite(TestSuiteContext testSuiteContext)throws Exception {
String result = "";
//String exception = "";
String notes="";
//String result=null;
try{
//WebUI.driver.switchTo().defaultContent();
//wait(9)
//wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("+Testlink")));
result= TestLinkAPIResults.TEST_PASSED;
println(result)
notes="Executed successfully";
}
catch(Exception e){
e.printStackTrace()
System.out.println("Error: " + e.getMessage());
result=TestLinkAPIResults.TEST_FAILED;
notes="Execution failed";
}
finally{
ClickOnNextButtonListener a=new ClickOnNextButtonListener();
a.reportResult(testProject, testPlan,testSuite, build, notes, result);
}
}
}
Console log error:
org.codehaus.groovy.runtime.InvokerInvocationException: testlink.api.java.client.TestLinkAPIException: The test case identifier null was not found and the test case Book services with valid inputs could not be accessed to report a test result to test plan Workilo Test Plan.