Java Rally API新手,尝试添加测试用例结果
我刚刚开始制作拉力赛API。我想创建一个新的测试用例结果,但我一直得到一个异常,不知道为什么。我认为这将是一个真正愚蠢的原因,但我无法理解 这是我的密码:Java Rally API新手,尝试添加测试用例结果,java,soap,rally,Java,Soap,Rally,我刚刚开始制作拉力赛API。我想创建一个新的测试用例结果,但我一直得到一个异常,不知道为什么。我认为这将是一个真正愚蠢的原因,但我无法理解 这是我的密码: public static void updateRally(){ URL url RallyService service = null try{ url = new URL("https://rally1.rallydev.com/slm/webservice/1.36/RallyService")
public static void updateRally(){
URL url
RallyService service = null
try{
url = new URL("https://rally1.rallydev.com/slm/webservice/1.36/RallyService")
service = (new RallyServiceServiceLocator()).getRallyService(url)
} catch (MalformedURLException e){
e.printStackTrace()
throw new Exception("RallyWebServiceClient.main problem in creating the url")
} catch (Exception e){
e.printStackTrace()
throw new Exception("RallyWebServiceClient.main problem in creating the service")
}
if (service == null){
println("Error: Service is null")
throw new Exception("RallyWebServiceClient.main service null...")
}
//Set authentication information on the service
Stub stub = (Stub)service
stub.setUsername("MyUsername")
stub.setPassword("MyPassword")
//Configure the service to maintain an HTTP session cookie
stub.setMaintainSession(true)
//Start calling methods on the service
User user = (User)service.getCurrentUser()
println(user.getDisplayName())
TestCase testCase = new TestCase()
testCase.setName("TC7571")
TestCaseResult result = new TestCaseResult()
result.setTestCase(testCase)
result.setBuild("1.16.0-SNAPSHOT-6256")
result.setDuration(1.0)
result.setTester(user)
result.setVerdict("Pass")
CreateResult createResult = service.create(result)
}
我一直被告知主线程中存在异常,异常代码为1。它没有通过读取User=(User)service.getCurrentUser()的行
我在遵循我在拉力赛网站上找到的一个指南。我怀疑问题出在我使用的URL上。我还尝试了指向WSDL的URL,而不是上面的内容,并遇到了相同的问题
感谢您的帮助。我们建议新用户尝试我们的REST api而不是SOAP: 然后,您应该能够执行以下操作:
RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "user@company.com", "password");
JsonObject newTestCase = new JsonObject();
newTestCase.addProperty("Name", "Awesome Test");
CreateRequest createRequest = new CreateRequest("testcase", newTestCase);
CreateResponse createResponse = restApi.create(createRequest);
String newTestCaseRef = createResponse.getObject().get("_ref").getAsString();