UI processes can be slow, contain bugs, and decelerate your work.
[highlight dark=”no”]If a DB is constantly changed, it should be maintained.[/highlight]
Test configuration, bug fixing, and adjusting to software updates can become serious issues.
This article gives a useful overview of ways to execute UI automation with SpecFlow and C#.
Preliminary configuration of SpecFlow and Visual Studio
When you create a project, you should install a few NuGet packages manually.
This can be done by selecting Tools > NuGet Package Manager > Manager NuGet Package Manager for Solution.
A typical build should contain the following packages:
- Selenium. Support
- Specflow
- Specflow.Tools.MsBuild.Generation
- Xunit
- Xunit.core
- Xunit.runner.visualstudio
After this, you should launch the application by using automated processes.
You can launch code with the help of Chrome that goes to a required page and maximizes a screen to make a user see everything happening in the browser’s window so that tests can start on a proper web browser’s size.
The next stage is basic work with test scripts.
SpecFlow uses scripts instead of tests.
These test scripts are based on the Gherkin syntax where any test step starts with “if” or “else”.
Before taking the next steps, you need to learn how so-called locators work.
They are used to find certain elements that are shown on a web page.
Users won’t be able to interact properly with selected elements on pages without them.
The next groups can become the most popular locators used during your work:
public IWebElement ContactSection => Driver.FindElement(By.XPath(“.//div[@class=’row contact’]//div[@class=’col-sm-5′]”));
public IWebElement FormSection => ContactSection.FindElement(By.XPath(“//form”));
public IWebElement NameTextBox => FormSection.FindElement(By.Id(“name”));
public IWebElement EmailTextBox => FormSection.FindElement(By.Id(“email”));
public IWebElement PhoneTextBox => FormSection.FindElement(By.Id(“phone”));
public IWebElement SubjectTextBox => FormSection.FindElement(By.Id(“subject”));
public IWebElement MessageTextBox => FormSection.FindElement(By.Id(“description”));
public IWebElement SubmitButton => FormSection.FindElement(By.Id(“submitContact”));
Conclusion
These are only a few examples of the main steps that can be used for test automation.
[highlight dark=”no”]But still, you should start with small actions before developing more complex steps.[/highlight]
You should operate some working tests and then increase work complexity until tests contain all required steps and tests.
0 Comments