如何在Testlink中批量更新测试用例结果

时间:2015-04-16 05:16:24

标签: testlink

我最近开始在我的项目中使用testlink测试管理工具,而且我正面临一个关于testlink中测试用例批量更新的新问题。

对于手动测试用例而言,这不是问题,但对于自动化,更新您执行的每个测试用例的结果(通过或失败)都很繁琐。 我有大约5000多个测试用例,其中50%是自动化的,所以当自动化时。

因此,当自动化脚本完成为特定版本执行2500多个测试用例时,我需要在testlink中将所有这些测试用例的结果更新为Pass或Fail。

我还尝试将自动化工具与testlink链接,但没有成功。

所以,我只是想知道是否有任何简单的方法来批量更新testlink中的测试用例。可能正在使用一些数据库查询和所有?

3 个答案:

答案 0 :(得分:0)

我认为这很难,因为您应该知道几个数据,以便为您的项目,测试计划,构建,测试套件,测试用例和测试用例版本插入正确的信息。所以,您需要所有这些信息。

无论如何,插入信息的表格是 “执行” ,您可以通过以下查询查看所需信息:

select * from executions;

问候,大卫。

答案 1 :(得分:0)

1)您可以使用XML-RPC API 2)生成带有格式的XML文件以导入结果,然后手动上传

避免使用SQL直接访问数据库

答案 2 :(得分:0)

iam还使用Selenium webdriver

更新测试链接

代码如下: -

公共类appFunctions扩展了关键字{      //用你的开发键代替

public static String DEV_KEY= "1eab09b6158d9df31e76142b85253243";

   public static String SERVER_URL  = "https://testlink.fondsdepotbank.de/testlink/lib/api/xmlrpc/v1/xmlrpc.php";


public static void clearXLResults() throws IOException
{
    try
    {
        int testStepsRow=DriverScript.xlObj.getRowCount("TestSteps");
        int controllerRow=DriverScript.xlObj.getRowCount("Controller");

        //Clear previous results
        for(int i=2;i<=testStepsRow;i++)
        {
            DriverScript.xlObj.setCellData("TestSteps",DriverScript.testStepsStatusCol, i, "");
        }
        for(int j=2;j<=controllerRow;j++)
        {
            DriverScript.xlObj.setCellData("Controller", DriverScript.controllerStatusCol, j, "");
        }
    }catch(Exception e)
    {
        e.printStackTrace();
        log.writeLog("Unable to clear previous test results in excel");

    }
}


public static void updateResultsTestLink() throws IOException
{
    try
    {
        TestLinkAPIClient api=new TestLinkAPIClient(DEV_KEY, SERVER_URL);
        String result;
        //read controller status
        int controllerRow=DriverScript.xlObj.getRowCount("Controller");
        for(int k=2;k<=controllerRow;k++)
        {
            String currentRowStatus=DriverScript.xlObj.getCellData("Controller",DriverScript.controllerStatusCol,k);
            String currentRowProject=DriverScript.xlObj.getCellData("Controller",DriverScript.controllerProjectCol,k);
            String currentRowPlan=DriverScript.xlObj.getCellData("Controller",DriverScript.controllerPlanCol,k);
            String currentRowBuild=DriverScript.xlObj.getCellData("Controller",DriverScript.controllerBuildCol,k);
            String currentRowTCID=DriverScript.xlObj.getCellData("Controller",DriverScript.controllerTCIDCol,k);
            if(currentRowStatus.equalsIgnoreCase("pass"))
            {
                result= TestLinkAPIResults.TEST_PASSED;
                api.reportTestCaseResult(currentRowProject, currentRowPlan, currentRowTCID, currentRowBuild, null, result);
            }
            if(currentRowStatus.equalsIgnoreCase("fail"))
            {
                result= TestLinkAPIResults.TEST_FAILED;
                api.reportTestCaseResult(currentRowProject, currentRowPlan, currentRowTCID, currentRowBuild, null, result);
            }
        }

    }catch(Exception e)
    {
        e.printStackTrace();
        log.writeLog("Unable to update results in Testlink");
    }

}