- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Automated Software Testing with SpecFlow in Selenium
We can have automated software testing with SpecFlow by configuring Selenium in C#. We will use the Visual Studio editor, to develop the Selenium tests using the NUnit framework. Click on Create a new project from the Visual Studio welcome page.
Enter NUnit in the search edit box within the Create a new project window. Then choose the option NUnit Test Project(.NET Core) from the result dropdown. Click on Next to proceed.
Populate the Project name, Location and click on Create.
Once the project is successfully configured, the Setup and Test methods are provided automatically along with the import statement - using NUnit.Framework.
Then click on the Tools menu and choose the option NuGet Package Manager. Next, click on Package Manager Console.
Execute the following commands in the Package Manager Console, for Selenium installation −
Install-Package Selenium.WebDriver Install-Package Selenium.Firefox.WebDriver Install-Package Selenium.Chrome.WebDriver
Execute the following commands for NUnit installation in the Package Console −
Install-Package NUnit Install-Package NUnit3TestAdapter
To verify that all the required packages have been installed successfully, run the command −
Get-Package
Example
Implementation with Selenium WebDriver in C#
using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; namespace NUnitTestProject1{ public class Tests{ String url = "https://www.tutorialspoint.com/index.htm"; IWebDriver driver; [SetUp] public void Setup(){ //creating object of FirefoxDriver driver = new FirefoxDriver("<path of geckodriver.exe>"); } [Test] public void Test1(){ //URL launch driver.Navigate().GoToUrl(url); Console.WriteLine("Url launched"); } [TearDown] public void close_Browser(){ driver.Close(); } } }
Output
- Related Articles
- Automated software testing with Python
- How to do DataDriven testing in specflow api using Selenium?
- How to perform Automated Unit Testing with JavaScript?
- Stability Testing in Software Testing
- Testing Documentation in Software Testing
- Levels of Testing in Software Testing
- Difference Between Manual and Automated Testing
- What is Concurrency Testing in Software Testing?
- What is Domain Testing in Software Testing?
- What is Thread Testing in Software Testing?
- What is Interoperability Testing in Software Testing?
- What is Workflow Testing in Software Testing?
- What is Stress Testing in Software Testing?
- What is Volume Testing in Software Testing?
- Browser Plugin Testing With Selenium.
