Skip to content

anildoddamreddy/oss-test-case-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OSS AI Test Generator

AI-powered Test Case & Cucumber Feature File Generator for the OSS/Telecom domain.

Built with Python + Streamlit + Claude API (claude-sonnet-4-20250514).


Overview

OSS AI Test Generator converts Jira user stories and API specifications (OpenAPI / Postman) into structured test cases and Cucumber .feature files — automatically, with full traceability back to acceptance criteria.

Key capabilities

  • Jira → Feature File — Fetch a Jira story, generate Functional / Negative / Boundary test cases, export a .feature file.
  • OpenAPI / Postman → Feature File — Upload an API spec JSON, pick endpoints, generate per-endpoint test suites.
  • Demo mode — A built-in OSS Fault Management demo runs without any API key, letting you explore the output immediately.
  • Download Center — Download individual .feature files or all of them bundled in a .zip.
  • Scenario Outlines — Data-driven scenarios with Examples: tables are generated automatically for parameterised cases.
  • Traceability — Every test case includes a source_ac comment pointing to the exact acceptance-criterion text it was derived from, and inferred cases are flagged with a warning.

OSS sub-domains supported

Domain Examples
Fault Management Alarm lifecycle, correlation, suppression, NBI forwarding
Performance Management KPI/KQI collection, threshold breaches, PMRP jobs
Network Inventory NE lifecycle, topology discovery, reconciliation
Service Provisioning Order fulfilment, service activation, rollback
Configuration Management NETCONF/YANG, CM backup/restore
Network Topology Link discovery, adjacency

Prerequisites

Requirement Version
Python 3.10 or later
pip any recent version

You will also need:

  • Anthropic API key — get one at console.anthropic.com (required for live generation; not needed for demo mode).
  • Jira API token — required only for the Jira tab (not needed for API spec or demo tabs).

Installation

# 1. Clone the repository
git clone <repo-url>
cd oss-test-case-generator

# 2. (Recommended) Create a virtual environment
python -m venv .venv
source .venv/bin/activate        # macOS / Linux
.venv\Scripts\activate           # Windows

# 3. Install dependencies
pip install -r requirements.txt

Dependencies (requirements.txt)

streamlit>=1.32.0
anthropic>=0.25.0
requests>=2.31.0
pandas>=2.0.0

Running the app

streamlit run app.py

The app opens in your browser at http://localhost:8501.


Usage

Tab 1 — Jira Story → Feature File

  1. Sidebar — Configuration

    • Enter your Claude API Key.
    • Enter your Jira Base URL (e.g. https://yourorg.atlassian.net), Jira Email, and Jira API Token.
    • Choose one or more OSS Sub-domains.
    • Toggle generation options: auto-tags, Background block, Scenario Outlines.
  2. Enter a Jira Issue Key (e.g. OSS-4721) and click Fetch Story.

  3. Review the fetched story content and acceptance criteria.

  4. Click Generate with Claude — the AI analyses the story and produces test cases.

  5. Review the generated test cases (expandable cards with steps, tags, test data, and traceability).

  6. Enter a Feature title and click Generate .feature File, then download it.

Tab 2 — API Spec → Feature File

  1. Complete the sidebar configuration (Claude API Key + generation settings).

  2. Select the spec format: OpenAPI / Swagger JSON or Postman Collection v2.1.

  3. Upload your JSON file.

  4. Optionally select specific endpoints; leave blank to process all.

  5. Click Generate Test Cases — one test suite per endpoint is produced.

  6. Generate and download individual .feature files.

Tab 3 — Download Center

Download all previously generated .feature files in a single .zip archive.

Tab 4 — Demo & Validation

Runs the built-in OSS Fault Management demo without requiring any API key:

  • Pre-loaded Jira story: Alarm Notification Service — Real-time alarm forwarding to NBI (OSS-4721).
  • 8 pre-built Jira test cases covering AC1–AC7 (Functional, Negative, Boundary).
  • Pre-loaded OpenAPI demo spec for POST /alarms with 5 test cases.
  • Click Generate Demo Feature Files to produce downloadable .feature files instantly.

Demo files

Two sample JSON files are included for testing Tab 2 without a live API:

File Description
demo_alarm_api.json OpenAPI spec for the OSS Alarm Management API (POST /alarms)
demo_jira_story.json Exported Jira story JSON for OSS-4721

Upload either file in Tab 2 to try the full API spec workflow.


Project structure

oss-test-case-generator/
├── app.py                  # Main Streamlit application
├── requirements.txt        # Python dependencies
├── demo_alarm_api.json     # Sample OpenAPI spec
├── demo_jira_story.json    # Sample Jira story export
└── README.md

Environment variables (optional)

Instead of entering your API key in the sidebar on every run, you can set it as an environment variable and pre-populate the field:

export ANTHROPIC_API_KEY="sk-ant-..."

The app reads sidebar inputs at runtime; environment variable support requires a small code change if you want it fully automated.


Generated output format

Each .feature file follows standard Gherkin syntax:

# Generated by OSS AI Test Generator
# Source: OSS-4721
# OSS Domain: Fault Management
# Generated: 2026-03-02 10:00
# Total Scenarios: 8

@oss-fm @telecom
Feature: Alarm Notification Service - Real-time alarm forwarding to NBI
  As an OSS engineer
  I want to verify alarm notification service
  So that the OSS system operates correctly

  Background:
    Given the OSS system is up and accessible
    And the user is authenticated with valid credentials
    And the test network elements are available

  @regression @oss-fm @functional @p1
  Scenario Outline: [TC_OSS_FM_001] Forward CRITICAL alarm to NBI within SLA
    # Preconditions: OSS FM module is running; NBI endpoint is reachable
    Given A CRITICAL alarm RRC_SETUP_FAILURE is raised on NE <neId> (<neType>)
    When The FM module receives the alarm via SNMP trap
    And Record the alarm receipt timestamp T1
    Then NBI receives alarm notification within 5 seconds of T1
    # Traceability: Derived from AC1: 'system SHALL forward alarm to NBI within 5 seconds'

    Examples:
      | neId        | neType | severity | alarmCode         |
      | NE-gNB-001  | gNB    | CRITICAL | RRC_SETUP_FAILURE |
      | NE-eNB-042  | eNB    | MAJOR    | S1_LINK_FAILURE   |
      | NE-OLT-007  | OLT    | CRITICAL | PON_PORT_DOWN     |

Troubleshooting

Problem Solution
401 from Jira Verify Jira email and API token in the sidebar.
404 Jira issue not found Check the issue key and Jira Base URL.
Claude returns no JSON The API key may be invalid or rate-limited.
Empty acceptance criteria The tool falls back to the story description; add ACs explicitly in Jira.
Postman collection not parsed Ensure the collection is exported as Collection v2.1 format.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages