In the past I have been using Visual Studio coded tests as well as recorded tests for test automation. When I installed VS2019 and looked at documentation of Coded UI tests, I found following announcement on the documentation page.
Coded UI Test for automated UI-driven functional testing is deprecated. Visual Studio 2019 is the last version where Coded UI Test will be available. We recommend using Selenium for testing web apps and Appium with WinAppDriver for testing desktop and UWP apps. Consider Xamarin.UITest for testing iOS and Android apps using the NUnit test framework.In the past, I have used Selenium for some other web page automation related tasks. It was time to start using for Selenium for our Asp.Net application's automated testing. Following is an example of how our single Login page test automation looks like.
[TestMethod] public void Login_Success() { var loginWait = new WebDriverWait(_webDriver, System.TimeSpan.FromSeconds(5)); _webDriver.Navigate().GoToUrl(_testOptions.IdamUrl); var userIdInputElement = loginWait.Until(w => w.FindElement(By.Id("userId"))); var passwordInputElement = _webDriver.FindElement(By.Id("password")); var loginButton = _webDriver.FindElement(By.TagName("button")); Assert.AreEqual(loginButton.Text, "Login"); userIdInputElement.SendKeys("mylogin@gmail.com"); passwordInputElement.SendKeys("myPassword"); loginButton.Click(); var logoutLink = loginWait.Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Log out"))); logoutLink.Click(); _webDriver.Quit(); }
Above test performs following actions and corresponding checks.
That completes a very simple Asp.Net page automation using Selenium.
How to write a simple automation test for Asp.Net application using Selenium
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use