Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save justaguywhocodes/a69a70073d65e85a20f9fb2e03d58474 to your computer and use it in GitHub Desktop.
Save justaguywhocodes/a69a70073d65e85a20f9fb2e03d58474 to your computer and use it in GitHub Desktop.
Jira2
**Jira Ticket: Requirements for VECTR Test Cases API to Jira Ticket Script**
**Description:**
Develop a script to create Jira tickets from VECTR test cases API data.
**Requirements:**
1. **Authentication**
- Create VECTR API credentials (e.g., API key or token) to authenticate requests securely.
- Store VECTR credentials in environment variables or a secrets manager to prevent exposure.
- Generate a Jira API token for a user with issue creation permissions to authenticate Jira API requests.
- Securely store Jira credentials in environment variables to ensure confidentiality.
2. **API Endpoints**
- Access VECTR API documentation to identify the `GET /testcases` endpoint and understand its response structure.
- Utilize Jira’s `POST /rest/api/2/issue` endpoint to create issues programmatically.
- Retrieve Jira issue creation metadata using `GET /rest/api/2/issue/createmeta` to identify required fields.
3. **Data Mapping**
- Map VECTR test case fields to Jira issue fields (e.g., `test_case_name` to `summary`, `description` to `description`, `test_case_id` to a custom field) to ensure accurate data transfer.
- Validate VECTR data to confirm required fields are non-empty and meet Jira’s constraints.
- Create or configure a “Test Case” issue type in Jira to align with test case data.
4. **Script Development**
- Develop the script in Python using the `requests` library to handle API interactions efficiently.
- Implement functions to authenticate with VECTR and Jira, fetch test cases, map data, and create Jira issues.
- Store configuration details (e.g., API URLs, credentials, project keys) in a config file or environment variables for reusability.
5. **Error Handling & Logging**
- Handle API errors (e.g., 401, 400, 500) with retries or fallbacks to ensure robust execution.
- Prevent duplicate Jira tickets by checking for existing issues using JQL or a local database.
- Log execution details (e.g., timestamps, test case IDs, Jira issue keys) to a file for traceability and debugging.
6. **Jira Configuration**
- Configure a Jira project with a valid project key (e.g., “TEST”) to receive created issues.
- Create custom fields in Jira (e.g., “Test Case ID”) to store VECTR-specific data.
- Grant the API user permissions to create and edit issues in the Jira project.
- Define a workflow in Jira to support test case statuses (e.g., “Pass,” “Fail”).
7. **Testing**
- Write unit tests for API calls and data mapping functions to verify functionality.
- Conduct integration tests in a sandbox Jira project to validate end-to-end execution.
- Validate created Jira tickets to ensure accurate data mapping and no duplicates.
8. **Security**
- Use HTTPS for all API requests to secure data in transit.
- Validate SSL certificates to prevent man-in-the-middle attacks.
- Comply with data privacy regulations (e.g., GDPR) when handling sensitive VECTR data.
- Respect VECTR and Jira API rate limits, implementing exponential backoff for retries.
9. **Optional Features**
- Enable attachment of VECTR files to Jira tickets using Jira’s attachment API to enhance traceability.
- Schedule the script to run automatically or trigger it based on VECTR events for efficiency.
- Link Jira tickets to VECTR test cases using custom fields or issue links for bidirectional traceability.
10. **Documentation**
- Create a README file documenting the script’s setup, field mappings, and example payloads to aid onboarding.
- Store the script in a Git repository to track changes and enable collaboration.
- Monitor VECTR and Jira API updates to maintain compatibility with future changes.
**Acceptance Criteria:**
- The script successfully creates Jira tickets with accurate VECTR test case data.
- The script prevents duplicate tickets and logs errors effectively.
- The code is secure, maintainable, and documented comprehensively.
- The script is tested in a sandbox environment with validated results.
**Notes:**
- Verify VECTR API specifics (e.g., endpoints, authentication) with official documentation.
- Check Jira version compatibility to avoid deprecated endpoints (e.g., `createmeta`).
- Explore Xray or Zephyr for advanced test case management if needed.
**Assignee:** [To Be Determined]
**Priority:** [To Be Determined]
**Project Key:** [e.g., TEST]
**Issue Type:** Task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment