240 likes | 494 Views
BETTER SpecFlow tests. Tim Brown SENIOR DEV AT MEDISOFT Codebuckets.com. What are SPECFLOW TESTS. Tests written in natural language. Implemented in C#. Transformed into Unit tests. Run as Unit Tests. We Want to Avoid this. TIP 1: ONLY RUN THE most important. Run on command line.
E N D
BETTER SpecFlow tests Tim Brown SENIOR DEV AT MEDISOFT Codebuckets.com
What are SPECFLOW TESTS Tests written in natural language
Run on command line Run with ALM tool of choice
TIP 2: STRESS TEST • 200 tests and each one fails 1% of the time - full pass 13% • Big set but 20 of these are flaky and fail 10% - at least one of these will fail 88% of the time. • FULLY PASSING TEST SUITE ONCE A FORTNIGHT
Scenario NUnit Test
TIP 3: Use FUZZY STRING MATCHING The C# step is
Using a fuzzy match library e.g. DuoVia.FuzzyStrings https://www.nuget.org/packages/DuoVia.FuzzyStrings/ Not going to fail for minor text changes
7 HABITS OF EFFECTIVE SPECFLOW WRITERS • TIP 1: Only run the most important tests • TIP 2: Stress test • TIP 3: Use fuzzy string matching • TIP 4: Improve logging • TIP 5: Write fewer specflow tests • TIP 6: Get them working in all languages • TIP 7: Get someone else to specify the tests
Online • CodeBuckets.com • http://codebuckets.com/2016/12/01/5-ways-to-write-more-robust-specflow-tests/