我编写了一个脚本来自动运行Test Link的测试用例执行。运行此脚本时出错。
我已经给出了六个参数,以及Developer Key和Project name:
public class Execution {
public static WebDriver driver;
public static String DEVKEY="80851b38d9b92";
public static String URL="http:///testlink/lib/api/xmlrpc/v1/xmlrpc.php";
String testProject="MEDFB";
String testPlan="TP";
String build="Build";
String testcase ="MEDFB_BMEAPP-3";
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= TestLinkAPIResults.TEST_PASSED);
}
这是updateTestLinkResult()
:
public void updateTestLinkResult(String testCase, String Notes, String result)
throws TestLinkAPIException
{
TestLinkAPIClient testlinkAPIClient = new TestLinkAPIClient(DEVKEY,URL);
testlinkAPIClient.reportTestCaseResult(testProject, testPlan, testcase, build, Notes, result= TestLinkAPIResults.TEST_PASSED);
}
这是测试:
public void Test1() throws Exception {
String result = "";
String Notes = "";
try {
result= TestLinkAPIResults.TEST_PASSED;
updateTestLinkResult("TC", null, result);
} catch (Exception e) {
result = TestLinkAPIResults.TEST_FAILED;
Notes = e.getMessage();
updateTestLinkResult("TC", Notes, result);
}
错误:
org.testng.TestNGException:
Method reportResult requires 6 parameters but 0 were supplied in the @Configuration annotation.
at org.testng.internal.Parameters.checkParameterTypes(Parameters.java:198)
at org.testng.internal.Parameters.createParameters(Parameters.java:134)
at org.testng.internal.Parameters.createParameters(Parameters.java:370)
at org.testng.internal.Parameters.createConfigurationParameters(Parameters.java:86)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:199)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:207)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:178)
答案 0 :(得分:0)
您似乎已在类级别和方法TestLinkAPIClient
中创建了两个updateTestLinkResult()
实例。从类级别删除它。
而且在updateTestLinkResult()
方法中,当您将结果作为参数传递时,为什么要将结果硬化为{{1}},它可能会起作用。