Open In App

What is Code Driven Testing in Software Testing?

Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite – TDD (Test Driven Testing)

Code Driven Testing is a software development approach in which it uses testing frameworks that allows the execution of unit tests to determine whether various sections of the code are acting accordingly as expected under various conditions. That is, in Code Driven Testing test cases are developed to specify and validate the code functionality. It avoids duplication of code and this code-driven testing is performed by the development teams.

CDD (Code Driven Testing) is a growing trend in software development that uses frameworks like JUnit and NUnit to allow the execution of unit tests to determine the behavior of various sections of the code under various circumstances.

Code Driven test automation is an important feature of Agile software development and it is mainly promoted in Agile software development as TDD (Test Driven Development) method. In TDD the Unit tests are developed before the code writing process. Once tests are passed then the code is considered complete or good. Due to good Code Coverage, it is more reliable as it runs constantly during development rather than once at the end of a waterfall development cycle.

This Code Driven Testing Workflow can be easily understood by the following figure:

Step 1: Add the test, which is enough to fail, any code.

Step 2: Execute a complete test suite to confirm that the new test fails.

Step 3: The code is updated to produce it to pass the new tests from the suit.

Step 4: Again execute the test cases. If fails, update the code, and if these will pass.  Then repeat the same method once again for the other development element.

Benefits of Code Driven Testing:

  • It is a good working method to test the software’s public interfaces.
  • It provides high code coverage and makes the product more reliable.
  • It allows the execution of unit tests to determine the behavior of various sections under various circumstances.
  • It is the best approach to find bugs earlier in the software component/module.

Last Updated : 08 Feb, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads