Automatically generate BDD test scripts from JIRA stories using AI! This tool leverages OpenAI's language models and LangChain to analyze your JIRA stories and generate comprehensive Gherkin-style acceptance criteria.
- π€ AI-Powered Test Generation: Automatically converts JIRA stories into BDD scenarios
- π Smart Context Understanding: Uses FAISS vector database for intelligent story analysis
- π·οΈ Auto-tagged Scenarios: Generates
@positive,@negative, and@edgecasescenarios - π Kanban Integration: Pulls stories directly from your JIRA Kanban board
- π§ LangChain Integration: Utilizes advanced LLM capabilities for natural language processing
- π Custom Prompting: Specialized prompts for QA-focused scenario generation
- Connects to your JIRA board and fetches story details
- Processes story text using LangChain and embeddings
- Stores context in FAISS vector database for semantic search
- Uses OpenAI to generate relevant test scenarios
- Outputs formatted Gherkin feature files
-
LangChain Components:
- π
LLMChainfor orchestrating the generation pipeline - π
PromptTemplatefor structured scenario generation - π―
OpenAIEmbeddingsfor semantic text understanding
- π
-
Vector Database:
- π FAISS similarity search with cosine distance
- π§© Chunk size: 500 characters with 50-character overlap
- π― Top-k retrieval (k=3) for relevant context
-
OpenAI Integration:
- π€ Model: Uses latest GPT for generation
- ποΈ Temperature: 0 (for consistent output)
- π Custom prompt engineering for QA focus
You can customize the behavior by modifying these parameters in main.py:
# Vector DB Configuration
CHUNK_SIZE = 500 # Adjust for longer/shorter stories
CHUNK_OVERLAP = 50 # Increase for better context continuity
TOP_K_RESULTS = 3 # Number of similar chunks to consider
# LangChain Configuration
TEMPERATURE = 0 # 0 for consistent, up to 0.7 for creative
MAX_TOKENS = 1000 # Adjust based on scenario complexity
TEMPLATE_VERSION = "QA" # Choose different prompt templates
# JIRA Integration
BATCH_SIZE = 10 # Number of stories to process at once
FIELDS = ["summary", "description", "acceptance_criteria"]QA: Standard test scenario generationAPI: API testing focused scenariosUI: User interface testing scenariosSECURITY: Security testing scenarios
- Enable batch processing for multiple stories
- Use GPU acceleration for FAISS (install
faiss-gpu) - Cache embeddings for frequently accessed stories
- Implement parallel processing for large backlogs
βββ KAN-1.feature # π Feature file containing BDD scenarios
βββ main.py # π Python script for running BDD testsMake sure you have the following installed:
- π Python 3.x
- π OpenAI API key
- π« JIRA API credentials
- Go to OpenAI API Platform
- Sign up or log in to your account
- Navigate to API Keys section
- Create a new secret key
- Copy and save it securely (you won't be able to see it again!)
- Log in to Atlassian Account Settings
- Click "Create API Token"
- Give it a meaningful label (e.g., "QA-Automation")
- Copy and save the token securely
Your JIRA credentials will include:
- π€ Username: Your Atlassian account email
- π API Token: The token you just created
- π Instance URL: Your JIRA instance URL (e.g.,
https://your-domain.atlassian.net)
You can install all required dependencies using the requirements.txt file:
pip install -r requirements.txtThis will install the following packages:
- π
python-dotenv- For environment variables management - π
atlassian-python-api- For JIRA integration - π§
langchain- For LLM operations - π€
openai- For OpenAI integration - π
faiss-cpu- For vector similarity search - π§ͺ
behave- For BDD testing
Alternatively, you can install packages individually:
pip install python-dotenv # For environment variables
pip install atlassian-python-api # For JIRA integration
pip install langchain # For LLM operations
pip install openai # For OpenAI integration
pip install faiss-cpu # For vector similarity search
pip install behave # For BDD testingCreate a .env file in the root directory with the following variables:
JIRA_USERNAME=your_jira_username
JIRA_API_TOKEN=your_jira_api_token
JIRA_INSTANCE_URL=your_jira_url
OPENAI_API_KEY=your_openai_api_key- π Clone the repository:
git clone https://github.com/aiqualitylab/jira-qa-automation.git
cd jira-qa-automation- β Install Behave:
pip install behaveποΈ Organize your feature files inside a features/ folder if your project grows.
The AI automatically generates feature files with comprehensive test coverage:
- β Positive Scenarios: Happy path test cases
- β Negative Scenarios: Error handling and invalid inputs
- π Edge Cases: Boundary conditions and special situations
- π Clear Documentation: AI-generated descriptions for each scenario
The system uses:
- π FAISS Vector DB: For semantic similarity search in story content
- π LangChain: For advanced prompt engineering and context management
- π§ OpenAI: For natural language understanding and scenario generation
Feature: Shopping Cart Checkout Process
@positive
Scenario: Successful checkout with valid payment
Given the user has items in their shopping cart
When they proceed to checkout
And enter valid payment details
Then the order should be confirmed
And they should receive a confirmation email
@negative
Scenario: Checkout with insufficient funds
Given the user has items in their shopping cart
When they proceed to checkout
And enter payment details with insufficient funds
Then they should see an "Insufficient Funds" error
And the order should not be processedWe welcome improvements and new scenarios!
-
π΄ Fork the repository
-
πΏ Create a new branch:
git checkout -b feature/my-new-feature- πΎ Commit your changes:
git commit -m "Add new test scenario"- π Push your branch:
git push origin feature/my-new-feature- π¬ Open a Pull Request
π Open for changes
-
π API Key Issues:
- Error: "OpenAI API key not found"
- β
Check if
.envfile exists in root directory - β Verify OPENAI_API_KEY is correctly set
- β Ensure no spaces around the API key
- β
Check if
- Error: "OpenAI API key not found"
-
π JIRA Connection:
- Error: "JIRA authentication failed"
- β
Verify JIRA credentials in
.env - β
Check if JIRA URL includes
https:// - β Ensure API token has required permissions
- β
Verify JIRA credentials in
- Error: "JIRA authentication failed"
-
πΎ Vector DB Issues:
- Error: "FAISS index build failed"
- β Check if story text is not empty
- β Verify Python environment has required packages
- β Try clearing the FAISS index cache
- Error: "FAISS index build failed"
-
π Python Environment:
- Error: "Module not found"
- β
Run
pip install -r requirements.txt - β Activate virtual environment if using one
- β Check Python version compatibility
- β
Run
- Error: "Module not found"
-
Optimal Story Format:
- Keep JIRA stories concise and structured
- Include acceptance criteria in story description
- Use consistent formatting in JIRA
-
Vector DB Optimization:
- Regular cleanup of old indices
- Adjust chunk size for better context
- Monitor memory usage with large stories
For questions or collaboration, connect with us:
π§ͺ GitHub: aiqualitylab