Unable to integrate selenium with testlink

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Unable to integrate selenium with testlink

Postby sharmasobhit9 » Mon Oct 22, 2018 7:44 am

Hi guys,

I am trying to integrate selenium with testlink where as testcases pass in automation(selenium should get updated in testlink as well.
But unable to do so as the the error says as bellow-

Code: Select all
testlink.api.java.client.TestLinkAPIException: The test case identifier null was not found and the test case Given navigate to Application and login with credentials could not be accessed to report a test result to test plan UIAutomatoion.
   at testlink.api.java.client.TestLinkAPIClient.reportTestCaseResult(TestLinkAPIClient.java:199)
   at stepDefinations.Login.reportResult(Login.java:34)
   at stepDefinations.Login.navigate_to_Application_and_login_with_credentials(Login.java:78)
   at ✽.Given navigate to Application and login with credentials(Smoke.feature:4)


Here is the code-

Code: Select all
package stepDefinations;

import com.cucumber.listener.Reporter;
import cucumber.TestContext;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import testlink.api.java.client.TestLinkAPIClient;
import testlink.api.java.client.TestLinkAPIException;
import testlink.api.java.client.TestLinkAPIResults;

public class Login {


TestContext testContext;
    PageObjectRep.Login LoginPage;

    //Enter your project API key here.
    public static String DEVKEY="XXXXXcf380a43620d6a612ed092efXXXX";

    //Enter your Test Link URL here
    public static String URL= "http://XX.XX.XX.XX/lib/api/xmlrpc/v1/xmlrpc.php";

    //Enter your Test Project Name here
    String testProject="SMS";

    //Enter your Test Plan here
    String testPlan="UIAutomatoion";

    //Enter your Test build here
    String build="Smoke test build v1";

    public static void reportResult(String TestProject,String TestPlan,String Testcase,String Build,String Notes,String Result) throws TestLinkAPIException{
        TestLinkAPIClient api=new TestLinkAPIClient(DEVKEY, URL);
        api.reportTestCaseResult(TestProject, TestPlan, Testcase, Build, Notes, Result);
    }
    public Login(TestContext context) {
        testContext = context;
        LoginPage = testContext.getPageObjectManager().getLoginPage();
    }

    @Given("navigate to Application and login with credentials")
    public void navigate_to_Application_and_login_with_credentials() throws TestLinkAPIException {
        String testProject="SMS";
        String testPlan="UIAutomatoion";
        String testCase="Given navigate to Application and login with credentials";
        String build="Smoke test build v1";
        String notes=null;
        String result=null;
        //String exception = null;
        try {
            Thread.sleep(5000);
            LoginPage.navigateTo_AppLogin();
            Reporter.addStepLog("User navigated to the URL");
            //LoginPage.login_with_credentials("sharmas","Welcome123*");
            LoginPage.loginWithCred();
            Reporter.addStepLog("User entered username and password and click on submit ");
            result= TestLinkAPIResults.TEST_PASSED;
            notes="Executed successfully";

            //Enter your test case ID here
            //updateTestLinkResult("485", null, result);
        } catch (Exception e) {
            //This attach the specified screenshot to the test
            Reporter.addStepLog("Ended in try and catch block");
            /*result = TestLinkAPIResults.TEST_FAILED;
            exception = e.getMessage();
            updateTestLinkResult("485", exception, result);*/
            result=TestLinkAPIResults.TEST_FAILED;
            notes="Execution failed";
        }
        finally {
        reportResult(testProject, testPlan, testCase, build, notes, result);
        }
    }

    @And("^verify the popup message$")
    public void verifyThePopupMessage() {
        LoginPage.loginmessage();
    }
}


I would really appreciate the help.
---------------------------
Thanks & Regards,
Sobhit Sharma
QA Engineer
sharmasobhit9
TestLink user
 
Posts: 1
Joined: Tue Oct 16, 2018 8:37 pm

Return to TestLink 1.9



Who is online

Users browsing this forum: No registered users and 4 guests