public void StartTest() { string className; className = TestContext.CurrentContext.Test.ClassName; className = className.Substring(className.LastIndexOf(".") + 1); string TestFullName = TestContext.CurrentContext.Test.FullName; string TestName = TestFullName.Substring(TestFullName.IndexOf(".", TestFullName.IndexOf(".") + 1) + 1); string TestDescription; try { TestDescription = TestContext.CurrentContext.Test.Properties.Get("Description").ToString(); TestDescription = "<br><font size='1'>" + TestDescription + "</font>"; } catch (System.Exception) { TestDescription = ""; } ExtentReportUtil.Test = ExtentReportUtil.extent.CreateTest(TestName + " " + TestDescription); if (TestDescription.Contains("API")) { } else { new Common().LaunchBrowser(GlobalVariables.Browser) .NavigateTo(GlobalVariables.URL); } testData = new XMLTestDataReader(); //testData.SetXMLName(className); GlobalVariables.testCaseID = TestContext.CurrentContext.Test.MethodName; }
public static void StartTest() { report = new ExtentReportUtil(); string logFolderName = "Report" + DateTime.Now.ToString("yyyy_MM_dd_hhmmss"); logReportFolder = reportFolder + logFolderName; Directory.CreateDirectory(logReportFolder + "/screenshots"); //For Logo Directory.CreateDirectory(logReportFolder + "/render"); File.Copy(projectPath + "//Utilities/ReportUtil/gac.png", logReportFolder + "//render//gac.png"); extent = new ExtentReports(); htmlReporter = new ExtentHtmlReporter(logReportFolder + @"\extent.html"); htmlReporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Dark; extent.AddSystemInfo("Host Name", MachineName); extent.AddSystemInfo("User Name", LoggedInUser); extent.AddSystemInfo("Environment", Environment); htmlReporter.LoadConfig(projectPath + @"Utilities\ReportUtil\extent-config.xml"); extent.AttachReporter(htmlReporter); testData = new XMLTestDataReader(); }
public void Init() { XMLTestDataReader testData; // xmlReader.LoadXML(GlobalVariables.EnvConfigurationPath); // GlobalVariables.BrowserStack_Parallel = xmlReader.ReadTagValue("parallel", "capabilities"); // NameValueCollection caps = ConfigurationManager.GetSection("capabilities/parallel") as NameValueCollection; //.GetSection("capabilities/" + profile) as NameValueCollection; //NameValueCollection settings = ConfigurationManager.GetSection("environments/" + environment) as NameValueCollection; DesiredCapabilities capability = new DesiredCapabilities(); //foreach (string key in caps.AllKeys) //{ // capability.SetCapability(key, caps[key]); //} //foreach (string key in settings.AllKeys) //{ // capability.SetCapability(key, settings[key]); //} string username = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); if (username == null) { username = ConfigurationManager.AppSettings.Get("user"); } String accesskey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); if (accesskey == null) { accesskey = ConfigurationManager.AppSettings.Get("key"); } capability.SetCapability("browserstack.debug", "true"); capability.SetCapability("os", "windows"); capability.SetCapability("os_version", "10"); capability.SetCapability("browser", "chrome"); capability.SetCapability("browser_version", "62.0"); capability.SetCapability("browserstack.local", "false"); capability.SetCapability("browserstack.console", "errors"); capability.SetCapability("browserstack.user", "yogeshpawar7"); capability.SetCapability("browserstack.key", "jvhFGqXMWapAU5hKkxnm"); string className; className = TestContext.CurrentContext.Test.ClassName; className = className.Substring(className.LastIndexOf(".") + 1); string TestFullName = TestContext.CurrentContext.Test.FullName; string TestName = TestFullName.Substring(TestFullName.IndexOf(".", TestFullName.IndexOf(".") + 1) + 1); string TestDescription; try { TestDescription = TestContext.CurrentContext.Test.Properties.Get("Description").ToString(); TestDescription = "<br><font size='1'>" + TestDescription + "</font>"; } catch (System.Exception) { TestDescription = ""; } ExtentReportUtil.Test = ExtentReportUtil.extent.CreateTest(TestName + " " + TestDescription); if (TestDescription.Contains("API")) { } else { new Common().LaunchBrowser(GlobalVariables.Browser) .NavigateTo(GlobalVariables.URL); } testData = new XMLTestDataReader(); //testData.SetXMLName(className); GlobalVariables.testCaseID = TestContext.CurrentContext.Test.MethodName; String appId = Environment.GetEnvironmentVariable("BROWSERSTACK_APP_ID"); if (appId != null) { capability.SetCapability("app", appId); } string server = ConfigurationManager.AppSettings.Get("server"); //driver = new RemoteWebDriver(new Uri("http://" + server + "/wd/hub/"), capability); }