Behavior Driven Testing in Automated Testing
Behavior Driven Testing in Automated Testing
Learn about Behavior Driven Testing, why it was developed, and how to start implementing it for benefits like easier collaboration and feedback and increased ROI.
Join the DZone community and get the full member experience.Join For Free
Is the concept of adopting a continuous everything model a daunting task for your fast moving business? Read this whitepaper to break down and understand one of the key pillars of this model in Continuous Governance: The Guardrails for Continuous Everything.
1. What Is Behavior Driven Testing?
Behavior Driven Testing (BDT) is an uncommon term in software testing/development compared to Behavior Driven Development (BDD). Tests in behavior driven testing are most often focused on the behavior of users rather than the technical functions of the software. BDT is the best choice when you want to show your business point of view and the requirements of the product. To spread out the product ideas, BTD uses very easily understandable language to make sure everyone on the team does not miss anything, even they are non-technical people. Hence, people who are in charge of business analysis and product management can actively join the testing process. Behavior Driven Testing is gaining momentum as lots of organizations are looking at it as a solution to their automation and collaboration challenges. The BDT framework has been successfully implemented by various QA teams in various domains. Furthermore, it is the premise for implementing Data-driven testing much more successfully and easily.
2. Why Behavior Driven Testing Originated
Since test automation started, it has evolved tremendously with new concepts, framework designs, and tools. The low usability, rigidity, and high maintenance cost of manual testing has been the reason for the evolution of automation frameworks.
The evolution of test frameworks went from Core frameworks > Record and Playback> Data-driven > Keyword driven > Hybrid > Behavior driven testing.
One of the common downsides when using these frameworks is that it is hard for non-technical people like business analysts and management people to read and understand the test cases, but behavior driven testing can handle it. It has helped to fill the communication gap by writing the test cases in natural language. It is a relatively new agile software development approach that focuses on communication and encourages collaboration between developers, QA, and business participants to help bridge the business-IT alignment gap. The scenarios are written to build up a clear understanding of the desired behavior through discussion with stakeholders.
3. Advantages of Behavior Driven Testing
- Collaboration: It builds closer relationships among business Analysts, QA, and Dev through the Behavior Clarification Reviews. It’s also helpful for communicating requirements effectively. It is verified by BAs and testers to make sure of the acceptance criteria.
- Easy Review and Feedback: By writing the test cases in natural language which is human-readable, no development skills will be required. Business analysts can actively participate in the process of creating the automated test cases, review, and give their feedback to improve them.
- Right Focus: BDT helps to focus on the requirements and the business point of view rather than focusing too much on testing the technical implementation.
- Greater ROI: It has been observed that the behavior of the software stays for longer than the implementation. So, behavior driven tests are easier to modify and result in greater ROI. Also, the BDT tools are open-source, which further reduces the investment.
- No longer costly to maintain: With BDT, code redundancy can be minimized due to the "step reusability" feature. Hence, these tests are less costly to maintain.
4. How Is Behavior Driven Testing Implemented?
There is a plethora of open-source BDT frameworks available in many programming languages and supporting different platforms - for instance, Cucumber (preferably with Ruby), JBehave for Java, NBehave and specflow for .Net, Behat for PHP, and Twist for Groovy. The BDT layer is implemented on top of the customized framework, so it’s about building up layer upon layer only. The behavior driven tests are given: when-then style steps written in natural language. Of course, the implementation of these steps has to be done in the programming language of one’s choice. Below is the outline of the Behavior Driven Testing process:
- A business analyst writes a formal user story.
- A tester writes the scenarios based on the user story.
- The scenarios are reviewed by the business team.
- An automation engineer writes the step definitions for the scenario steps.
- The scenarios are automated by the QA team.
- The automated scenarios are run and any bugs are fixed.
- The automated tests are run as regression tests.
- The user accepts the software (Acceptance and Quality Criteria met).
Published at DZone with permission of Alex Jones . See the original article here.
Opinions expressed by DZone contributors are their own.