How to manage different test cases with Feature file in Specflow

2.3k views Asked by At

We have manual testers who just write off their test cases in MTM and tfs sprint wise. We have to take the tests from there and we automate the stories in Specflow(BDD form).

1) The manual testers do not write all the test cases in a single story. They usually create different stories for same feature. So during automation, how should our feature files be?.

2) Currently i can say we are just unit testing the methods but how will we be handling the high end scenarios for system testing. how to handle a full process say "When I add a product to cart" this actually means the customer is already in product description page and is adding a product to cart after selecting a quantity. We currently have built scenarios like "I am at product page" and "I select a quantity" and "I add a product to cart"

3) Also there is Smoke test cases to be run. So how can we select or identify test cases which would run with Smoke tests. How will be our Smoke feature file be like ?? How to reuse the other methods ? we will not be writing same test cases for smoke , we just want to reuse the other test methods for smoke as well.

I am completely new to this thing so in case i you are not clear with what i have written , please put it in comment and i will edit it.

Please help me in managing my test cases , feature files and scenarios.

1

There are 1 answers

1
charleslbryant On
  1. You could create a feature file and have your various stories as scenarios. If a story can be broken down into various tests, you could have a feature file per story. It depends on your context and the level of abstraction and detail you are trying to achieve with your tests. I usually try to have very focused feature files that concentrate on testing one concepts. If I end up with too many scenarios in one feature I look for groupings that can be moved to another feature file and duplication that can be combined into a generic scenarios, steps or data driven tests.

  2. "High end scenarios" would include the automation of the scenarios above in the UI. If you are wondering how to automate the scenarios it depends on your UI. If you have a web UI, Selenium Webdriver, as Quality Expert recommended, is a good choice. To keep your tests maintainable you should research Page Objects.

  3. Many test runners that SpecFlow supports provide a means of categorizing tests and allowing you to run tests by category. To use this functionality you can add tags to your features or scenarios to categorize your tests. You could add @Smoke to the features and scenarios that compromise your smoke tests. Then in your script to run the tests you would use the command line arguments for your test runner to run only tests marked with Smoke.

    Your smoke feature file will be similar to your other tests. If you reuse steps that you have already written in SpecFlow it will automatically bind and reuse the step's method. As long as your smoke tests is are written in a similar manner as your other test, you should be able to easily reuse your step methods.