コード例 #1
0
 private static TestResult parse(string error) {
     var msgStartToken = "PHP Parse error:";
     var stackTraceToken = "PHP Stack trace:";
     if (error.IndexOf(msgStartToken) == -1)
         return null;
     
     var message = trimMessage(error.Substring(msgStartToken.Length, error.Length - msgStartToken.Length));
     var stackLines = new List<StackLine>();
     var stackTraceStart = message.IndexOf(stackTraceToken);
     if (stackTraceStart != -1) {
         stackLines.AddRange(getStackTrace(message.Substring(stackTraceStart, message.Length - stackTraceStart)));
         message = trimMessage(message.Substring(0, stackTraceStart));
     }
     var msgStackLine = getMsgStackLine(message);
     if (msgStackLine != null)
         stackLines.Insert(0, msgStackLine);
     var test =
         new TestResult(
             TestRunner.PhpParseError,
             TestRunStatus.Failed,
             message);
     test.Message = message;
     test.StackTrace = stackLines.ToArray();
     return test;
 }
コード例 #2
0
ファイル: TestRunResults.cs プロジェクト: zinark/AutoTest.Net
 public TestRunResults(string project, string assembly, bool isPartialTestRun, TestResult[] testResults)
 {
     _project = project;
     _assembly = assembly;
     _isPartialTestRun = isPartialTestRun;
     _testResults = testResults;
 }
コード例 #3
0
 private static IEnumerable<TestResult> getTests(XmlNode suite) {
     var cases = suite.SelectNodes("testcase");
     var tests = new List<TestResult>();
     if (cases == null)
         return tests;
     foreach (XmlNode testcase in cases) {
         TestResult test;
         var name = testcase.Attributes["name"];
         var cls = testcase.Attributes["class"];
         if (cls != null) {
             test
                 = new TestResult(
                     TestRunner.PhpUnit,
                     getStateFrom(testcase),
                     cls.Value +"\\" + name.Value); 
             if (test.Status == TestRunStatus.Failed) {
                 test.Message = getMessage(testcase);
                 test.StackTrace = getStackTrace(testcase, test.Message).ToArray();
             }
         } else {
             test
                 = new TestResult(
                     TestRunner.PhpUnit,
                     getStateFrom(testcase),
                     suite.Attributes["name"].Value.Replace("::", @"\")); 
             if (test.Status == TestRunStatus.Failed) {
                 test.Message = getMessage(testcase);
                 test.StackTrace = getStackTrace(testcase, test.Message).ToArray();
             }
         }
         test.SetDisplayName(PhpUnitLiveParser.ToFriendlyName(getTestName(test.Name)));
         tests.Add(test);
     }
     return tests;
 }
コード例 #4
0
 public static TestResult Parse(string error) {
     try {
         var parsedTtest = parse(error);
         if (parsedTtest  != null)
             return parsedTtest  ;
     } catch {
     }
     var test =
         new TestResult(
             TestRunner.PhpParseError,
             TestRunStatus.Failed,
             trimMessage(error));
     test.Message = trimMessage(error);
     return test;
 }
コード例 #5
0
		public void SetDataFrom(BinaryReader reader)
		{
			var results = new List<TestResult>();
			_project = reader.ReadString();
			_assembly = reader.ReadString();
			_timeSpent = new TimeSpan((long) reader.ReadDouble());
			var count = reader.ReadInt32();
			for (int i = 0; i < count; i++)
			{
				var result = new TestResult(TestRunStatus.Ignored, "");
				result.SetDataFrom(reader);
				results.Add(result);
			}
			_testResults = results.ToArray();
		}
コード例 #6
0
 private static IEnumerable<TestResult> getTests(XmlNode suite) {
     var cases = suite.SelectNodes("testcase");
     var tests = new List<TestResult>();
     foreach (XmlNode testcase in cases) {
         var test
             = new TestResult(
                 TestRunner.PhpUnit,
                 getStateFrom(testcase),
                 testcase.Attributes["class"].Value +"\\" + testcase.Attributes["name"].Value); 
         if (test.Status == TestRunStatus.Failed) {
             test.Message = getMessage(testcase);
             test.StackTrace = getStackTrace(testcase, test.Message).ToArray();
         }
         tests.Add(test);
     }
     return tests;
 }
コード例 #7
0
 public void SetDataFrom(BinaryReader reader)
 {
     Assembly = reader.ReadString();
     Test = new TestResult(TestRunner.Any, TestRunStatus.Failed, "");
     Test.SetDataFrom(reader);
 }
コード例 #8
0
 public LiveTestStatus(string assembly, TestResult test)
 {
     Assembly = assembly;
     Test = test;
 }
コード例 #9
0
 public CacheTestMessage(string assembly, TestResult result)
 {
     Assembly = assembly;
     Test = result;
 }
コード例 #10
0
ファイル: TestResult.cs プロジェクト: rmterra/AutoTest.Net
 static TestResult()
 {
     _passResult = new TestResult(TestRunner.Any, TestRunStatus.Passed, string.Empty);
 }
コード例 #11
0
 public TestRunResults(string project, string assembly, TestResult[] testResults)
 {
     _project = project;
     _assembly = assembly;
     _testResults = testResults;
 }