The "Vansah API binding for Python" enables seamless integration with popular Python testing frameworks such as PyTest, Unittest, Behave, and Robot Framework, while efficiently sending test results to Vansah Test Management for Jira.
Website • More Connect Integrations
- Overview
- Features
- Installation
- Setup and Configuration
- Usage
- Use Case: Sending Test Results from Automation Framework to Vansah
- Troubleshooting
- Contributing
- Developed By
VansahNode
is a Python library that allows you to interact with the Vansah Test Management system for Jira. This library helps automate the process of adding test runs, logging test results, and managing test artifacts in Vansah directly from your automation framework.
- Create test runs from Jira issues or test folders.
- Log test results for individual test steps.
- Attach screenshots or other artifacts to test logs.
- Manage test runs and logs programmatically.
To get started with VansahNode
, ensure you have Python 3.12+ installed for Windows, Linux and MacOS. Then, install the required modules:
pip install requests
You can also install other dependencies (if applicable):
pip install -r requirements.txt
- Vansah API Token: Obtain your API token from your Jira workspace.
- Vansah URL: The base URL for your Vansah instance (e.g.,
https://prod.vansah.com
) or Obtain your Vansah Connect URL from Vansah API Tokens .
Set up your VansahNode
instance by configuring the following:
- Vansah URL
- Sprint, Environment, and Release details
- API Token
- Jira Issue Key or Test Folder ID
Example:
from VansahNode import VansahNode
# Initialize the VansahNode instance
vansahnode = VansahNode()
# Set up configuration
vansahnode.set_vansah_url("https://prod.vansah.com")
vansahnode.set_vansah_token("<YOUR_API_TOKEN>")
vansahnode.set_sprint_name("Sprint 1")
vansahnode.set_environment_name("UAT")
vansahnode.set_release_name("Release 1")
vansahnode.set_jira_issue_key("PROJECT-123")
#Add Project Key in case of Test Folder runs
vansahnode.set_project_key("PROJECT")
Use the add_test_run_from_jira_issue
method to create a test run linked to a Jira issue.
# Create a test run for a specific test case
TEST_CASE = "PROJECT-TC1"
vansahnode.add_test_run_from_jira_issue(TEST_CASE)
Log results for specific test steps within a test run.
# Log a test result with a screenshot
vansahnode.add_test_log(
result="passed", # Result: "passed", "failed", etc.
comment="Test step executed successfully.",
test_step_row=1, # Step number
image_path=r"path/to/screenshot.png" # Optional screenshot
)
- Remove a Test Run:
vansahnode.remove_test_run() # Requires TEST_RUN_IDENTIFIER to be set
- Remove a Test Log:
vansahnode.remove_test_log() # Requires TEST_LOG_IDENTIFIER to be set
Here’s how you can send test results from a Selenium test script to Vansah:
from selenium import webdriver
from VansahNode import VansahNode
# Initialize VansahNode
vansahnode = VansahNode()
vansahnode.set_vansah_url("https://prod.vansah.com")
vansahnode.set_vansah_token("<YOUR_API_TOKEN>")
vansahnode.set_sprint_name("Sprint 1")
vansahnode.set_environment_name("UAT")
vansahnode.set_release_name("Release 1")
vansahnode.set_jira_issue_key("PROJECT-123")
# Set up Selenium
driver = webdriver.Chrome()
try:
driver.get("https://example.com")
assert "Example Domain" in driver.title
# Create a test run
TEST_CASE = "PROJECT-TC1"
vansahnode.add_test_run_from_jira_issue(TEST_CASE)
# Log the result
vansahnode.add_test_log(
result="passed",
comment="Homepage loaded successfully.",
test_step_row=1,
image_path="path/to/screenshot.png"
)
except Exception as e:
vansahnode.add_test_log(
result="failed",
comment=f"Test failed with error: {e}",
test_step_row=1
)
finally:
driver.quit()
-
Error:
TEST_RUN_IDENTIFIER is not set
- Ensure you call
add_test_run_from_jira_issue
oradd_test_run_from_test_folder
before logging test results.
- Ensure you call
-
Error: Authentication Failed
- Verify your API token and Vansah URL.
-
File Not Found Error
- Check the file path provided for screenshots or other artifacts.
We welcome contributions! Please feel free to submit issues or pull requests to improve this library.