2020-06-03T11:41:00Z

BDD Testing: Pros and Cons

There seem to be 2 different approaches in Test Management - BDD and TDD. What are the differences between these approaches, and what are the relative pros and cons of each?

Thanks!

Rony_Sklar - PeerSpot reviewer
Community Manager at a tech services company with 51-200 employees
  • 4
  • 1345
4
PeerSpot user
4 Answers
WT
Student at Systems Limited
User
2020-06-04T11:48:24Z
Jun 4, 2020

In TDD (Test Driven Development), the test is written to check the implementation of functionality, but as the code evolves, tests can give false results. BDD (Behavior Driven Development) is also a test-first approach, but differs by testing the actual behavior of the system from the end users perspective

You can consider as a example
TDD do not have specific file to write the test Case in Grammar language which describe the Behavior of application as a End User

BDD have the feature file where you can write simple language test case which simply describe that what is the scenario and what steps are going to execute

Example:
Scenario: Validate the Login Module
Test-1
User open the Application
Enter the credentials and Click on Login
He should be redirected to Dashboard

All the code will be bind with these steps and report will have only above lines with the status

Search for a product comparison in Test Management Tools
JD
Principal QA Engineer at Capco
Real User
2020-06-03T18:21:41Z
Jun 3, 2020

BDD is not about testing. It is about to have common sense about the application behavior and use this to develop a piece of software. As I mentioned, "to develop" software. Testing comes before and after it, not in it. Testers are part of the definition, he/she collaborates with the Developer and the Product Owner by defining the scenarios or examples that will be used by the developers during the coding. A big part of the companies misunderstood it and I believe I know why. Test Automation is something that works perfectly when developers and testers work together creating and maintaining the test scripts, but since the first time I heard about test automation, the tester was put as the exclusive owner. Also, the first time I heard about Cucumber, it happened again, testers being the owner of it. But, look, testers are not developing software in the companies that adopted Cucumber. So, where are the second "D" in the mnemonic "BDD"? If testers are not developing software, it is anything different than Behavior Driven Development. Summary of all, BDD is a development method used by "coders" (it includes the tester if he/she are programming the software the client will use in the future) where they look at the same behavior that he/she defined together with the tester and the Product Owner, and start to code focusing in to develop a software that is obeying that scenarios. It is not about testing.

Let's see an example:

Moment 1*: tester, developer, and PO meet and discuss a brand new feature
Moment 2*: they define some examples to describe better how this feature will be used by the user
Moment 3: they decide to write the examples in Gherkin, cause it is a common way to describe things
Moment 4: Three scenarios are written, it is not related to API or UI, it is written in a descriptive way instead of an imperative way (it is not an IEEE-829-1998 test case)
Moment 5A*: The API developer use the Gherkin feature files to create snippets to defined previously the way the API will be used after it became done
Moment 5B*: The UI developer does the same
Moment 6: Once the three scenarios were achieved, they are done with the task
Moment 7: the tester will take the software that already obeys the scenarios defined collectively in the Moment 3 and start to run the tests planned based on the features described in the Moment 1 and 2;
Moment 8: Tests passed, feature done.

(*) The tester is using the information get here to help to define him/her test strategy or even helping the team to understand better how to produce a better software

Pros:

- Favor the collective understanding of the software;
- Brings the developer to think in the user;
- Backend, Frontend, and Testing guys know exactly what will be delivered.
- Produces a lot of documentation

Cons:

- It takes time to do it right
- Produces a lot of documentation
- It is difficult to find documentation about the right way to do it

TDD is also aiming to focus the software creation on something different than tables, classes, interfaces, and repositories. The developer thinks about the feature to be created, then he/she defines what are the tests that will prove the piece of code that will be developed works as expected. These tests are written and run, it breaks in the first moment. The developer produces software code to achieve the test passing. After that he/she refactor the code to improve it since now they are confident that the test will validate that the code is working under that combination and state. Again, who produces the tests in the TDD approach are the coder (tester or developer who is going to implement a feature).

Let's see an example:

Moment 1:* The developer already know what should be developed and what kind of tests can prove it is working properly;
Moment 2*: He/she write eight test methods (in the project they are using to produce the software) exercising the conditions they believe that proves the software are working properly;
Moment 3: Now, the developer starts to code the software in order to make the eight tests pass;
Moment 4: It is good, let's mark it as done.
Moment 5: The tester will take the version to test with my 8 million test design techniques or my abilities to explore the software

(*) The tester can be consulted by the developer to teach some testing techniques that help the developer to assure what he/she is going to produce are working.

Pros:

- Favor the software architecture
- Brings coders to the point where they need to think about testing in the very first moment
- Better code

Cons:

- Does not works if you have a coupled legacy code
- A low number of developers doing this

NM
Quality Assurance Team Lead at Parkview Health
Real User
2020-06-03T19:51:53Z
Jun 3, 2020

Test-Driven Development (TDD) is an "inside out" focused process. To understand the process, one needs to know that the writer of the test cases is written at the same time as the code or Build. So it is the developer that writes the tests. To answer, "Who reads the tests?" It is the Developers and the Testers. It's unlikely that anyone else will read them. Then it is essential to provide specificity. When testing a new department with a unique workflow, and the test fails - a defect is created, and the failure analyzed. It is known that the build of the area is where the fault is located. The Developer or Builder does a Unit Test on the component/module, which is in isolation—making a mockup may be required, but is (potentially slow) and has external dependencies. As a result, Unit Tests are super-quick to run. The higher the level of code or build coverage, the better the developer, Quality Assurance, and Project Manager will sleep at night. But 100% code coverage is rare/difficult to achieve where Unit Test is concerned, which leaves gaps in risk management that need to be discovered and tested. Also, any change to the functionality of the system will require a modification to one or more Unit Tests. (Remember: the tests change first!) Unit Tests are highly specific to the code that they cover; they are intertwined with interfaces and other models. Unit Tests are not transferable and will require version control.

Behavior Driven Development (BDD) is an "Outside-in" focused process. To maintain comparison consistency, we need to answer, "Who writes the tests?" The plain English format means that the tests can be written by the person that understands the customer the best: the Product Owner or Operations owner. Then to answer, "Who reads the tests?" Almost anyone: Developers, Testers, Stakeholders, Business Owner, Product Owner. The specificity is based on the coding of the module build. When there is a defect, we know something is wrong, but we have to investigate to find out what is wrong. Behavioral Tests are tests of the system as a whole. At Parkview Health, we consider this integration testing. The system must be "put into a known state," which is all builds for each module that has to be in the testing environment before every test cycle. Not particularly difficult to do, but not quick either. When defects show up, they have to be fixed in the build, but the test case stays the same. Code or build coverage percentages for Behavioral Tests tend to be high. 100% code coverage is not uncommon. Not all functional changes impact the external behavior; the high-level nature of Behavioral Tests means that they change infrequently. Behavioral Tests are not coupled to code. Without changing a single test, the Test Coordinator can:

• Rewrite the module or application in a different programming language;
• Refactor or influence the massive application into a set of Test cases by the workflow.
• Fix a defect and start a new cycle

In summary, the first step of the project is to discuss the behavior of the software or feature to be built. BDD is a methodology for developing software through continuous example-based communication between developers and business. This communication happens in a form that both the business and developers can clearly understand. The business owners talk in requirements to the developers, and developers talk in examples. The value of BDD is as follows:

• A better understanding of the business operations
• Better ideas
• Developers can improve the systems
• Developers can help the business reach their requirements

TDD focuses on the developer's opinion on how parts of the software should work, and BDD focuses on the user's view on how they want the application to behave. When using BDD, it is all about functional testing and specifying the behavior. The story BDD helps ensure that the development team understands the business on the same level that the client does, adding value to the released software or build of the software.


DC
Chief Innovation Officer at SAGGA
Real User
Leaderboard
2020-06-22T20:44:39Z
Jun 22, 2020

Behavior-driven development (BDD) is an Agile software development methodology in which an application is documented and designed around the behavior a user expects to experience when interacting with it. By encouraging developers to focus only on the requested behaviors of an app or program, 


PROS: BDD helps to avoid bloat, excessive code, unnecessary features or lack of focus. This methodology combines, augments and refines the practices used in test-driven development (TDD) and acceptance testing.

Learn what your peers think about TFS. Get advice and tips from experienced pros sharing their opinions. Updated: August 2023.
734,024 professionals have used our research since 2012.
Related Questions
Raminder Rathore - PeerSpot reviewer
DevOps Practitioner at HCL Technologies
Jul 5, 2023
Hello peers,  I am a DevOps practitioner at a large tech company. I am currently researching Test Management tools. What are the commonly leveraged practices or tools for managing regression or performance test cases/scripts?  There are tools available like IBM Rational TestManager, Azure Test Plans, and many more. What are the commonly used ones? Thank you for your help.
See 2 answers
Kevin Copple - PeerSpot reviewer
Sr. Quality Assurance Project Manager at iLAB LLC.
Feb 21, 2023
My recommendations would be different based on if you are using Automation and what tool sets you are using for automation.  -If you are not using Automation, I would recommend Azure with Test Manager Suite or I would recommend Jira with Xray. They are reasonably priced options and give you the flexibility to create, execute, and manage your tests.  -If you are using Automation and want to provide more info on what tools you are using to automate, I will be happy to provide more info.
RL
Business Consultant at MFGS, Inc.
Jul 5, 2023
Many IT shops globally use OpenText - ALM Octane solution, (formerly owned by Micro Focus). Octane is a feature-rich enterprise-level ALM (test management) solution, that supports both waterfall and Agile methodologies. Octane has many integrations with other solutions commonly used in the SDLC. Reach out to your local OpenText organization, for more details, a demo, and a free trial. Best regards, Robert  
JS
Development Specialist at a healthcare company with 1,001-5,000 employees
Jun 3, 2021
I'm working for a company with 1000+ employees and I'm exploring two products: Panaya and Tricentis.  How good is Panaya Test Dynamix in comparison with Tricentis?  Thank you!
2 out of 4 answers
IP
Key Account Manager at a manufacturing company with 10,001+ employees
May 11, 2021
Panaya and Tricentis are both good. Could you share more info on your use case and what are your key selection criteria ?
EB
Director of Community at PeerSpot (formerly IT Central Station)
May 22, 2021
@Jesús Antonio Santos Giraldo ​, can you please share more details about your case as suggested by @John ​so that our peers can assist you with your queston?
Related Categories
Download Free Report
Download our free TFS Report and get advice and tips from experienced pros sharing their opinions. Updated: August 2023.
DOWNLOAD NOW
734,024 professionals have used our research since 2012.