Posts

Specflow -Part5(Specflow Sharing Data Between Steps)

While automating applications you may come across scenarios where you may need to share data between steps, we will talk about how one can do so in this lecture Let's say you are automating google search functionality and scenario is user types search string on the google search page and hits search and this takes him to the google result page where he asserts if the results match the search string. You can have a single step definition file for all these steps or you can have a separate one for each page. Ideally, you should have a separate step definition file for each page. We can share the data between steps using below ways Instance variables (Steps are in same file) Context Instance variables We will create a feature file for the above example and then we can talk over it Feature : SpecFlowFeature4 To demo how one can share data between steps Scenario : Verify user can share data bet...

Specflow -Part4(Specflow Scenario Outline and Feature Background )

In the previous lecture, we talked about how we can pass multiple data to step using tables, suppose we want to run the same scenario for a different set of data, For example, you want to test the login functionality of an application, where you test login with Administrator, Project Manager, Product Owner etc Here the steps of scenario will remain the same only the login credentials will change according to the user. We can have the same scenario run multiple times for each user you want to test with the help of scenario outline, check below Feature file Feature : SpecFlowFeature3 In order to test the login functionality for multiple users, we will demo using scneario outline Scenario Outline : Verify login for different set of users Given  User trys to login into application using  <Username>  and  ...

Specflow -Part3(Working with tables using Specflow.Assist.Dynamic)

In the previous lecture, we learned how can we work with tables to handle test data from the feature file.I will paste the feature and step definitions from earlier lecture and then we will talk about the shortcomings and how Specflow.Assist.Dynamic can help us to overcome them Feature File Feature : SpecFlowFeature2 In order to show specflow capabilities for working on tables We are going to write some scenarios here Scenario : Verify specflow can read data from table and print on console Given  I have dummy student data as below   |  StudentId  |  StudentName  |  Division     |  Age  | |  100        |  James        |  Engineering  |  30   | ...

Specflow -Part2(Working with tables)

We may need to work with scenario's where we need to pass a large set of data to test, for example, you are working on Student information management system where you need to create student and enter his/her details into the system. We can pass the data using tables. I have added one more feature file to an existing project which has a scenario which takes student details and then prints the details on console Feature : SpecFlowFeature2 In order to show specflow capabilities for working on tables We are going to write some scenarios here Scenario : Verify specflow can read data from table and print on console Given  I have dummy student data as below   |  StudentId  |  StudentName  |  Division     |  Age  | |  100    ...

Specflow -Part1(Installation and Introduction)

We have already talked about BDD in our course introduction, it is a specification used for software development Specflow is a testing framework that supports BDD and uses Gherkin language to define application behaviour You can refer to course introduction for more details on BDD, Specflow and Gherkin We will jump into using specflow Installation In visual studio, Go to Tools--> Extensions and updates Select online and in search type specflow Install Specflow for visual studio  We have added the specflow extension for visual studio, let's add the specflow package to our project Create a new solution and add test project called SpecflowTest Right-click the project and select 'Manage Nuget packages' Search for specflow.mstest and install In App.config file of the project, Verify if below tag is present inside specflow tag < unitTestProvider   name = " MsTest "  /> If not, then go ahead add same. Here we a...

Testing Framework

Image
Now, let's talk about MSTest, its a unit testing framework that allows us to create and run the tests We can use MSTest testing framework for writing our unit/integration/e2e(UI tests) Before we jump into details of MSTest, we will talk about different types of tests and the testing pyramid Types of tests Unit Testing smallest units of code Integration Units of code are integrated with each other and tested E2E Verify system meets requirements, testing the entire system from end to end Test Pyramid Above image is self-explanatory, so one should write as many unit tests as he can for testing application As you climb the pyramid, test execution time increases that is unit tests are faster than UI Also, the brittleness of test increases that is UI test is most brittle compared to the unit test. I have created a simple project to calculate tax based on the price of an item, we will walk through the code and then write some unit te...