コード例 #1
0
        //---------------------------------------------------------------------
        private void ProcessTestCases(JUnitTestSuite jUnitTestSuite, JUnitTestCase jUnitTestCase)
        {
            Guid executionId = Guid.NewGuid();
            Guid testId      = Guid.NewGuid();

            var trxUnitTestResult = new TrxUnitTestResult
            {
                ExecutionId  = executionId,
                TestId       = testId,
                StartTime    = jUnitTestSuite.TimeStamp,
                Duration     = TimeSpan.FromSeconds(jUnitTestCase.TimeInSeconds),
                EndTime      = jUnitTestSuite.TimeStamp.AddSeconds(jUnitTestCase.TimeInSeconds),
                TestName     = jUnitTestCase.Name,
                Outcome      = TrxOutcome.Passed,
                ComputerName = jUnitTestSuite.HostName
            };

            if (jUnitTestCase.Skipped)
            {
                trxUnitTestResult.Outcome = TrxOutcome.NotExecuted;
            }

            if (jUnitTestCase.Error != null)
            {
                trxUnitTestResult.Outcome    = TrxOutcome.Failed;
                trxUnitTestResult.Message    = jUnitTestCase.Error.Message;
                trxUnitTestResult.StackTrace = jUnitTestCase.Error.StackTrace;
            }

            trxUnitTestResult.StdErr = jUnitTestCase.SystemErr;
            trxUnitTestResult.StdOut = jUnitTestCase.SystemOut;

            var trxTestDefinition = new TrxTestDefinition
            {
                Id          = testId,
                ExecutionId = executionId,
                TestClass   = jUnitTestCase.ClassName,
                TestMethod  = jUnitTestCase.Name
            };

            this.Result.UnitTestResults.Add(trxUnitTestResult);
            this.Result.TestDefinitions.Add(trxTestDefinition);
        }
コード例 #2
0
 //---------------------------------------------------------------------
 private void AddTest(JUnitTestSuite junitTestSuite, TrxTestDefinition trxTestDefinition)
 {
     Debug.Assert(_trxTestDefinitionLookup != null);
     IEnumerable <TrxUnitTestResult> trxUnitTestResults = _trxTestDefinitionLookup ![trxTestDefinition.Id];