DEV Community

Cover image for My First Contribution to Zerocode: Building a Configurable Delay Executor,I Fixed the Code, But Who's Going to Fix My Sleep Schedule? 💀
Shitanshu Jha
Shitanshu Jha

Posted on

My First Contribution to Zerocode: Building a Configurable Delay Executor,I Fixed the Code, But Who's Going to Fix My Sleep Schedule? 💀

Writing

My First Contribution to Zerocode: Building a Configurable Delay Executor
Introduction
My open-source journey with Zerocode became a practical learning experience when I started working on Issue #810 — Configurable Delay Executor.

Instead of simply writing a delay using Thread.sleep(), the challenge was to understand how Zerocode handles API execution internally and integrate a dedicated delay executor into its existing architecture.

I spent approximately 6–7 hours understanding the codebase, implementing the feature, debugging integration points, writing tests, and verifying the final implementation.
The Problem
The requirement was to introduce a configurable delay mechanism that could be used directly inside Zerocode test scenarios.

A test scenario should be able to request a delay in milliseconds without requiring an external API.

For example:
{
"name": "wait_for_100_ms",
"url": "util://DelayExecutor",
"operation": "DELAY",
"request": 100,
"assertions": {
"status": "Success",
"delayMillis": 100
}
}
The challenge was not just waiting for a specified duration. The delay operation needed to work with Zerocode's existing execution flow, dependency injection, API routing, and scenario runner.
What I Implemented

  1. Dedicated Delay Executor I created a DelayExecutor interface and its implementation, DelayExecutorImpl.

The executor accepts a delay value in milliseconds, validates it, executes the delay, and returns a structured JSON response.

  1. API Routing Integration I introduced a dedicated DELAY_CALL API type and configured the URL:

util://DelayExecutor

This ensures that delay requests are recognized as delay operations instead of being incorrectly routed through the generic Java API execution path.

  1. Dependency Injection with Guice I integrated the new executor into Zerocode's Guice dependency injection configuration.

This allowed the scenario execution layer to access the delay executor through the framework's existing dependency injection mechanism.

  1. Scenario Runner Integration I updated ZeroCodeMultiStepsScenarioRunnerImpl to recognize DELAY_CALL and delegate execution to the API executor.

This made the new functionality available directly inside test scenarios.

  1. Validation and Interruption Handling I implemented handling for:
  2. Null and empty delay values.
  3. Invalid numeric values.
  4. Negative delay values.
  5. Thread interruption during execution. When interrupted, the implementation restores the thread's interrupt status before reporting the failure.
  6. Testing and Documentation I added unit tests, API routing tests, and an integration scenario.

I also updated the README with usage instructions and an example of the new executor.
Testing Results
The targeted Maven test execution completed successfully:

  • 19 tests executed.
  • 0 failures.
  • 0 errors.
  • 1 skipped.
  • Build: SUCCESS. The tests covered delay execution, zero delay, invalid inputs, negative values, interruption handling, API routing, and scenario-level integration. What I Learned This contribution helped me understand several important concepts in real-world Java development:
  • Understanding an existing codebase: How to trace execution across interfaces, implementations, API routing, and scenario runners.
  • Dependency Injection: How Guice connects components without tightly coupling their implementations.
  • Framework Architecture: Why adding a feature requires integration across multiple layers rather than writing an isolated method.
  • Exception Handling: How to handle invalid inputs and thread interruption correctly.
  • Unit and Integration Testing: Why testing individual methods is not enough when a feature must work across an entire execution pipeline.
  • Open-Source Workflow: How to investigate an issue, work on a fork and feature branch, create commits, push changes, and submit a pull request. Contribution Status I submitted my implementation through:

Pull Request #814 — [Issue #810] Add configurable delay executor

Repository: https://github.com/authorjapps/zerocode

Pull Request: https://github.com/authorjapps/zerocode/pull/814

The pull request is currently open and awaiting review.
Final Thoughts
This contribution was a reminder that real software development involves much more than writing code.

Understanding an unfamiliar codebase, identifying the correct integration points, handling edge cases, writing meaningful tests, and verifying the implementation are all part of the engineering process.

My goal with open source is to keep learning how production-level projects are structured while contributing useful, tested improvements to the developer community.

Top comments (0)