我正在使用Rally SOAP API来针对先前已创建的测试用例创建新的TestCaseResult。但是当我创建结果时,我会出错 - '验证错误:testCaserSult.date不应该是null'

不确定为什么应该是这种情况 - 你可以帮忙吗?

    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 = " + myTestCaseResult.@ref);
        }
        return true;
    }
.

有帮助吗?

解决方案

我相信你已经遇到了一个已知的错误,其中我忘记了直到现在才忘记了。基本上,错误是,即使在TestCaserSult上指定有效的日期/时间对象时,ocap erializer无法识别出这个,除非您还设置了特定标志为真,即:

mytestcaseresult.datespecified= true;

请设置此标志,然后重新运行代码 - 它应该现在工作:)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top