filmov
tv
Selenium C# | How to run scenarios based on tags | from cmd prompt and visual studio | BDD framework
Показать описание
In this video, we are going to discuss about another important feature in Specflow, tagging.
In Specflow feature file we can assigned tags to features and scenarios.
We can tag our scenario or features as smoke, regression or sanity , and then execute these tests based on the requirement.
As you know that, each time we dont want to run our whole suite of testcases. Sometimes we have to just run smoke test, to test the stability of the product build.
In those cases these tags are really helpful to filter our tests based on these tags.
To run scenarios based on tags, type below command in cmd prompt.
dotnet test --filter TestCategory = Smoke
You can also provide multiple tags, if you want to run scenarios which are marked either with smoke or sanity, then you can use the below command.
and to do that... add the test category string in double quotes...
dotnet test --filter "TestCategory = Smoke|TestCategory=Sanity"
Now, if you want to run the test which contains multiple tags. Lets say only those scenario should get executed which contains smoke and regression both.
Then you can use below command
dotnet test --filter "TestCategory = Smoke&TestCategory=Regression"
And, if you don't want to run the scenario which are marked with sanity and rest all should run. Then you can use below command
dotnet test --filter TestCategory!= Sanity
So this is how we can do the tags based execution in our framework.
***********Please comment in case of any query.***************
Also, please see other videos as well.
In Specflow feature file we can assigned tags to features and scenarios.
We can tag our scenario or features as smoke, regression or sanity , and then execute these tests based on the requirement.
As you know that, each time we dont want to run our whole suite of testcases. Sometimes we have to just run smoke test, to test the stability of the product build.
In those cases these tags are really helpful to filter our tests based on these tags.
To run scenarios based on tags, type below command in cmd prompt.
dotnet test --filter TestCategory = Smoke
You can also provide multiple tags, if you want to run scenarios which are marked either with smoke or sanity, then you can use the below command.
and to do that... add the test category string in double quotes...
dotnet test --filter "TestCategory = Smoke|TestCategory=Sanity"
Now, if you want to run the test which contains multiple tags. Lets say only those scenario should get executed which contains smoke and regression both.
Then you can use below command
dotnet test --filter "TestCategory = Smoke&TestCategory=Regression"
And, if you don't want to run the scenario which are marked with sanity and rest all should run. Then you can use below command
dotnet test --filter TestCategory!= Sanity
So this is how we can do the tags based execution in our framework.
***********Please comment in case of any query.***************
Also, please see other videos as well.
Комментарии