# Automated Test Pyramid Generation: From User Stories to Code-Level Testing

This document outlines RoostGPT's comprehensive testing framework that establishes complete traceability from business requirements to implementation-level tests through a guided, user-driven workflow. Our methodology transforms Jira user stories into a multi-layered test suite where users create, verify, and build upon each testing phase sequentially.

**The RoostGPT Framework Flow:**

Starting with business requirements captured in Jira stories, users work through RoostGPT to create a complete testing ecosystem. Each phase requires user verification before proceeding to the next level:

- **Functional Tests** - Generated directly from Jira business requirements, creating comprehensive test scenarios along with API specifications and Gherkin feature files that serve as foundational artifacts for subsequent phases
- **Unit Tests** - Users implement code using Test Driven Development principles based on functional requirements, then create unit tests from the resulting code
- **API Tests** - Users generate tests from the validated API specifications, verify their accuracy, then use these tested contracts as input for integration testing
- **Integration Tests** - Created using verified feature files and API specs as inputs, with user validation before proceeding to ensure end-to-end functionality coverage

#### RoostGPT Testing Framework: Process Flow  
  


**Let's demonstrate the first phase of the RoostGPT workflow: transforming a Jira business requirement into a comprehensive functional test plan.**

**For this example, we'll walk through:**

- Taking a Jira user story as input
- Creating structured functional test scenarios in RoostGPT
- Generating the foundational test plan that will serve as input for subsequent API and integration test phases

**To proceed with this demonstration, please provide:**

- A sample Jira ticket/user story you'd like to use

Lets consider this Jira Ticket  
  
[![Screenshot 2025-09-15 at 11.50.19 PM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/Ah9JFSYsQmO3NWku-screenshot-2025-09-15-at-11-50-19-pm.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/Ah9JFSYsQmO3NWku-screenshot-2025-09-15-at-11-50-19-pm.png)

We'll demonstrate using a Jira ticket containing a credit card lifecycle user story as our business requirement input.  
  
**Action:** Navigate to RoostGPT and initiate the functional test creation workflow.  
  
[![Screenshot 2025-09-15 at 11.52.29 PM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/vkuZdJcKNdqZVUBq-screenshot-2025-09-15-at-11-52-29-pm.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/vkuZdJcKNdqZVUBq-screenshot-2025-09-15-at-11-52-29-pm.png)

Select our Jira Ticket

[![Screenshot 2025-09-15 at 11.58.11 PM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/YaMoZt2nbipYFqe1-screenshot-2025-09-15-at-11-58-11-pm.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/kx22g4MShZpyqwy1-screenshot-2025-09-15-at-11-54-50-pm.png)

  
**Trigger Functional Test Creation:** Once the Jira ticket is selected, initiate RoostGPT's functional test generation process.

**Generated Results:** Upon completion, RoostGPT produces three foundational artifacts:

- **Functional Test Scenarios** - Comprehensive test cases derived from business requirements
- **Gherkin Feature File** - Behavior-driven development scenarios in gherkin feature format.
- **API Specification** - Technical contract definitions for service interactions

[![Screenshot 2025-09-16 at 12.01.01 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/QK3mREIkjwOdoanf-screenshot-2025-09-16-at-12-01-01-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/QK3mREIkjwOdoanf-screenshot-2025-09-16-at-12-01-01-am.png)

[![Screenshot 2025-09-16 at 12.02.40 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/eH4TjaTSEFu3MWqv-screenshot-2025-09-16-at-12-02-40-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/eH4TjaTSEFu3MWqv-screenshot-2025-09-16-at-12-02-40-am.png)

##### [![Screenshot 2025-09-16 at 12.01.45 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/957ZTrxmOlqA8Zt5-screenshot-2025-09-16-at-12-01-45-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/957ZTrxmOlqA8Zt5-screenshot-2025-09-16-at-12-01-45-am.png)  
  
**Test-Driven Development and Unit Test Generation**  


**Test-Driven Development Implementation:** Using the verified functional test cases as your guide, implement the required code functionality following Test-Driven Development principles. The functional test scenarios provide clear requirements for what your code needs to accomplish.

**Code Generation Foundation:** The API specification file serves as the single source of truth for generating initial source code structure using the OpenAPI Generator as a helping tool. The OpenAPI Generator serves as a productivity aid that accelerates development by creating standardized code scaffolding and reducing manual setup effort.

`openapi-generator generate -i functional_tests/ZBIO-5213.yaml  -g spring -o . --additional-properties=javaVersion=1.8`

  
  
[![Screenshot 2025-09-16 at 12.14.23 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/dLzv2DuihHALLUay-screenshot-2025-09-16-at-12-14-23-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/dLzv2DuihHALLUay-screenshot-2025-09-16-at-12-14-23-am.png)  
  
  
**VS Code Integration:** Once your code implementation is complete, generate comprehensive unit tests directly within your development environment. Simply right-click on your code file and select **"Generate Test using RoostGPT"** from the context menu.

[![Screenshot 2025-09-16 at 12.16.23 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/p55l8SZQJA7aCi19-screenshot-2025-09-16-at-12-16-23-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/p55l8SZQJA7aCi19-screenshot-2025-09-16-at-12-16-23-am.png)

**Framework Preferences:** Configure your testing setup by selecting your preferred dependency management tools and testing frameworks. RoostGPT will adapt the generated tests to match your technology stack and project requirements.

**Trigger Generation:** Initiate the unit test creation process.

  
And **Voila**!! Test Generation is in progress for user written code based on functional test.

[![Screenshot 2025-09-16 at 12.17.04 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/jRmnQhaEfEO3Eqhf-screenshot-2025-09-16-at-12-17-04-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/jRmnQhaEfEO3Eqhf-screenshot-2025-09-16-at-12-17-04-am.png)

  
**Code-Lens Integration:** Alternatively, you can generate targeted unit tests using RoostGPT's code-lens functionality. Interactive action items appear above your Package, Class, and Function declarations, allowing for granular test generation at any code level.

[![Screenshot 2025-09-16 at 12.20.29 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/xRjISW9DILsRFi5w-screenshot-2025-09-16-at-12-20-29-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/xRjISW9DILsRFi5w-screenshot-2025-09-16-at-12-20-29-am.png)

**Java Structure Preservation:** Generated unit tests are automatically organized in the test folder while maintaining the original Java package structure, ensuring seamless integration with your existing project architecture.

**Dependency Management:** RoostGPT automatically adds all required testing dependencies to your pom.xml file, eliminating manual configuration overhead.

  
[![Screenshot 2025-09-16 at 8.33.59 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/aiCCUBnFHwpjp59j-screenshot-2025-09-16-at-8-33-59-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/aiCCUBnFHwpjp59j-screenshot-2025-09-16-at-8-33-59-am.png)

**Automated Test Execution:** Upon generation, RoostGPT executes the unit tests and generates comprehensive execution reports along with detailed code coverage analysis.

**Coverage Analysis:** View detailed coverage metrics to understand how thoroughly your tests validate the implemented code.

**Intelligent Error Resolution:** If any generated tests fail to compile, RoostGPT automatically iterates over the problematic Java files, analyzing compilation errors and attempting to resolve them programmatically.

**Fallback Mechanism:** After reaching the maximum iteration limit without resolution, RoostGPT changes the file extension to "\*.java.invalid" to prevent project-wide compilation issues while preserving the problematic code for manual review.

  
[![Screenshot 2025-09-16 at 8.41.18 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/d2JuiebdKZxm1JFV-screenshot-2025-09-16-at-8-41-18-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/d2JuiebdKZxm1JFV-screenshot-2025-09-16-at-8-41-18-am.png)

**Improvement Sidebar:** Access the dedicated improvement panel where you can provide feedback on generated tests and request modifications based on specific requirements.

**Iterative Refinement:** Use the feedback mechanism to enhance test quality and coverage, ensuring the unit tests meet your exact testing standards and business requirements.

[![Screenshot 2025-09-16 at 8.43.24 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/J6t689kJLbV7WlON-screenshot-2025-09-16-at-8-43-24-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/J6t689kJLbV7WlON-screenshot-2025-09-16-at-8-43-24-am.png)

##### **[![Screenshot 2025-09-16 at 8.41.03 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/uJPwJEbfjKXUMXru-screenshot-2025-09-16-at-8-41-03-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/uJPwJEbfjKXUMXru-screenshot-2025-09-16-at-8-41-03-am.png)  
  
  
API Test Generation from Specification**

**Swagger Integration:** Navigate to your Swagger/OpenAPI specification file within VS Code. This specification was generated in Phase 1 as part of the functional test creation process.  
  
**RoostGPT Integration:** Right-click on your Swagger specification file and select **"Generate Test using RoostGPT"** from the context menu, then choose **"API tests using API Spec file"** to initiate API test creation.

[![Screenshot 2025-09-16 at 12.27.26 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/DKmE899egclNSr7z-screenshot-2025-09-16-at-12-27-26-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/DKmE899egclNSr7z-screenshot-2025-09-16-at-12-27-26-am.png)

  
  
**Output Framework Selection:** Choose your preferred API testing framework from the available options. RoostGPT will generate tests compatible with your selected framework and project structure.

[![Screenshot 2025-09-16 at 12.37.10 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/DthCaXF01EiPl6ge-screenshot-2025-09-16-at-12-37-10-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/DthCaXF01EiPl6ge-screenshot-2025-09-16-at-12-37-10-am.png)

**Live Server Integration:** Configure your testing environment by providing live server details if available for real-time API validation. This allows tests to run against your actual API endpoints for comprehensive verification.

**Mock Server Alternative:** If no live server is available, RoostGPT automatically provisions a Prism mock server to simulate API responses, ensuring your tests can be executed and validated immediately.

  
[![Screenshot 2025-09-16 at 12.30.09 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/YCSHuP9jca3PrNfz-screenshot-2025-09-16-at-12-30-09-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/YCSHuP9jca3PrNfz-screenshot-2025-09-16-at-12-30-09-am.png)  
  
  
  
**Karate Test Creation:** RoostGPT generates comprehensive Karate API tests organized in a dedicated project folder structure. Each test suite includes detailed documentation and execution instructions and also its data csv for different cases.

[![Screenshot 2025-09-16 at 12.32.16 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/LrL4PUH9C2iXdlzK-screenshot-2025-09-16-at-12-32-16-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/LrL4PUH9C2iXdlzK-screenshot-2025-09-16-at-12-32-16-am.png)

[![Screenshot 2025-09-16 at 12.38.52 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/xK3pv6hYCzXwocha-screenshot-2025-09-16-at-12-38-52-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/xK3pv6hYCzXwocha-screenshot-2025-09-16-at-12-38-52-am.png)

##### **Integration Test Generation Using API Spec and Feature Files**

**API Specification Context:** Right-click on the Swagger API specification file that was generated during the functional test creation phase. This serves as the foundation for your integration test structure.

**RoostGPT Integration Menu:** From the context menu, select **"Generate test using RoostGPT"** then choose **"Integration Test using API spec and gherkin feature"** to initiate the integration test generation workflow.

[![Screenshot 2025-09-16 at 12.40.59 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/pJcPzlSBW26k8KFF-screenshot-2025-09-16-at-12-40-59-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/pJcPzlSBW26k8KFF-screenshot-2025-09-16-at-12-40-59-am.png)

**Output Framework Selection:** Choose your preferred integration testing framework from the available options. RoostGPT will structure the generated tests according to your selected framework's conventions and best practices.  
  
**Gherkin Feature Location:** When prompted, navigate to and select the Gherkin feature file location. This feature file was generated alongside the functional tests in Phase 1 and contains the behavior-driven development scenarios.  
  
[![Screenshot 2025-09-16 at 12.42.06 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/ujOcuZoKD6SFiFM4-screenshot-2025-09-16-at-12-42-06-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/ujOcuZoKD6SFiFM4-screenshot-2025-09-16-at-12-42-06-am.png)  
  
**Scenario Processing:** RoostGPT triggers the integration test creation process by parsing the selected feature file and extracting individual test scenarios. Each scenario is analyzed for its specific testing requirements and data needs.  
  
[![Screenshot 2025-09-16 at 12.42.33 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/OUE8S6zJbn1lVoNI-screenshot-2025-09-16-at-12-42-33-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/OUE8S6zJbn1lVoNI-screenshot-2025-09-16-at-12-42-33-am.png)  
  
**Organized Test Output:** The generation process creates a comprehensive test suite with separate files for each scenario identified in the feature file. Additionally, corresponding CSV test data files are automatically generated to support data-driven testing for each scenario.

### [![Screenshot 2025-09-16 at 12.46.50 AM.png](https://docs.roost.ai/uploads/images/gallery/2025-09/scaled-1680-/ES1yOh6KBWOW7kQV-screenshot-2025-09-16-at-12-46-50-am.png)](https://docs.roost.ai/uploads/images/gallery/2025-09/ES1yOh6KBWOW7kQV-screenshot-2025-09-16-at-12-46-50-am.png)  
  
  
**Conclusion: Complete Testing Ecosystem Achievement**

#### **RoostGPT Workflow Summary**

Through this comprehensive four-phase workflow, RoostGPT transforms a single Jira business requirement into a complete, multi-layered testing ecosystem. Starting with user stories and ending with validated code implementation, every aspect of your application is thoroughly tested and traceable back to original business needs.

#### **Achieved Test Coverage:**

- ✅ **Functional Tests** - Business requirement validation and acceptance criteria verification
- ✅ **Unit Tests** - Component-level code validation following TDD principles
- ✅ **API Tests** - Service contract and endpoint functionality verification
- ✅ **Integration Tests** - End-to-end workflow and system interaction validation

#### **Key Workflow Benefits Realized:**

**Complete Requirements Traceability:** Every generated test directly maps back to your original Jira business requirements, ensuring no functionality gaps.

**Seamless Development Integration:** VS Code integration enables developers to generate tests contextually without leaving their development environment.

**Framework Flexibility:** Support for multiple testing frameworks ensures compatibility with your existing technology stack.

**Data-Driven Testing:** Automated CSV generation provides comprehensive test data coverage for thorough validation.

**Quality Assurance:** User verification at each phase ensures accuracy and alignment with business expectations.