我正在使用Rally soap API針對之前創建的測試用例創建新的TestCaseResult。但是當我創建結果時出現錯誤 - '驗證錯誤:TestCaseResult.Date不應該爲空'Rally API - 創建TestCaseResult - DateTime問題
不知道爲什麼會這樣 - 你能幫忙嗎?
private Boolean createTestResultForTest(String aResult, String aTestCase)
{
TestCaseResult myTestCaseResult = new TestCaseResult();
myTestCaseResult.Build = "1";
DateTime myDate = DateTime.Now;
myTestCaseResult.Date = myDate;
String myQuery = "(FormattedID = " + aTestCase + ")";
QueryResult myTestCaseReturn = m_rallyService.query(m_workspace, "TestCase", myQuery, "", true, 0, 100);
long mycount = myTestCaseReturn.TotalResultCount;
if (mycount > 0)
{
TestCase myTestCase = (TestCase)myTestCaseReturn.Results[0];
myTestCaseResult.TestCase = myTestCase;
}
else
{
return false;
}
myTestCaseResult.Verdict = aResult;
CreateResult myCreateTestResultResult = m_rallyService.create(myTestCaseResult);
if (hasErrors(myCreateTestResultResult))
{
updateStatus("Could not create test result for test case:" + myTestCaseResult.TestCase.Name);
printWarningsErrors(myCreateTestResultResult);
return false;
}
else
{
myTestCaseResult = (TestCaseResult)myCreateTestResultResult.Object;
myTestCaseResult = (TestCaseResult)m_rallyService.read(myTestCaseResult);
updateStatus("Created TestCaseResult: " + myTestCaseResult.TestCase.Name + ", ref = " + [email protected]);
}
return true;
}
注意判決,日期和測試用例都在TestCaseResult所有必填字段。我看到你在哪裏設置myTestCaseResult.Build,myTestCaseResult.Verdict和myTestCaseResult.Build,但是我在代碼示例中沒有看到設置myTestCaseResult.Date的位置? – 2012-10-03 20:41:49
啊是的 - 我現在把它放回去(當試圖刪除我所有使用日期格式的黑客時錯過了它)。我把日期設置爲datetime.now –
但它仍然不工作:( –