TDD and BDD: What’s the Difference?
Test-driven development, or TDD, involves setting up automation testing before writing the code. In other words, the first step involves writing a test to check the correct operation of code that has not yet been written. Naturally, the test fails. The programmer then writes code which performs the actions required to pass the test. Once the test has been successfully passed, the code can be developed further.
Behavior-driven development, or BDD, is a variation on or extension of TDD. However, the approaches are designed for different purposes, so different tools are used to implement them. BDD first and foremost helps to improve cooperation between stakeholders, i.e. to develop a shared understanding of the software’s behavior. It is this which determines the main purpose of the approach.
BDD has proven itself for use in integration testing (i.e. for checking that individual modules can work together) and end-to-end testing (as in our case).
From the Python BDD frameworks, it was decided to use the BDD approach for writing automated tests. The Behave library was chosen for this. Behave is a framework for Python-style behavior-driven programming. Behave uses tests written in a “natural style”.
Automation Testing Prior to the Introduction of BDD
Before the advent of the API, it was possible to use an infrared switch on a receiver (in place of the remote control used for manual testing), but test stability was not satisfactory, since commands were not always received correctly by the receiver. Switches like these were mainly used for load testing.
Later, infrared switches on receivers were replaced by APIs, which are regularly upgraded and improved. This promised to improve test stability, and we began to introduce automation. Python 3 was chosen as the language and flows were used as test data.
For example, let’s look at the test that checks messages are correctly displayed on the client’s receiver. We start the flow and wait 60 seconds (it is sent after 60 seconds). Automated tests were written in Python code:
goodf blog is this
ReplyDeletethanks you liked it rahul.
ReplyDelete