Choosing a test framework and assertion lib ⚙️
|xUnit style||JUnit, TestNG||pytest, unittest|
Think ! 🤔️ Who would be the primary author of these tests?
- Developers, Automation engineers (Choose xUnit)?
- Product managers (PM), Manual testers (BDD can be an option)?
xUnit style 🤖
- Fast and flexible
- Setup/tear downs at different levels (Suite, Class, Test)
- Easy to data drive/parallelize tests
- Can be less readable (if not well designed)
Tip: 💡 Write tests using arrange-act-assert pattern.
If you think Cucumber is a testing tool, please read on, because you are wrong. - Aslak Hellesøy Reference: The worlds most misunderstood collaboration tool
- Readable (Gherkin syntax with
- Provides a layer to allow non-coders (PM/Manual test engineers) to also contribute
- More readable test results report
- Maintaining a BDD layer (feature files, step definitions) can be an overhead
- Less flexible
- (Trap 👺) Feature files can be imperative instead of declarative
Given I open a browser And I navigate to http://example.com/login When I type in the username field bob97 And I type in the password field F1d0 And I click on Submit button Then I should see the message Welcome Back Bob
Given I am on the Login Page When I sign in with correct credentials Then I should see a welcome message
Choosing an fluent assertion library 🕵🏻♂️
Let's not reinvent the wheel ☸️ shall we? 😄
|Google Truth ⭐️||assertpy 🌟|
Other choices: Hamcrest, Native JUnit or TestNG