In Agile Testing, the commonly used Testing methods are from the traditional practices and are aligned to the principle – Test Early. The Test Cases are written before the code is written. The emphasis is on defect prevention, detection, and removal running the right test types at the right time and at right level.
In this chapter, you will get an understanding of the methods −
In the Test Driven Development (TDD) method, the code is developed based on the Testfirst approach directed by Automated Test Cases. A test case is written first to fail, code is developed based on that to ensure that the test passes. Method is repeated, refactoring is done through the development of code.
TDD can be understood with the help of the following steps −
Step 1 − Write a Test case to reflect the expected behavior of the functionality of the code that needs to be written.
Step 2 − Run the test. The test fails as the code is still not developed.
Step 3 − Develop code based on the test case.
Step 4 − Run the test again. This time, the test has to pass as the functionality is coded. Repeat Step (3) and Step (4) till the test passes.
Step 5 − Refactor the code.
Step 6 − Run the test again to ensure it passes.
Repeat Step 1 – Step 6 adding test cases to add functionality. The added tests and the earlier tests are run every time to ensure the code is running as expected. To make this process fast, tests are automated.
The tests can be at unit, integration or system level. Constant communication between testers and developers needs to be ensured.
In the Acceptance Test Driven Development (ATDD) method, the code is developed based on the test-first approach directed by Acceptance Test Cases. The focus is on the acceptance criteria and the Acceptance Test Cases written by the testers during User Story Creation in collaboration with the customer, end users and relevant stakeholders.
Step 1 − Write Acceptance Test Cases along with user stories in collaboration with the customer and users.
Step 2 − Define the associated acceptance criteria.
Step 3 − Develop code based on the acceptance tests and acceptance criteria.
Step 4 − Run the acceptance tests to ensure that the code is running as expected.
Step 5 − Automate the acceptance tests. Repeat Step 3 – Step 5 until all the user stories in the iteration are implemented.
Step 6 − Automate the regression tests.
Step 7 − Run the automated Regression Tests to ensure Continuous Regression.
Behavior Driven Development (BDD) is similar to the Test Driven Development (TDD), and the focus is on testing the code to ensure the expected behavior of the system.
In BDD, language like English is used so that it makes sense to the users, testers and developers. It ensures −