Example #1
0
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            try
            {
                if (sqlConnection == null)
                {
                    sqlConnection = new SqlConnection(sqlConnectionString);

                    using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
                    {
                        if (sqlConnection.State != System.Data.ConnectionState.Open)
                        {
                            sqlConnection.Open();
                        }

                        sqlCommand.CommandText = string.Format(testRunInsert, DateTime.Now);
                        testRunId = Convert.ToInt32(sqlCommand.ExecuteScalar());
                    }
                }
            }
            catch (Exception e)
            {
                TestTrace.Trace(e.ToString());
            }
        }
 public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     if (args.TestScriptObject is TestSuite)
     {
         initialTestSuite = args.TestScriptObject as TestSuite;
     }
 }
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            _totalPassed   = 0;
            _totalFailed   = 0;
            _totalErrored  = 0;
            _totalInactive = 0;

            string delimitedRecipients;

            _build        = Convert.ToString(TestProperties.GetPropertyValue("Build"));
            _buildTrigger = Convert.ToString(TestProperties.GetPropertyValue("BuildTrigger"));
            _mailHost     = Convert.ToString(TestProperties.GetPropertyValue("MailHost"));
            _port         = Convert.ToInt32(TestProperties.GetPropertyValue("Port"));
            _sender       = Convert.ToString(TestProperties.GetPropertyValue("Sender"));

            delimitedRecipients = Convert.ToString(TestProperties.GetPropertyValue("Recipients"));

            _recipients = delimitedRecipients.Split(new char[] { ';' });

            for (int i = 0; i < _recipients.Length; i++)
            {
                _recipients[i] = _recipients[i].Trim();
            }

            // Add computer information.
            appendToBody(string.Format("\r\nTester:  {0}\r\nHost machine:  {1}\r\nRun time:  {2}",
                                       Environment.UserName, Environment.MachineName, DateTime.Now.ToString("F")));
        }
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            int time = 1;

            Thread.Sleep(time * 1000);
            LogEvent.Debug($"{MethodInfo.GetCurrentMethod().Name} {args.VirtualUser}, sleep time: {time}");
        }
Example #5
0
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            // start reporters
            var htmlReporter = new ExtentHtmlReporter(@"C:\DevProjects\Quintity\Repos\TestFramework\Source\Quintity.TestFramework.TestListeners\Quintity.TestFramework.ListenerTests\TestResults\bob.html");

            // create ExtentReports and attach reporter(s)
            _extent = new AventStack.ExtentReports.ExtentReports();
            _extent.AttachReporter(htmlReporter);
            _extent.AddSystemInfo("sysname", "sysInfo");

            //// creates a test
            //var test = _extent.CreateTest("MyFirstTest", "Sample1 description");

            //// log(Status, details)
            //test.Log(AventStack.ExtentReports.Status.Info, "This step shows usage of log(status, details)");

            //// info(details)
            //test.Info("This step shows usage of info(details)");

            //// log with snapshot
            //test.Fail("details",
            //    MediaEntityBuilder.CreateScreenCaptureFromPath(@"c:\temp\screenshot.png").Build());

            //// test with snapshot
            //test.AddScreenCaptureFromPath(@"c:\temp\screenshot.png");

            //test = _extent.CreateTest("MySecondTest", "Sample2 description");
            //test.AssignAuthor(new string[] { "jmothers" });
            //var test2 = test.CreateNode("Bob", "FirstNode");
            //test2.CreateNode("Jim", "Nested node");
        }
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            LogEvent.Debug($"Listener instance virtual user:  {VirtualUser}");

            int time = 500;

            Thread.Sleep(time);
            LogEvent.Debug($"{MethodInfo.GetCurrentMethod().Name} {args.VirtualUser}, sleep time: {time}");
        }
 private void TestExecutor_OnExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     if (this.InvokeRequired)
     {
         OnTestExecutorExecutionBeginDelegate d = new OnTestExecutorExecutionBeginDelegate(onBeginningTestExecution);
         BeginInvoke(d, new object[] { testExecutor, args });
     }
     else
     {
         onBeginningTestExecution(testExecutor, args);
     }
 }
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            LogEvent.Debug($"{MethodInfo.GetCurrentMethod().Name} {args.VirtualUser}");

            if (!TestListenersCache.TryGetValueAsString("MetricsFolder", out _metricsFolder))
            {
                _metricsFolder = string.Format("{0}\\{1}", _resultsFolder, DateTime.Now.ToString("*****@*****.**"));
                Directory.CreateDirectory(_metricsFolder);

                TestListenersCache.Add("MetricsFolder", _metricsFolder);
                LogEvent.Debug($"Metric folder added listeners cache ({_metricsFile}).");
                _metricsContent.AppendLine("VirtualUser!PerID|Description|StartTime|StopTime|ElapsedTime(sec)|StateArgs");
            }

            _resultsFile = string.Format("{0}\\TestResults.csv", _metricsFolder);
            _metricsFile = string.Format("{0}\\TestMetrics.csv", _metricsFolder);
        }
        public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            LogEvent.Debug($"{MethodInfo.GetCurrentMethod().Name} {args.VirtualUser}");

            try
            {
                if (_validExecution)
                {
                    onTestExecutionBegin(testExecutor, args);
                }
            }
            catch (Exception e)
            {
                _validExecution = false;
                LogEvent.Error(e.ToString());
                throw;
            }
        }
        private void onTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            TestAssert.IsFalse(string.IsNullOrEmpty(args.TestScriptObject.UserID), "");

            // Reset run time totals
            _totalRunTestCases = _totalRunTestSteps = _totalRunTestChecks = 0;

            // Create TestRail client.
            _testRailClient = new TestRailClient(_testRailUrl, _testRailUser, _testRailPassword);

            // Get applicable project
            _testRailProject = getTestRailProject(_testRailProjectName);

            // Project milestone
            var milestones = _testRailClient.GetMilestones(_testRailProject.ID);
            var milestone  = milestones.Find(x => x.Name.Contains(_testRailProjectName) &&
                                             x.Name.Contains(_productVersion));

            // Create test run
            _testRailRun = addTestRailRun(_testRailProject, milestone, (TestSuite)args.TestScriptObject);
        }
        private void onBeginningTestExecution(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            _isExecuting = true;

            // Start timers
            m_stopWatch = Stopwatch.StartNew();
            m_executionTimer.Start();

            // Set execution UI
            //Cursor.Current = Cursors.WaitCursor;
            setExecutionUI(true);
            resetViewerAndStatusBar();
            m_viewersTabControl.SelectedTab = m_traceViewerTabPage;

            int availableCases = 0;

            if (testExecutor.TestScriptObject is TestSuite)
            {
                availableCases = ((TestSuite)testExecutor.TestScriptObject).AvailableTestCases();

                if (m_testTreeView.TestProfile != null)
                {
                    availableCases = availableCases * m_testTreeView.TestProfile.VirtualUsers;
                }
            }
            else if (testExecutor.TestScriptObject is TestCase)
            {
                availableCases = 1;
            }

            m_totalAvailableStatusBarLabel.Tag         = availableCases;
            m_totalAvailableStatusBarLabel.Text        = availableCases.ToString();
            m_totalAvailableStatusBarLabel.ToolTipText = string.Format(m_totalLabelFormat, getPercentageString(100, 100));

            m_viewersTabControl.SelectedTab = m_traceViewerTabPage;

            m_traceViewer.AppendText(string.Format("Beginning execution ({0} virtual user(s)).\n\n",
                                                   m_testTreeView.TestProfile != null ? m_testTreeView.TestProfile.VirtualUsers : 1));
            m_traceViewer.ScrollToCaret();
        }
 public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
 }
 public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     throw new NotImplementedException();
 }
 private void onBeginningTestExecution(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     _isExecuting = true;
 }
Example #15
0
 public override void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     Debug.WriteLine("SampleTestListener2 method:  " + MethodInfo.GetCurrentMethod().Name);
 }
Example #16
0
 private void TestExecutor_OnExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     _listenerEventsClient?.OnTestExecutionBegin(args);
 }
Example #17
0
 public abstract void OnTestExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args);
Example #18
0
 internal static void fireExecutionBeginEvent(TestExecutor testExecutor, TestExecutionBeginArgs args)
 {
     OnExecutionBegin?.Invoke(testExecutor, args);
 }
        private static void TestExecutor_OnExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            initialTestSuite = args.TestScriptObject as TestSuite;

            LogEvent.Info(message: $"Beginning test execution.");
        }
Example #20
0
        private static void TestExecutor_OnExecutionBegin(TestExecutor testExecutor, TestExecutionBeginArgs args)
        {
            initialTestSuite = args.TestScriptObject as TestSuite;

            LogEvent.Info($"Beginnning execution of test suite \"{initialTestSuite.Title}\"");
        }