In software development, Test driven development (TDD) concept is an indispensable framework to Agile. It allows development team to devise test cases prior to implement features of application. Knowing that, many teams have embraced it in the process for almost three decades now. Today, we will present readers the some popular tools that can help us to apply TDD framework effectively in through out software development cycle.
Learn more about Test driven development, refer to this article: Unit Tests & Test-Driven Development
Postman
Postman is an API platform for building and using APIs. It allows developers to test, document, and share APIs (Application Programming Interfaces). Developers widely use it to simplify the process of testing APIs by providing a user-friendly interface for making requests, viewing responses, and debugging issues.
With TDD approach, we have yet any code to write tests, all we have is requirement, or perhaps better, an API contract. That is enough to devise test cases. Just open your workspace and create a request.

*Note: If you possess an OAS file (either in YAML or Json format), you can import it directly to Postman as a collection without creating every single request manually.
Aside from sending requests on the fly, we can write test script for them. To write your first post-response script, open a request in Postman, then select the Scripts → Post-response tab. Enter the following JavaScript code (sample GET request):
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});

The test we just wrote is considered as RED step and expected to fail when we run it. Therefore on the next step, based on the requirement, we will implement the API to make the test passed (GREEN). If the test continues to fail, then we proceed to refactor phase (BLUE).
This setup could also used for automated tests in combination with the Postman runner feature and Newman CLI.
Pros of Postman
- User friendly UI.
- Postman offers a gentle learning curve because its documentation is detailed and well-maintained.
- Fully focused on API testing only, which makes this application one of the best automation testing and manual testing tool.
- Could be integrated with many CI/CD tools with the help of Newman CLI. The test results can be converted into familiar format and upload to Agile Test – QA Test management for Jira.
Cons of Postman
- Postman is specified for API testing especially, it cannot be used for Unit testing and E2E testing.
Some well-known alternatives: Bruno, Apidog, Katalon platform, HTTPie.
JUnit
JUnit is an open-source unit testing framework that supports Java (5 and above) and is known for its efficacy in facilitating test-driven development (TDD). It provides a robust framework for writing and executing unit tests, allowing developers to verify the correctness of their code at a granular level.
One of the key benefits of using JUnit is its integration with build tools like Maven and Gradle, making it seamless to incorporate tests into the development workflow. By running JUnit tests regularly, developers can catch bugs early in the development cycle, reducing the cost and effort required to fix them later.
To start with JUnit, firstly you need to create a mvn project. Simply run this command to initialize it
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false
Your directory tree should look like this.
my-app
| -- pom.xml
`-- src
| -- main
| `-- java
| `-- com
| `-- mycompany
| `-- app
| `-- App.java
`-- test
`-- java
`-- com
`-- mycompany
`-- app
`-- AppTest.java
Make sure your POM.xml file has been set up correctly with JUnit5.
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
Now, let’s write our first test.
Create a package under src/test/java and create a test class to test the String swap functionality.
public class StringSwap {
@Test
public void stringSwap2charsOnly() {
StringSwapHelper help=new StringSwapHelper ();
Assert.assertEquals("BA", help.swaplasttwochars("AB"));
}
}
Here, we have created an instance of class StringSwapHelper which does not exist. Running this test will cause a compilation error and the test case will fail. (RED)
Let us go ahead and create the StringSwapHelper class inside a package under src/main/java. (Hover on the undefined class and click on create class) Below is the example of TDD and JUnit:

Similarly create swaplasttwochars() method inside StringSwapHelper class.
public class StringSwapHelper {
public String swaplasttwochars(String string) {
// TODO Auto-generated method stub
return null;
}
}
If we run the test case, it will still fail as the swaplasttwocharsclass() method is returning null.
Now we should add the business logic and what we expect the swaplasttwocharsclass() method to perform. We will add the logic to swap for only 2 characters first.
public class StringSwap {
@Test
public void stringSwap4chars () {
StringSwapHelper help=new StringSwapHelper();
Assert.assertEquals("ABDC", help.swaplasttwochars("ABCD"));
}
}
Now if we run this test, it will fail as we hardcoded the firstChar and secChar to fetch for index 0 and 1 respectively. Therefore, as per the current implementation “ABCD” will return “BACD” and not “ABDC”, swapping the first and second index and not the second-last and last index.
Below is the refactored code:
@Test
public void stringSwap() {
StringSwapHelper help=new StringSwapHelper();
Assert.assertEquals("SELENIMU", help.swaplasttwochars("SELENIUM"));
}
Let us now see how it works for only 1 character.
@Test
public void stringSwap1CharOnly() {
StringSwapHelper help=new StringSwapHelper();
Assert.assertEquals("A", help.swaplasttwochars("A"));
}
This will give StringIndexOutOfBoundsException as the current implementation is fetching second last and last index of the String and “A” will have only index 0.
Refactored code:
public String swaplasttwochars(String string) {
int length = string.length();
if(length<2) {
return string;
}
String strExceptLast2Chars = string.substring(0, length - 2);
char secondLastChar = string.charAt(length - 2);
char lastChar = string.charAt(length - 1);
return strExceptLast2Chars + lastChar + secondLastChar;
}
Above code should also work for empty string.
Pros of JUnit
- A framework designed for Unit testing.
- Supports parameterised tests
- Generated report format is widely supported by many test management tools, including Agile Test.
Cons of JUnit
- Playwright requires basic to advanced programming skills.
- It can be time-consuming to maintain test suites.
Some well-known alternatives: TestNG, NUnit, xUnit.
Playwright
Playwright is an open-source automation framework used to test web applications. It allows you to automate browser interactions and provides a robust, reliable, and fast way to test modern web applications across different browsers, including Chromium (Chrome, Edge), Firefox, and WebKit (Safari).
Regarding development process, any web applications require front-end and back-end implementation. At the early stage, teams simply write the requirements on tickets or sketch them out in Figma designs. Most of them are just at concept level, no coding. However, those are already enough for devising E2E tests ahead of implementation.
*Note: For E2E tests, it is recommended not to create a long test case ahead of implementation. We should start with small tests first. Don’t forget to use fixture whenever necessary because it will reduce the amount of time of repeating your test script all over the places.
Even though Playwright’s learning curve is quite steep, but the dev team has really put their mind and soul in their documentation. To start a new Playwright project you can simply run this command.
npm init playwright@latest
After installation complete, create a sample test file and name it login.test.ts. By now, your local directory should be as follows.
my-test-demo
| -- playwright.config.ts
| -- package.json
| -- package-lock.json
| -- tests/
| -- example.spec.ts
`-- login.test.ts
`-- tests-examples/
`-- demo-todo-app.spec.ts
Hypothetically, we have the requirement stating something like this.

By this we know at least there are 3 elements, namely, username field, password field, and a login button. Here is a draft for you.

In reality, the team has not implemented this screen yet, let alone its background logic. However, we still can deduce necessary details and start to write our own test script.
These fields should contain data-testid attribute. Let’s say
Element | data-testid | xpath |
---|---|---|
Username field | username | //input[@data-testid=’username’] |
Password field | password | //input[@data-testid=’password’] |
Login button | login-button | //button[@data-testid=’login-button’] |
We have below test script.
// login.test.ts
import test from "@playwright/test";
test("Login", async ({ page }) => {
const usernameLoc = page.locator("");
const passwordLoc = page.locator("");
const loginBtnLoc = page.locator("");
await usernameLoc.fill("Mike");
await passwordLoc.fill("123456789@gileTest");
await loginBtnLoc.click();
});
As you run test, it will certainly bound to fail (RED). Afterwards, the developer will implement the screen and its logic. Once complete, he can try rerun again and make sure the test passed (GREEN). And finally, refactoring comes into place (BLUE).
As you run test, Playwright reporter will generate test result in HTML format by default. You can always reconfigure reporter in playwright.config.ts to generate a familiar format .e.g JUnit test report. This enables the ability to import test result to Agile Test in both cases, while running test on your local computer or in CI/CD process. The below picture is Playwright Test result in HTML format.

Furthermore, Playwright offers running test in UI mode and recording traces (compressed in a zip file). This helps both testers and developers analyze issues more effectively.
Pros of Playwright
- Well documented.
- Many useful features.
- One of most optimal framework so far.
- You can conduct both E2E and API testing using Playwright.
Cons of Playwright
- Playwright requires basic to advanced programming skills.
- It can be time-consuming to maintain test suites.
Some well-known alternatives: Selenium, Cypress, Jess, Moca.
Test-Driven Development (TDD) tools like Postman, JUnit, and Playwright are essential in Agile environments. These tools help development teams write tests early, automate testing, and continuously check code quality. By supporting Agile principles like quick feedback, fast iteration, and flexibility, these tools become key to successful test automation. They help developers ensure their software works as expected and meets quality standards. Additionally, this approach helps prevent technical debt from building up during the development process.
Conclusion
In conclusion, Test-Driven Development (TDD) remains a cornerstone of modern software development, driving better code quality, faster debugging, and a more structured workflow. Tools like Postman, JUnit, and Playwright each serve distinct purposes across various testing levels—from unit tests to API and E2E testing. Choosing the right tool depends on your project’s specific requirements and testing goals, but integrating TDD into your development process ensures a robust, reliable, and efficient approach to delivering high-quality software.
