Ejemplo n.º 1
0
 /// <summary>
 /// Creates a test.  Call before each test
 /// </summary>
 /// <param name="testName"></param>
 /// <param name="description"></param>
 public static void CreateTest(string testName, string description = null)
 {
     lock (_synclock)
     {
         _tests[testName]   = _extentReports.CreateTest(testName, description);
         _currentTest.Value = _tests[testName];
     }
 }
        public static void AddTest()
        {
            string testName     = TestContext.CurrentContext.Test.MethodName;
            string testCategory = TestContext.CurrentContext.Test.ClassName.Substring(31);

            TEST = EXTENT_REPORT.CreateTest(testName).AssignCategory(testCategory);
        }
Ejemplo n.º 3
0
        public static void AddTest()
        {
            string testName = TestContext.CurrentContext.Test.MethodName;


            TEST = EXTENT_REPORT.CreateTest(testName);
        }
Ejemplo n.º 4
0
        public void ParseTestRunnerOutput(string trxFile)
        {
            var trxObj                = GetTesteResultContentFile(trxFile);
            var unitTestsToReport     = GetUnitTestesToReport(trxObj);
            var specFlowTestsToReport = GetSpecflowTestesToReport(trxObj);
            var testsToReport         = unitTestsToReport.Concat(specFlowTestsToReport).ToList();

            _logger.LogInformation($"Total de testes unitários reportados: {unitTestsToReport.Count()}");
            _logger.LogInformation($"Total de testes comportamentos reportados: {specFlowTestsToReport.Count()}");
            testsToReport.ForEach(test =>
            {
                var feature = _extentReports.CreateTest <Feature>(test.Feature);
                SetStartEndTime(feature.Model, test.Scenario.SelectMany(x => x.Steps).Min(x => x.StartTime), test.Scenario.SelectMany(x => x.Steps).Max(x => x.EndTime));
                _logger.LogInformation($"Processando a funcionalidade: {feature.Model.Name}");
                test.Scenario.ForEach(sc =>
                {
                    var scenario = feature.CreateNode <Scenario>(sc.Name);
                    SetStartEndTime(scenario.Model, sc.Steps.Min(x => x.StartTime), sc.Steps.Max(x => x.EndTime));
                    _logger.LogInformation($"Processando o cenário: {scenario.Model.Name}");
                    sc.Steps.ForEach(s =>
                    {
                        var step = scenario.CreateNode(s.Keyword, s.Name, s.Description);
                        if (s.Error != null)
                        {
                            var errorMessage = $"{WebUtility.HtmlEncode(s.Error.Message)}<br/><br/>{WebUtility.HtmlEncode(s.Error.StackTrace)}<br/>";
                            step.Fail(errorMessage);
                        }
                        SetStartEndTime(step.Model, s.StartTime, s.EndTime);
                        _logger.LogInformation($"Processando o passo: {step.Model.Name}");
                    });
                });
            });
        }
Ejemplo n.º 5
0
        public static void AddTest()
        {
            string testName     = TestContext.CurrentContext.Test.MethodName;
            string testCategory = TestContext.CurrentContext.Test.ClassName.Substring(Int32.Parse(JsonBuilder.ReturnParameterAppSettings("REPORT_SUBSTRING_LENGTH")));

            TEST = EXTENT_REPORT.CreateTest(testName).AssignCategory(testCategory);
        }
Ejemplo n.º 6
0
        public static void BeforeFeature()
        {
            setUpBrowser();

            Log.Information("[Feature] : {0}", FeatureContext.Current.FeatureInfo.Title);
            featureName = extent.CreateTest <Feature>(FeatureContext.Current.FeatureInfo.Title);
        }
Ejemplo n.º 7
0
 public static void BeforeFeatureStarts(FeatureContext featureContext)
 {
     if (null != featureContext)
     {
         _featureName = _extentReports.CreateTest <Feature>(featureContext.FeatureInfo.Title, featureContext.FeatureInfo.Description);
     }
 }
Ejemplo n.º 8
0
 public static void BeforeFeature(FeatureContext featureContext)
 {
     if (ExtentReportReq)
     {
         //Create dynamic feature name
         featureName = extent.CreateTest <Feature>(featureContext.FeatureInfo.Title);
     }
 }
Ejemplo n.º 9
0
        private void BeforeScenario()
        {
            string url = Settings.Default.Url;

            PageProvider = new PageProvider(Settings.Default.browserType);
            PageProvider.Browser.Navigate().GoToUrl(url);
            test = extentReport.CreateTest(context.ScenarioInfo.Title);
        }
Ejemplo n.º 10
0
 public static void BeforeFeature(FeatureContext featureContext)
 {
     if (!string.IsNullOrEmpty(ExtentReportReq) && ExtentReportReq.Equals("Yes"))
     {
         //Create dynamic feature name
         featureName = extent.CreateTest <Feature>(featureContext.FeatureInfo.Title);
     }
 }
 /// <summary>
 /// Get feature info
 /// </summary>
 /// <param name="featureContext"></param>
 public static void GetFeatureInfo(FeatureContext featureContext)
 {
     if (Settings.ExtentReportReq)
     {
         //Create dynamic feature name
         featureName = extent.CreateTest <Feature>(featureContext.FeatureInfo.Title);
     }
 }
Ejemplo n.º 12
0
 public void CreateWebDriver(ScenarioContext context)
 {
     // We are using Chrome, but you can use any driver
     SelectBrowser(BrowserType.Firefox);
     context["WEB_DRIVER"] = webDriver;
     featureName           = report.CreateTest <Feature>(_featureContext.FeatureInfo.Title);
     scenario = featureName.CreateNode <Scenario>(_scenarioContext.ScenarioInfo.Title);
 }
Ejemplo n.º 13
0
        public void TestInitializer()
        {
            //HookInitialize init = new HookInitialize();
            //TestInitializeHook init = new TestInitializeHook();
            InitializeSettings();

            featureName = extent.CreateTest <Feature>(_featureContext.FeatureInfo.Title);
            scenario    = featureName.CreateNode <Scenario>(_scenarioContext.ScenarioInfo.Title);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// News the test case.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <returns></returns>
        /// <exception cref="System.InvalidOperationException">Initialize</exception>
        public IReporter NewTestCase(string name, string description)
        {
            EnsureInitialized();

            _currentTest = _extentReport.CreateTest(name, description);
            _currentTest.AssignCategory(_currentTestSuiteName);

            return(this);
        }
Ejemplo n.º 15
0
        public void BeforeScenario()
        {
            if (_featureName is null)
            {
                _featureName = _extent.CreateTest <Feature>(_featureContext.FeatureInfo.Title);
            }

            _scenario = _featureName.CreateNode <Scenario>(_scenarioContext.ScenarioInfo.Title);
        }
Ejemplo n.º 16
0
        public virtual void BeforeEachTest()
        {
            ExtentTest = ExtentReports.CreateTest(TestContext.CurrentContext.Test.Name);
            WebDriver  = WebDriverInitializer.Initialize(DriverType);
            WebDriver.Manage().Window.Maximize();
            WebDriver.Navigate().GoToUrl(PageUrls.HomePage);

            Initialize();
        }
Ejemplo n.º 17
0
        public void Initialize(IWebDriver driver)
        {
            _driver = driver;
            var context = TestContext.CurrentContext;

            if (context.Test.Properties["Description"].Any())
            {
                var description = context.Test.Properties["Description"].First().ToString();
                _test = _extent.CreateTest(context.Test.Name, description);
            }
            else
            {
                _test = _extent.CreateTest(context.Test.Name);
            }
            foreach (var category in context.Test.Properties["Category"])
            {
                _test.AssignCategory(category.ToString());
            }
        }
Ejemplo n.º 18
0
        public void Initialize()
        {
            _test = _extent.CreateTest(TestContext.CurrentContext.Test.Name);

            channelPage.GoTo(Browser.AppConfig.RMSBaseUrl);
            channelPage.ChooseAndClick(BaseTestData.USERNAME_PASSWORD_LOGIN);

            loginPage.InputLoginName(BaseTestData.Admin.LOGIN_NAME);
            loginPage.InputLoginPassword(BaseTestData.Admin.LOGIN_PASSWORD);
            loginPage.Login();
        }
Ejemplo n.º 19
0
 public void BeforeTest()
 {
     try
     {
         _test = _extent.CreateTest(TestContext.CurrentContext.Test.Name);
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Ejemplo n.º 20
0
        public void GetScenarioAndFeatureInfo()
        {
            var featureTags  = this.featureContext.FeatureInfo.Tags;
            var featureTitle = this.featureContext.FeatureInfo.Title;

            var scenarioTags  = this.scenarioContext.ScenarioInfo.Tags;
            var scenarioTitle = this.scenarioContext.ScenarioInfo.Title;

            this.feature  = extent.CreateTest <Feature>(featureTitle).AssignCategory(featureTags);
            this.scenario = this.feature.CreateNode <Scenario>(scenarioTitle).AssignCategory(scenarioTags);
        }
Ejemplo n.º 21
0
        public void Initialize()
        {
            InitializeSettings();
            Settings.ApplicationCon = Settings.ApplicationCon.DBConnect(Settings.AppConnectionString);

            //Get feature Name
            featureName = extent.CreateTest <Feature>(_featureContext.FeatureInfo.Title);

            //Create dynamic scenario name
            _currentScenarioName = featureName.CreateNode <Scenario>(_scenarioContext.ScenarioInfo.Title);
        }
Ejemplo n.º 22
0
        public static void AddTest()
        {
            string[] className = (TestContext.CurrentContext.Test.ClassName).Split('.');
            string   categoria = className[(className.Length) - 1];

            string testName        = TestContext.CurrentContext.Test.MethodName ?? "NoTestName";
            var    testCategory    = (TestContext.CurrentContext.Test?.Properties["Category"]).Cast <string>().ToArray();
            var    testDescription = TestContext.CurrentContext.Test.Properties.Get("Description") ?? "";

            TEST = EXTENT_REPORT.CreateTest(testName, testDescription.ToString()).AssignCategory(categoria);
        }
Ejemplo n.º 23
0
        public void BeforeTestMethod()

        {
            _test = Reporter.CreateTest(TestContext.CurrentContext.Test.Name);
            // string path = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory + @"\..\..\..\driver");
            // FrameworkHelper.WebDriver = new ChromeDriver(path);
            FrameworkHelper.WebDriver = new ChromeDriver(@"C:\Driver\chromedriver_win32");
            FrameworkHelper.wait      = new WebDriverWait(FrameworkHelper.WebDriver, TimeSpan.FromSeconds(30));


            NavigeteToUrl();
        }
Ejemplo n.º 24
0
        public static ExtentTest CreateTest(string name, string categories, string description = "")
        {
            var test = extent.CreateTest(name, description);

            if (!string.IsNullOrEmpty(categories))
            {
                test.AssignCategory(categories.Split(","));
            }

            CurrentTest = test;
            return(test);
        }
Ejemplo n.º 25
0
        public void githubGistWebTest()
        {
            LoginPage        LoginP    = new LoginPage(this.driver);
            DiscoverGistPage DiscoverP = new DiscoverGistPage(this.driver);
            AddGistPage      AddgistP  = new AddGistPage(this.driver);

            test = extent.CreateTest("Gist");
            DiscoverP.getSignIn().Click();
            LoginP.getUserName().SendKeys(ReadData.Email);
            LoginP.getPassword().SendKeys(ReadData.Password);
            LoginP.getLoginButton().Click();
            DiscoverP.getGithubIcon().Click();

            test.Log(Status.Info, "Log in User");

            AddgistP.getDescription().SendKeys(ReadData.Description);

            AddgistP.getFileExtension().SendKeys(ReadData.FileExtention);

            AddgistP.getFileExtension().SendKeys(Keys.Tab + Keys.Tab + Keys.Tab + Keys.Tab + ReadData.Content);

            AddgistP.getselectGist().Click();
            AddgistP.getCreatePublicGistoption().Click();
            AddgistP.getCreatePublicGistBtn().Click();

            test.Log(Status.Info, "Add Gist");

            AddgistP.getEditGist().Click();


            AddgistP.getAddFile().Click();
            AddgistP.getFileExtension().SendKeys(ReadData.FileExtention2);

            AddgistP.getLastfileExtension().SendKeys(Keys.Tab + Keys.Tab + Keys.Tab + Keys.Tab + Keys.Tab + ReadData.Content2);
            test.Log(Status.Info, "Edit Gist");
            AddgistP.getCommentBtn().Click();
            AddgistP.getCommentField().SendKeys(ReadData.Comment1);
            AddgistP.getCommentBtn().Click();
            Thread.Sleep(2000);
            AddgistP.getCommentField().Click();
            AddgistP.getCommentField().SendKeys(ReadData.Comment2);
            AddgistP.getCommentBtn2().Click();

            test.Log(Status.Info, "Add two Comments");
            AddgistP.getLastComment().Click();

            AddgistP.getdeleteCommentsbtn().Click();

            AddgistP.confirmDeleionAlert();
            test.Log(Status.Info, "Delete Last Comment");
        }
Ejemplo n.º 26
0
    public void testMethod()
    {
        ExtentTest test;

        test = extent.CreateTest("testMethod").Info("Test Started");
        String title = driver.Title;

        System.Console.WriteLine("title of site is : " + title);
        test.Log(Status.Info, "Chrome browser launched!");
        IWebElement button = driver.FindElement(By.XPath("//*[@id=\"download-buttons\"]/div[1]/button[1]"));

        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
        test.Log(Status.Info, "Look for Download button!");
        Assert.AreEqual("Download for Mac\nStable Build", button.Text);
        test.Log(Status.Info, "Button found successfully!");
    }
Ejemplo n.º 27
0
 public void CreateTest(string TestName, string task = null)
 {
     //one report
     if (report == null)
     {
         CreateReport(TestName, task);
     }
     else
     {
         report.Flush();
         if (curTest == null || curTest.Model.Name != TestName)
         {
             curTest = report.CreateTest(TestName);
             report.Flush();
         }
     }
 }
Ejemplo n.º 28
0
        public void ExtentReport()
        {
            var htmlReporter = new ExtentHtmlReporter(@"C:\report\xpto2.html");

            htmlReporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Dark;
            //htmlReporter.Start();
            var extent = new AventStack.ExtentReports.ExtentReports();

            extent.AttachReporter(htmlReporter);

            var testLog = extent.CreateTest("My First Test", "Sample Description");

            testLog.Log(Status.Info, "This step shows usage of log(status, details)");
            testLog.Info("This step shows usage of info(details)");
            testLog.Fail("details", MediaEntityBuilder.CreateScreenCaptureFromPath("screenshot.png").Build());
            testLog.AddScreenCaptureFromPath("screenshot.png");
            extent.Flush();
        }
Ejemplo n.º 29
0
        public override void OnTestSuiteExecutionBegin(TestSuite testSuite, TestSuiteBeginExecutionArgs args)
        {
            ExtentTest extentTest = null;

            var description = $"Test suite:  {testSuite.Title}";

            //If parent is empty, must be root test suite.
            if (testSuite.ParentID.Equals(Guid.Empty))
            {
                extentTest = _extent.CreateTest(testSuite.Title);
            }
            else
            {
                extentTest = getExtentTest(testSuite.ParentID).CreateNode(testSuite.Title);
            }
            var bob = extentTest.Model;

            addToDictionary(testSuite.SystemID, extentTest);
        }
Ejemplo n.º 30
0
        public void shoppingMethod(String browser)
        {
            setUp(browser);
            driver.Url = Constants.URL;
            test       = extent.CreateTest("shoppingMethod");
            //Create Objects from classes Home and Sign In and Pass the driver to it
            Home   h1 = new Home(driver);
            SignIn s1 = new SignIn(driver);

            h1.clickSignIn();
            test.Log(Status.Info, "Click Sign in");
            s1.createAccount();
            s1.clickCreateAccount();
            Register r1 = new Register(driver);

            r1.insertCustomerName(ReadData.Customerfirstname, ReadData.Customerlastname);
            r1.insertPassword(ReadData.Password);
            r1.insertBirthday();
            r1.insertName(ReadData.FirstName, ReadData.LastName);
            r1.insertCompany(ReadData.Company);
            r1.insertAddress(ReadData.Address, ReadData.City, ReadData.State);
            r1.insertPostal(ReadData.Postal);
            r1.insertPhoneAndMobile(ReadData.Phone, ReadData.Mobile);
            r1.clickRegister();
            test.Log(Status.Info, "Register New User");
            h1.clickTshirtsTab();
            ProductSelection pselect = new ProductSelection(driver);

            pselect.selectProduct(ReadData.Shirt);
            pselect.clickAddToCart();
            test.Log(Status.Info, "Select a Product and add to Cart");
            pselect.clickProceedToCheckout();
            Payout pay = new Payout(driver);

            pay.clickProceed();
            pay.checkAggreementAndProceed();
            pay.selectPaymentMethodAndConfirm();
            test.Log(Status.Info, "Order Product");
            String msg = pay.getConfirmationMsg();

            Verifications.VerifyShopping.Verifytxt(msg);
        }