Beispiel #1
0
 public TestCaseInformation(
     string categoryName, string id, string name, string description, object expected, TestCaseAsserts assert,
     MethodInfo method, Type[] additionalTypes, MethodBase[] additionalMethods, object[] arguments)
 {
     this.CategoryName      = categoryName;
     this.Id                = id;
     this.Name              = name;
     this.Description       = description;
     this.Method            = method;
     this.AdditionalTypes   = additionalTypes;
     this.AdditionalMethods = additionalMethods;
     this.Expected          = expected;
     this.Arguments         = arguments;
     this.Assert            = assert;
 }
Beispiel #2
0
        public void DummyTestOperation()
        {
            string currentExecutingMethod = Utilities.GetCurrentMethod();
            var    resultsWriter          = new ResultsWriter(Constants.ParameterizedTest, currentExecutingMethod, true);
            var    loginTestData          = DummyOperationData.GetTestData();

            Parallel.ForEach(WebDrivers, (driver, loopState) =>
            {
                var testAsserter = new TestCaseAsserts();
                string currentWebBrowserString = Utilities.GetWebBrowser(driver);

                if (loginTestData != null)
                {
                    ResultReport testResultReport = new ResultReport();
                    string testFixtureName        = Utilities.GenerateTestFixtureName(this.GetType(), currentExecutingMethod,
                                                                                      currentWebBrowserString);
                    testResultReport.StartMethodTimerAndInitiateCurrentTestCase(testFixtureName, true);
                    try
                    {
                        /*
                         * Call page flow respective method here.
                         */

                        /*
                         * Call necessary assertion from TestCaseAsserts class here.
                         */
                        testResultReport.SetCurrentTestCaseOutcome(true, testAsserter.AssertionCount.ToString());
                    }
                    catch (Exception e)
                    {
                        string screenShotIdentifier = String.Format("{0} - {1}", "{ENTER AN IDENTIFIER (E.G. USER NAME}", currentExecutingMethod);
                        base.HandleException(e, screenShotIdentifier, driver, testResultReport, testAsserter, resultsWriter);
                        Assert.Fail("***** DummyTest Failed *****");
                    }
                    finally
                    {
                        testResultReport.StopMethodTimerAndFinishCurrentTestCase();
                        base.TestCases.Add(testResultReport.currentTestCase);
                    }
                }
            });

            resultsWriter.WriteResultsToFile(this.GetType().Name, TestCases);
        }
Beispiel #3
0
 protected void HandleException(
     Exception ex,
     string screenshotIdentifier,
     IWebDriver webDriver,
     ResultReport resultReport,
     TestCaseAsserts asserts,
     ResultsWriter writer)
 {
     ScreenShotImage.CaptureScreenShot(
         webDriver,
         Utilities.CombineTestOutcomeString(Constants.ScreenshotError, screenshotIdentifier));
     resultReport.SetCurrentTestCaseOutcome(
         false,
         asserts.AssertionCount.ToString(),
         ex.Message,
         ex.StackTrace);
     resultReport.StopMethodTimerAndFinishCurrentTestCase();
     this.TestCases.Add(resultReport.currentTestCase);
     writer.WriteResultsToFile(this.GetType().Name, TestCases);
 }