This release is a pre-release and may not be stable for production use.
Markdown to Testcase
A Python tool to extract test cases from Markdown files and convert them to CSV and Excel formats.
Features
- Parse test cases from Markdown headings in the format
### TestCases (filename) - Support for direct YAML input files
- Generate CSV output files (one per test case section)
- Compile all test cases into a single Excel file with multiple sheets
- Detailed error reporting and suggestions for YAML parsing issues
- Colorized console output using loguru
Installation
From Source
# Clone the repository
git clone https://github.com/tkykszk/markdown_to_testcase.git
cd markdown_to_testcase
# Install dependencies
pip install -r requirements.txt
Binary Installations
Windows
Download the latest .exe file from the Releases page and run it directly.
# From the command line
markdown_to_testcase.exe convert -i input_file.md
macOS (Homebrew)
# Install using Homebrew
brew tap tkykszk/markdown_to_testcase
brew install markdown_to_testcase
# Run the command
markdown_to_testcase convert -i input_file.md
Ubuntu/Debian (apt)
# Add the repository
curl -s https://tkykszk.github.io/markdown_to_testcase/apt/KEY.gpg | sudo apt-key add -
echo "deb https://tkykszk.github.io/markdown_to_testcase/apt ./" | sudo tee /etc/apt/sources.list.d/markdown_to_testcase.list
# Update package list and install
sudo apt update
sudo apt install markdown-to-testcase
# Run the command
markdown_to_testcase convert -i input_file.md
Usage
Basic usage:
python main.py convert -i input_file.md
All available options:
python main.py convert -i input_file.md -o output_dir -F --verbose
Command-line Options
-i, --input: Input markdown or YAML file path (required)-o, --output-dir: Directory to store output files (default:output)-F, --force: Overwrite output files without asking-d, --debug: Enable debug mode (outputs DEBUG level logs)--verbose: Show verbose error messages and suggestions for YAML parsing issues--no-yaml-lint: Skip running yamllint on YAML content (validation is enabled by default)-v, --version: Display version information
Input Format
Markdown Format
The tool looks for sections in Markdown files that match the following format:
### TestCases (filename)
- ID: TC001
Name: Test Case Name
Desc: Test case description
Pre-conditions: Required preconditions
Test Steps: Steps to execute the test
Expected Result: Expected outcome
Actual Result: Actual outcome (recorded after testing)
Test Data: Test data to use
Priority: High/Medium/Low
Severity: High/Medium/Low
Status: Not executed/Passed/Failed
Environment: Test environment information
Tested By: Tester name
Date: Test date
Comments/Notes: Additional notes
Multiple test cases can be included in a single section, and multiple sections can be included in a single file.
YAML Format
The tool also supports direct YAML input files with the following format:
filename1.md:
- ID: TC001
Name: Test Case Name
# ... other fields
- ID: TC002
Name: Another Test Case
# ... other fields
filename2.md:
- ID: TC101
Name: Test Case for Another File
# ... other fields
Output
- CSV files will be created in the specified output directory (default:
output), one per test case section. - An Excel file named
test_cases.xlsxwill be created in the output directory, with one sheet per test case section.
Development
Requirements
- Python 3.12+
- yamllint (required for YAML validation)
- Dependencies listed in
requirements.txt
Testing
pytest
Code Formatting
black .
flake8
Building from Source
Building Windows Executable
# Install PyInstaller if not already installed
pip install pyinstaller
# Build the executable
pyinstaller --onefile --name markdown_to_testcase main.py
# The executable will be in the dist/ directory
Packaging for macOS (Homebrew)
- Create a Homebrew formula in a new repository named
homebrew-markdown_to_testcase:
# markdown_to_testcase.rb
class MarkdownToTestcase < Formula
desc "A tool to extract test cases from Markdown files"
homepage "https://github.com/tkykszk/markdown_to_testcase"
url "https://github.com/tkykszk/markdown_to_testcase/archive/refs/tags/v[VERSION].tar.gz"
sha256 "[SHA256]"
license "MIT"
depends_on "python@3.12"
def install
virtualenv_install_with_resources
end
test do
system "#{bin}/markdown_to_testcase", "--version"
end
end
- Users can then install with
brew tapandbrew installas shown in the Installation section.
Packaging for Ubuntu/Debian (apt)
- Create a
debiandirectory with the necessary files:
mkdir -p debian/source
-
Create the required configuration files (control, rules, changelog, etc)
-
Build the Debian package:
dpkg-buildpackage -us -uc
- Host the package in a repository accessible via apt (e.g., GitHub Pages)
License
MIT
Metadata
Release files for markdown-to-testcase 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| markdown_to_testcase-0.1.0a1.tar.gz | 14.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| markdown_to_testcase-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.2 kB
Release files / markdown_to_testcase-0.1.0a1.tar.gz
| Download URL | markdown_to_testcase-0.1.0a1.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98a57e45897fe42ae93848392f49179854a2f3cec64078ba26fc0c9675641231
|
|
BLAKE2b-256 checksum How to use checksums |
7debee71f732a62a579391052378b0a99e31d97e6a9a989fe2aa872b73dbb10a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / markdown_to_testcase-0.1.0a1-py3-none-any.whl
| Download URL | markdown_to_testcase-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c43d43f81098bd0c282869a41ee32f14f9d7dd2c78cb84b3547b0bc560cd982
|
|
BLAKE2b-256 checksum How to use checksums |
ad56fd55f305c81ae37454bc32dedfc2d6d0bc44bd1bb7f18b8fc7b0300bc2c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Security for markdown-to-testcase 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.