π Extract ALL the juicy details from your Azure DevOps test plans with hierarchical structure and execution history!
This comprehensive Python tool doesn't just export test cases - it captures the complete testing story! Get hierarchical test suite structures, detailed test steps, shared steps resolution, execution history, and so much more. Perfect for deep test analysis, reporting, and quality insights! πβ¨
- π Python 3.6+ installed on your machine
- π’ Azure DevOps organization with test plans
- π Personal Access Token (PAT) with Test Management and Work Items read permissions
- π» Git (to download the tool)
If you already have Python installed, skip to Step:4
Otherwise, please follow along to install Python globally on your machine.
This section will guide users who do not have Python or VS Code installed.
-
Download Python:
- Go to the official Python website.
- Click on the "Download Python" button (the latest version is recommended).
-
Run the Installer:
- Open the downloaded installer.
- Important: Check the box that says "Add Python to PATH".
- Click "Install Now" and follow the prompts.
-
Verify Installation:
- Open Command Prompt (Windows) or Terminal (Mac/Linux).
- Type the following command and press Enter:
python --version
- You should see the installed Python version.
-
Download VS Code:
- Go to the Visual Studio Code website.
- Click on the "Download" button for your operating system.
-
Run the Installer:
- Open the downloaded installer.
- Follow the installation prompts.
-
Install Python Extension:
- Open VS Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the left side of the window.
- Search for "Python" and install the official Python extension by Microsoft.
-
Open a New Terminal in VS Code:
- Go to the menu and select
Terminal>New Terminal.
- Go to the menu and select
-
Check Python Installation in VS Code terminal:
- In the terminal, type:
python --version
- Ensure it shows the correct Python version.
- In the terminal, type:
If you are having trouble, make sure you installed the official Microsoft Python VScode extension in Step: 2.3
-
Create a Folder on Your Desktop:
- Right-click on your desktop and select
New>Folder. - Name the folder "projects".
- Right-click on your desktop and select
-
Open Visual Studio Code:
- Launch VS Code from your applications or start menu.
-
Open the Projects Folder in VS Code:
- In VS Code, go to the menu and select
File>Open Folder.... - Navigate to your desktop and select the "projects" folder you just created.
- In VS Code, go to the menu and select
-
Verify the Folder is Open:
- Ensure that the "projects" folder is displayed in the Explorer pane on the left side of VS Code.
Option A: Download with Git (Recommended)
- Open a New Terminal in VS Code:
- Go to the menu and select
Terminal>New Terminal.
- Go to the menu and select
# Clone the repository to your computer
git clone https://github.com/chuls5/python-azureTestPlanExporter.git
# Go into the folder
cd python-azureTestPlanExporterOption B: Manual Download
-
π Go to the GitHub Repository Page:
- Open your web browser and navigate to the Azure DevOps Test Plan Exporter GitHub repository.
-
π Click the Green "Code" Button:
- On the repository page, locate the green button labeled "Code" and click on it.
-
π¦ Download the ZIP File:
- In the dropdown menu, click on "Download ZIP". This will download a compressed file containing the project files to your computer.
-
π Extract the ZIP File:
- Navigate to your Downloads folder (or wherever the ZIP file was saved).
- Right-click on the downloaded ZIP file and select "Extract All..." (or use your preferred extraction tool).
- Choose a destination folder (you can extract it to the "projects" folder you created earlier) and click "Extract".
-
π» Open Command Prompt/Terminal:
- Open Command Prompt (Windows) or Terminal (Mac/Linux).
-
Navigate to the Extracted Folder:
- Use the
cdcommand to change to the directory where you extracted the files. For example:
cd path/to/your/extracted/folder- Make sure to replace
path/to/your/extracted/folderwith the actual path to the folder where you extracted the ZIP file.
- Use the
-
Verify the Files:
- Once in the folder, you can list the files to ensure everything is extracted correctly by running:
ls # For Mac/Linux dir # For Windows
Use the Python installer "pip", also known as, "python install package" to install the required packages for the project.
Since this Python script is interacting with Microsoft Azure API, install the following package:
# Install the required Python package
pip install requestsThe requests package in Python is a popular and widely used library for making HTTP requests. It provides a simple and elegant API for interacting with web services, APIs, and web pages.
π‘ Beginner Tip: If you get a "pip not found" error, you might need to use python -m pip install requests instead.
Don't skip this step! You need this token to connect to Azure DevOps.
- π Go to your Azure DevOps in your web browser
- π€ Click your profile picture in the top right corner
- βοΈ Click "Personal access tokens"
- π Click "New Token"
- π Fill out the form:
- Name:
Test Plan Exporter(or any name you like) - Expiration: Choose how long it should work (90 days is fine for testing)
- Scopes: Click "Custom defined" and check these boxes:
- β Test Management β Read
- β Work Items β Read
- Name:
- π΅ Click "Create"
- π IMPORTANT: Copy the token that appears (you won't see it again!)
Basic command structure:
python azureTestPlanExporter.py --organization "your-org" --project "your-project" --pat "your-token" --test-plan-id "12345"Real example (replace with your actual values):
python azureTestPlanExporter.py --organization "contoso" --project "MyAwesomeApp" --pat "abcd1234efgh5678ijkl" --test-plan-id "42"π Where to find your information:
- Organization: In your Azure DevOps URL β
https://dev.azure.com/ORGANIZATION-NAME - Project: The project name you see in Azure DevOps
- Test Plan ID: Open your test plan in Azure DevOps, look at the URL β
.../_testManagement/execute?planId=TEST-PLAN-ID...
After running the command, you'll see:
- β Progress messages as it works
- π A summary of what it exported
- π A new CSV file in the same folder (like
test_plan_12345_export.csv)
Open the CSV file in Excel or Google Sheets to see your test data!
Let's say you have:
- Organization:
mycompany - Project:
WebApp - Test Plan ID:
100 - PAT:
abc123def456ghi789
Step-by-step:
- Open Command Prompt (Windows) or Terminal (Mac/Linux)
- Navigate to your downloaded folder:
cd Downloads/azure-devops-test-plan-exporter - Run the command:
python azureTestPlanExporter.py --organization "mycompany" --project "WebApp" --pat "abc123def456ghi789" --test-plan-id "100"
- Wait for it to finish (you'll see progress messages)
- Find your CSV file in the same folder!
β "python is not recognized" or "command not found"
- Solution: Install Python from python.org and make sure to check "Add Python to PATH"
β "No module named 'requests'"
- Solution: Run
pip install requests(orpython -m pip install requests)
β "Authentication failed"
- Solution: Double-check your PAT token and make sure it has the right permissions
β "Test plan not found"
- Solution: Verify the test plan ID is correct and you have access to it
| Argument | Required | Description | Example |
|---|---|---|---|
π’ --organization |
β | Azure DevOps organization name | "contoso" |
π --project |
β | Azure DevOps project name | "MyProject" |
π --pat |
β | Personal Access Token | "your-secret-token" |
π§ͺ --test-plan-id |
β | Test Plan ID to export | "12345" |
π --output |
β | Custom filename for CSV output | "my_export.csv" |
π --debug |
β | Enable detailed debug logging | (flag only) |
- π’ Organization: Found in your Azure DevOps URL:
https://dev.azure.com/{organization} - π Project: The project name visible in your Azure DevOps interface
- π§ͺ Test Plan ID: Found in the test plan URL or the test plan details page
Save to a custom filename:
python azureTestPlanExporter.py --organization "your-org" --project "your-project" --pat "your-pat-token" --test-plan-id "12345" --output "my_test_results.csv"Get detailed debug information:
python azureTestPlanExporter.py --organization "your-org" --project "your-project" --pat "your-pat-token" --test-plan-id "12345" --debug- ποΈ Complete Test Plan Export: Extracts test plans, suites, test cases, and individual test steps
- π Hierarchical Structure: Maintains suite hierarchy with full path navigation (no more guessing where tests belong!)
- π― Execution History: Includes latest test results, outcomes, and execution dates
- π Shared Steps Resolution: Automatically flattens shared steps into individual test cases (magic! β¨)
- π Rich Metadata: Captures created dates, assigned testers, area paths, and automation status
- π Debug Logging: Comprehensive logging with optional debug mode and file output
- πΎ CSV Export: Clean, structured CSV output for analysis and reporting
- π Smart Analytics: Execution breakdowns, automation stats, and step counting
The script generates a super-detailed hierarchical CSV file! Here's what you get:
| Column | Description | Example Values |
|---|---|---|
| π·οΈ Type | Row type identifier | Suite, Test Case, Test Step, Separator |
| π§ͺ Test Plan ID | Source test plan identifier | 12345 |
| ποΈ Suite Path | Full hierarchical path | Smoke Tests > Login > Authentication |
| π Suite ID | Unique suite identifier | 67890 |
| π― Test Case ID | Work item ID for test case | 11111 |
| π Title | Name/title of suite or test case | Valid User Login Test |
| π’ Step Number | Sequential test step number | 1, 2, 3... |
| β‘ Step Action | What to do in this step | Navigate to login page |
| β Expected Result | What should happen | Login page displays correctly |
| π Execution Status | Current execution state | Completed, Not Executed |
| π Execution Outcome | Test result | Passed, Failed, Blocked |
| π Last Run Date | Most recent execution date | 2024-03-15T14:30:22Z |
| π€ Last Run By | Who executed the test | Jane Doe |
| π₯ Assigned To | Currently assigned tester | John Smith |
| ποΈ Created Date | Test case creation date | 2024-01-01T09:00:00Z |
| π¨βπ» Created By | Test case creator | Test Manager |
| π·οΈ Area Path | Azure DevOps area path | MyProject\\Features\\Auth |
| π Iteration | Sprint/iteration path | Sprint 1 |
| π€ Automated | Automation status | Yes, No |
The file structure is initially going to look like a lot.
Those of us who know Excel will have no problem "wrapping text" from the 'Step Action' and 'Expected Result' columns.
Type,Suite Path,Title,Step Number,Step Action,Expected Result,...
Suite,Smoke Tests > Login,SUITE: Login Tests,,,,,...
Test Case,Smoke Tests > Login,Valid User Login,,,,,...
Test Step,Smoke Tests > Login,,1,Navigate to login page,Login page displays,...
Test Step,Smoke Tests > Login,,2,Enter valid credentials,User is authenticated,...
Test Step,Smoke Tests > Login,,3,Click login button,User redirected to dashboard,...
Separator,,,,,,...Think of it as a special password that lets this tool talk to your Azure DevOps account safely. It's like giving the tool a visitor badge to your building.
- π Open Azure DevOps in your web browser
- π€ Click your profile picture (top right corner)
- βοΈ Click "Personal access tokens"
- π Click "New Token" (blue button)
- π Fill out the form:
- Name: Type something like
Test Plan Exporter Tool - Organization: Select your organization (or leave as "All accessible organizations")
- Expiration: Pick a date (30-90 days is good for testing)
- Scopes: Click "Custom defined" and find these sections:
- π Test Management - check the "Read" box
- π― Work Items - check the "Read" box
- π₯ Project and Team - check the "Read" box
- Name: Type something like
- π΅ Click "Create"
- π COPY THE TOKEN! It will show a long string of letters and numbers - copy this somewhere safe (like Notepad). You won't be able to see it again!
- π Keep it secret - don't share it with others or post it online
- β° It expires - you'll need to create a new one when it expires
- ποΈ You can delete it anytime by going back to Personal Access Tokens and clicking "Revoke"
==================================================
π― EXPORT SUMMARY
==================================================
Total suites: 5
Total test cases: 42
Total test steps: 156
Total rows exported: 208
Execution Outcome breakdown:
Failed: 3 (7.1%)
Not Executed: 25 (59.5%)
Passed: 14 (33.3%)
Execution Status breakdown:
Completed: 17 (40.5%)
Not Executed: 25 (59.5%)
Automation breakdown:
Manual: 38 (90.5%)
Automated: 4 (9.5%)
Average test steps per test case: 3.7
- π Progress updates for major operations
- π Summary statistics upon completion
- β Error messages for failed operations
- π Celebration when everything works!
When you use the --debug flag, you get:
- π Detailed API request/response logging
- π£ Step-by-step processing information
- π Debug log file:
azure_exporter_debug_YYYYMMDD_HHMMSS.log - π©Ί Enhanced error diagnostics
- π΅οΈ All the behind-the-scenes action!
- π Builds complete suite hierarchy with parent-child relationships
- π Generates human-readable suite paths like
"Regression > API > Authentication" - π― Maintains original test plan structure in export
- πΊοΈ No more getting lost in complex test structures!
- π Automatically detects shared step references in test cases
- π₯ Fetches shared step details and expands them inline
- π― Supports nested shared steps (shared steps containing other shared steps!)
- π’ Preserves step numbering after expansion
- β¨ It's like magic, but with code!
- π Correlates test cases with their latest execution results
- π Searches across ALL test runs in the test plan
- π Provides execution outcome, date, and executor information
- π‘οΈ Falls back to test point data when direct results aren't available
- π Complete execution story, not just current status!
- π¨ Robust API error handling with detailed logging
- π Graceful handling of missing or inaccessible test data
- β‘ Continues processing even if individual items fail
- π Comprehensive error reporting in debug mode
- πͺ Built to handle real-world messiness!
- β Verify your PAT is valid and not expired
- π Ensure PAT has required permissions
- π Double-check organization and project names are spelled correctly
- π Try regenerating your PAT if issues persist, or granting "Full Access"
- π Verify the test plan ID exists and is correct
- π Ensure you have read permissions to the test plan
- π Check that the test plan is in the specified project
- π Confirm you're connected to the right organization
- π Verify the test plan contains test suites and test cases
- β Check if test cases have been properly added to suites
- π Enable debug mode to see detailed processing information
- π Some test plans might have test cases but no execution history
- β° Large test plans may take several minutes to process (be patient!)
- π Enable debug mode to monitor progress
- π Consider exporting smaller test plans if timeout occurs
- π Check your internet connection stability
Use the --debug flag to get insider information about:
- π API requests and responses
- π Test step parsing details
- π Shared steps resolution process
- π Execution history correlation
- πΎ File I/O operations
- π΅οΈ Everything happening under the hood!
- π Requires internet connection to Azure DevOps (obviously!)
- β° Processing time increases with test plan size (bigger = slower)
- π Some advanced test case fields may not be included
- πΌοΈ Attachments and images in test steps are not exported
- ποΈ Test case parameters are not currently extracted
- π‘ But hey, we're constantly improving!
Want to make this tool even more awesome?
- π΄ Fork the project
- π Create a feature branch (
git checkout -b feature/amazing-feature) - π» Make your changes
- π§ͺ Test thoroughly (we love tests!)
- π¬ Submit a pull request
- π Celebrate your contribution!
- π Additional export formats (JSON, Excel, etc.)
- π¨ Better CSV formatting options
- π More detailed test step analysis
- π Performance optimizations
- π Support for other Azure DevOps features
Having trouble? We've got your back! πͺ
- π Azure DevOps REST API Documentation
- π§ͺ Azure DevOps Test Management Docs
- π Create an issue in this repository
- π§ Send me a message on LinkedIn!
Happy Testing, Data Warriors! π§ͺπβ¨
Made with β€οΈ, β, and countless hours of debugging for Azure DevOps users who believe that great testing deserves great tools!
Remember: Great test data leads to great products. You're not just exporting data - you're enabling better software! π
P.S. - If this tool saves you time, consider giving it a β star on GitHub! It makes our day! π