A tool to extract test cases from test scripts and export them to Excel.
Project description
TestSheet
TestSheet is a Python tool designed to extract test cases from test scripts and export them into an Excel file. It automatically parses test functions, extracts descriptions, preconditions, test steps, and expected outputs from comments, and organizes them into a structured Excel sheet.
Features
- Extract Test Cases: Automatically extracts test cases from Python test scripts.
- Export to Excel: Generates an Excel file with test case details.
- Supports Multiline Comments: Handles both single-line and multiline comments for test case details.
- CLI Support: Easy-to-use command-line interface for quick integration into workflows.
Installation
You can install testsheet via pip:
pip install testsheet
Usage
Command-Line Interface (CLI)
Run testsheet from the command line to process a single file or a directory of test scripts:
testsheet <input_test_script_file_or_directory>
This will generate an Excel file named <input_file_or_directory>_test_documentation.xlsx in the current working directory.
Example
Process a single test script file:
testsheet test_example.py
This will generate test_example_test_documentation.xlsx
Process a directory of test scripts:
testsheet tests_dir/
This will generate tests_test_documentation.xlsx, containing all test cases from files in the tests_dir/ directory.
Supported Comment Formats
TestSheet recognizes specific tags in comments to extract test case details. Use the following tags in your test script comments:
- Description: # Description: <description_text>
- Precondition: # Precondition: <precondition_text>
- Test Step: # Step: <step_text>
- Expected Output: # Expected Output: <expected_output_text>
Example Test Script
# Description: This is a sample test case for login functionality.
def test_login():
# Precondition: User must be on the login page.
''' Step: Enter valid username and password.\n
With pass length min 8 character
'''
# Expected Output: User should be logged in successfully.
# Step: Click the login button.
# Expected Output: Login button should be enabled.
pass
Contributing
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file testsheet-0.3.0.tar.gz.
File metadata
- Download URL: testsheet-0.3.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fde3553b86eff1258a3cc17f91c5cc9fbe30d6aced2cce8df3d00a0b7756ab4
|
|
| MD5 |
5fee3b115eac93b8c2c88c2e6ea5b282
|
|
| BLAKE2b-256 |
df8a03c295d5983b78ca8c4877e692eeada80c70ae8ad621cf12c66850776b77
|
File details
Details for the file testsheet-0.3.0-py3-none-any.whl.
File metadata
- Download URL: testsheet-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43768d35a488261543fff81828325160b32887c7233d26c53f4c9122810c5b69
|
|
| MD5 |
7d85130f78d35388b88393bc441bd479
|
|
| BLAKE2b-256 |
35344ae6d5081bbc18bab13f52700f8493eb01bc7d8fcfc33d1775245b536af9
|