Пример #1
0
 internal static void PopulateLogData(this Suite suite)
 {
     TestLogData.DefaultTestValues();
     TestLogData.testName      = suite.testName;
     TestLogData.testedBrowser = suite.browser;
     TestLogData.projectName   = suite.projectName;
 }
Пример #2
0
        public List <Suite> Populate()
        {
            TestLogData.DefaultTestValues();
            Command      cmd    = new Command("getSuiteInformation");
            List <Suite> result = this.ExecuteQuery(cmd);

            cmd.Dispose();
            return(result);
        }
Пример #3
0
 public static void PopulateLogData(this StepInfo stepInfo)
 {
     TestLogData.DefaultStepValues();
     TestLogData.stepNumber++;
     TestLogData.controlName    = stepInfo.controlName;
     TestLogData.actionName     = stepInfo.action;
     TestLogData.keywordName    = stepInfo.keyword;
     TestLogData.stepParameters = stepInfo.parameters;
     TestLogData.flags          = stepInfo.flags;
 }
Пример #4
0
 public string [] GetTestLogLines(string test)
 {
     lock (lock_object) {
         if (!test_logs.ContainsKey(test))
         {
             return(new string [0]);
         }
         TestLogData tld = test_logs [test] as TestLogData;
         return(tld.GetLogLines());
     }
 }
Пример #5
0
 public TestResult GetTestResult(string test)
 {
     lock (lock_object) {
         TestLogData tld = null;
         if (test_logs.ContainsKey(test))
         {
             tld = test_logs [test] as TestLogData;
         }
         else
         {
             throw new Exception("Attempting to get log result for test that does not exist.  Call IsTestResultSet first!");
         }
         return(tld.Result);
     }
 }
Пример #6
0
        /*
         * internal bool WaitForTestToComplete (string test, ExternalProcess process, int timeout)
         * {
         *      while (!IsTestComplete (test)) {
         *              WaitHandle [] handles = new WaitHandle [2];
         *              handles [0] = process.ExitedEvent;
         *              handles [1] = test_complete_event;
         *
         *              if (WaitHandle.WaitAny (handles, timeout, false) == WaitHandle.WaitTimeout) {
         *                      Console.WriteLine ("test did not complete correctly.  We timed out waiting for it to complete ({0}ms).", timeout);
         *                      return false;
         *              }
         *              Console.WriteLine ("got reset event");
         *      }
         *
         *      return true;
         * }
         */

        public bool IsTestResultSet(string test)
        {
            lock (lock_object) {
                TestLogData tld = null;
                if (test_logs.ContainsKey(test))
                {
                    tld = test_logs [test] as TestLogData;
                }
                else
                {
                    return(false);
                }

                return(tld.IsResultSet);
            }
        }
Пример #7
0
        public void Log(string test, string level, string message)
        {
            if (MoonlightTests.Driver.LogToStdout)
            {
                standalone.Log(test, level, message);
            }

            lock (lock_object) {
                TestLogData tld = null;
                if (test_logs.ContainsKey(test))
                {
                    tld = test_logs [test] as TestLogData;
                }
                else
                {
                    tld = new TestLogData();
                    test_logs [test] = tld;
                }

                tld.AddLogLine(level, message);
            }
        }
Пример #8
0
        public void LogResult(string test, int result)
        {
            if (Driver.LogToStdout)
            {
                standalone.LogResult(test, result);
            }

            lock (lock_object) {
                TestLogData tld = null;
                if (test_logs.ContainsKey(test))
                {
                    tld = test_logs [test] as TestLogData;
                }
                else
                {
                    tld = new TestLogData();
                    test_logs [test] = tld;
                }


                tld.SetTestResult(TestResultFromInt(result));
            }
        }
Пример #9
0
        public void TestComplete(string test, bool successful)
        {
            if (Driver.LogToStdout)
            {
                standalone.TestComplete(test, successful);
            }

            lock (lock_object) {
                TestLogData tld = null;
                if (test_logs.ContainsKey(test))
                {
                    tld = test_logs [test] as TestLogData;
                }
                else
                {
                    tld = new TestLogData();
                    test_logs [test] = tld;
                }
                tld.TestComplete(successful);

                Console.WriteLine("test complete:  {0}", test);
                test_complete_event.Set();
            }
        }
        public void DumpReport()
        {
            // WARNING!
            // This unit test does NOT validate the contents of the generated report.
            // It simply verifies that the report is written to a non-empty file.
            // Reports require visual testing because their contents are likely to change.
            // It would be better to manually inspect report contents than to unit test them.
            // Therefore, when making report changes, it is recommended to set a break point, debug, and manually view the file.

            string sspath = Path.Combine(AssemblyDir, "a.png");
            string rpath  = Path.Combine(AssemblyDir, "r.json");

            // Create test 1
            var t1step1 = new StepArtifactData("Step 1");

            t1step1.Messages.Add("Hello");
            t1step1.Messages.Add("Moto");
            t1step1.AddArtifact("Screenshots", sspath);
            t1step1.AddArtifact("Requests", rpath);
            var t1step2 = new StepArtifactData("Step 2");

            t1step2.Messages.Add("Moar");
            t1step2.Messages.Add("MoarMoar");
            t1step2.AddArtifact("Screenshots", sspath);
            var test1 = new TestLogData("Test 1");

            test1.Result = "Passed";
            test1.Steps.Add(t1step1);
            test1.Steps.Add(t1step2);

            // Create test 2
            var t2step1 = new StepArtifactData("Step 1");

            t2step1.Messages.Add("Second Hello");
            t2step1.Messages.Add("Second Moto");
            t2step1.AddArtifact("Screenshots", sspath);
            t2step1.AddArtifact("Requests", rpath);
            var t2step2 = new StepArtifactData("Step 2");

            t2step2.Messages.Add("Enough!");
            t2step2.Messages.Add("Stahp!");
            t2step2.AddArtifact("Screenshots", sspath);
            var test2 = new TestLogData("Test 2");

            test2.Result = "Failed";
            test2.Steps.Add(t2step1);
            test2.Steps.Add(t2step2);

            // Create test 3
            var t3step1 = new StepArtifactData("Step 1");

            t3step1.Messages.Add("A");
            t3step1.Messages.Add("B");
            t3step1.Messages.Add("C");
            t3step1.Messages.Add("D");
            t3step1.AddArtifact("Screenshots", sspath);
            t3step1.AddArtifact("Requests", rpath);
            var test3 = new TestLogData("Test 3");

            test3.Result = "Skipped";
            test3.Steps.Add(t3step1);

            // Create list of logs
            var logs = new List <TestLogData>
            {
                test1,
                test2,
                test3
            };

            // Dump the report
            FilePath = Dumper.Dump(logs, relativePath: AssemblyDir);

            // Read and verify the report
            using var file = new StreamReader(FilePath);
            string report = file.ReadToEnd();

            report.Should().NotBeNullOrWhiteSpace();
        }
Пример #11
0
		public void TestComplete (string test, bool successful)
		{
			if (Driver.LogToStdout)
				standalone.TestComplete (test, successful);

			lock (lock_object) {
				TestLogData tld = null;
				if (test_logs.ContainsKey (test))
					tld = test_logs [test] as TestLogData;
				else {
					tld = new TestLogData ();
					test_logs [test] = tld;
				}
				tld.TestComplete (successful);

				Console.WriteLine ("test complete:  {0}", test);
				test_complete_event.Set ();
			}
		}
Пример #12
0
		public void LogResult (string test, int result)
		{
			if (Driver.LogToStdout)
				standalone.LogResult (test, result);

			lock (lock_object) {
				TestLogData tld = null;
				if (test_logs.ContainsKey (test))
					tld = test_logs [test] as TestLogData;
				else {
					tld = new TestLogData ();
					test_logs [test] = tld;
				}

				
				tld.SetTestResult (TestResultFromInt (result));
			}
		}
Пример #13
0
		public void Log (string test, string level, string message)
		{
			if (MoonlightTests.Driver.LogToStdout)
				standalone.Log (test, level, message);

			lock (lock_object) {
				TestLogData tld = null;
				if (test_logs.ContainsKey (test))
					tld = test_logs [test] as TestLogData;
				else {
					tld = new TestLogData ();
					test_logs [test] = tld;
				}

				tld.AddLogLine (level, message);
			}
		}