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;
 }
Ejemplo n.º 2
0
 public TestRunResults(string project, string assembly, bool isPartialTestRun, TestResult[] testResults)
 {
     _project = project;
     _assembly = assembly;
     _isPartialTestRun = isPartialTestRun;
     _testResults = testResults;
 }
Ejemplo n.º 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;
 }
 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;
 }
Ejemplo n.º 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();
		}
Ejemplo n.º 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;
 }
 public void SetDataFrom(BinaryReader reader)
 {
     Assembly = reader.ReadString();
     Test = new TestResult(TestRunner.Any, TestRunStatus.Failed, "");
     Test.SetDataFrom(reader);
 }
 public LiveTestStatus(string assembly, TestResult test)
 {
     Assembly = assembly;
     Test = test;
 }
 public CacheTestMessage(string assembly, TestResult result)
 {
     Assembly = assembly;
     Test = result;
 }
Ejemplo n.º 10
0
 static TestResult()
 {
     _passResult = new TestResult(TestRunner.Any, TestRunStatus.Passed, string.Empty);
 }
Ejemplo n.º 11
0
 public TestRunResults(string project, string assembly, TestResult[] testResults)
 {
     _project = project;
     _assembly = assembly;
     _testResults = testResults;
 }