Beispiel #1
0
 //[Description("verification")]
 //[TestCaseSource("DataDrivenTesting")]
 public void CustomeExecuteTest()
 {
     //EnterText(driver,element,value,elementtype)
     CustomSetMethod.EnterText(driver, "firstname", "prashant", "Id");
     CustomSetMethod.SelectDropDown(driver, "sel1", "India", "Id");
     Console.WriteLine("the value of firstname is-" + CustomGetMethod.GetText(driver, "firstname", "Id"));
     Console.WriteLine("the value of drop down is-" + CustomGetMethod.GetText(driver, "sel1", "Id"));
     CustomSetMethod.Click(driver, "btn", "ClassName");
 }
Beispiel #2
0
        [Test]//run the test case ----make method as a calleable
        public void ExtentReporGeneratedTestMethod()
        {
            ExtentTest Test = null;

            Test = extent.CreateTest("ExtentReporGeneratedTestMethod").Info("...Test Start...");

            try
            {
                Test.Log(Status.Info, "Firefox open");

                //Initialization  of browser every time so put it as a separate
                driver.Navigate().GoToUrl("http://www.uitestpractice.com/Students/Form");
                Test.Log(Status.Info, "uitestpractice Students Form open");

                //EnterText(driver,element,value,elementtype)
                CustomSetMethod.EnterText(driver, "firstname", "prashant", "Id");
                Test.Log(Status.Info, "firstname entered");

                CustomSetMethod.SelectDropDown(driver, "sel1", "India", "Id");
                Test.Log(Status.Info, "DropDown value entered");

                Console.WriteLine("the value of firstname is-" + CustomGetMethod.GetText(driver, "firstname", "Id"));
                Console.WriteLine("the value of drop down is-" + CustomGetMethod.GetText(driver, "sel1", "Id"));

                CustomSetMethod.Click(driver, "btn", "ClassName");
                Test.Log(Status.Info, "btn  clicked");

                driver.Close();
                Test.Log(Status.Info, "...test  passed...");
                Test.Pass("Screenshot", MediaEntityBuilder.CreateScreenCaptureFromPath("Screenshot.png").Build());
                Test.Pass("Screenshot").AddScreenCaptureFromPath("Screenshot.png");
            }
            catch (Exception ex)
            {
                Test.Log(Status.Fail, ex.ToString());
                throw;
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }