Testing Overview
Software testing has historically forced developers into a difficult compromise. On one side, you have unit tests—fast and precise, but requiring you to manually mock every database call and external service. This often leads to testing your assumptions about the code rather than the code itself. On the other side, you have end-to-end (E2E) tests—realistic but slow, flaky, and expensive to maintain.
BitDive introduces a third paradigm: Trace-Based Testing.
Instead of writing test code from scratch or managing complex mock frameworks like Mockito, BitDive allows you to record real application behavior and transform it into deterministic, executable tests. This approach automatically bridges the gap between unit and integration testing, giving you the speed of unit tests with the reliability of real-world data.
Challenges with Mockito and Manual Mocking
maintaining complex Mockito setups can be time-consuming and error-prone. To test a single service method, you often need to mock repositories, database connections, external API clients, and utility classes.
Before you know it, your JUnit test setup is 50 lines of code just to verify one method. Worse, if the real database schema changes but your mock doesn't, your test stays green while production breaks.
Automated Regression Testing from Traces
BitDive provides an alternative approach based on deterministic replay. By capturing the actual execution flow of your Spring Boot or Java application—including method calls, parameters, and external dependency responses—it creates a precise recording of a successful operation.
When you run this as a test, BitDive effectively hits "replay." Your code executes exactly as it did during the recording. When it tries to query the database, BitDive intercepts the call and provides the recorded response. This means:
- No Mocks to Write: The data itself replaces manual Mockito definitions.
- Deterministic Execution: Flaky network calls are replaced with stable, recorded history.
- Method-Level Precision: It doesn't just check the final HTTP 200 OK; it verifies that every method in the stack behaved exactly as it did before.
Unit Test Automation Workflow
This capability changes how teams approach quality assurance.
For Developers, it means you can establish a comprehensive regression suite for a legacy feature in minutes before you start refactoring. You don't need to understand every legacy nuance; the test protects you.
For QA Engineers, it transforms manual testing into permanent assets. A complex manual test case that uncovered a bug can be captured and converted into an automated Spring Boot unit test with a single click, ensuring that specific bug never resurfaces.
The "Shared Reality" Effect
Eliminate "it works on my machine." Because the test is based on a recorded trace, a QA engineer can send a developer a Test ID that reproduces the exact state of the system at the time of failure. This creates a shared reality where developers can fix the bug in minutes rather than spending hours attempting to reproduce it.
"Log-less" Debugging
When a standard integration test fails, you often just see a generic 500 error. With BitDive, you don't hunt through logs. You see the exact method, SQL query, or external call that deviated from the baseline, giving you instant "white box" visibility into the failure.
Moving Forward
In this section, we will guide you through adopting this workflow. We'll start by explaining the mechanics of how we achieve determinism without magic, then move to a practical "zero-code" quick start, and finally cover how to integrate these tests into your CI/CD pipelines alongside your standard Maven builds.
- How Trace-Based Testing Works – Deep dive into the mechanics of determinism.
- Quick Start Guide – Create your first test in under 10 minutes.
- CI/CD Integration – Automate your testing strategy.