Testimony inspects and reports on the python test cases.
Project description
Are you tired of managing your test cases in a test case management tool and your test code in a python automation framework? Testimony can help to use the python automation framework as a test case repository tool.
The project testimony is written to inspect and report on the python test cases. There are several reporting features in this program.
The parameter options are:
print - List all test cases
summary - Summary of number of automated cases vs. manual cases
validate_docstring - Validate docstrings. This does the following:s
Reports test cases with invalid docstrings
Reports test cases with missing docstrings
Reports test cases that does not have minimal required docstrings (This will enforce that all test cases have a minimal set of docstrings). Currently testimony enforces Feature, Test, Assert as mandatory docstrings for each test case”
bugs - Test cases affected by Bugs and the corresponding Bug list
manual - List all manual test cases
auto - List all auto test cases
Note: 1. testimony returns a non-zero error code when the test case docstrings does not follow the intended rules, returns zero otherwise 2. testimony also parses different folders under the given folder to verify the test files 3. testimony also displays optional colored outputs when termcolor is installed
Advantages
Avoids a separate test case management tool to document test cases by using the python automation framework for the same
Enforces test cases to follow a defined standard
Runs in integration with tools like Travis to get a report as and when you check in code
Saves a lot of time from the conventional way of writing test cases using a test management tool
Installation
You could install testimony from PyPI using pip:
pip install testimony
Requirements
1) Install testimony following the steps on the installation section
2) Pre-requisites
Expected Docstring format:
""" @Feature: Login @Test: Log in as a valid user @Setup: Navigate to abc.com @Steps: 1. Launch the url 2. Log in with valid user credentials @Assert: Log in successful @BZ: #1234567 @Status: Manual (REMOVE this field once automated) """
3) Optional color formatting - If termcolor package is installed, output will be printed in colored text
Usage:
$ testimony -h usage: testimony [-h] [-n] REPORT PATH [PATH ...] Inspects and report on the Python test cases. positional arguments: REPORT report type, possible values: print, summary, validate_docstring, bugs, manual, auto PATH a list of paths to look for tests cases optional arguments: -h, --help show this help message and exit -n, --nocolor Do not use color option
$ testimony print /home/testimony/tests/ Fetching Test Path /home/testimony/tests/ Scanning test_sample.py... TC 1 Feture: Login - Positive Test: Login with right credentials Steps: 1. Login to the application with valid credentials Assert: Login is successful Bug: 123456 Statues: Manual TC 2 test_positive_login_2: Docstring missing. Please update. TC 3 Feature: Login - Positive Test: Login with Latin credentials Steps: 1. Login to the application with valid Latin credentials Assert: Login is successful TC 4 Feature: Login - Positive Test: Login with Credentials having special characters Steps: 1. Login to the application with valid credentials having special characters Assert: Activation key is created Status: Manual TC 5 Steps: 1. Login to the application with invalid credentials BZ: 123456 Status: Manual $ echo $? 255
$ testimony summary /home/testimony/tests/ Fetching Test Path /home/testimony/tests/ Total Number of test cases: 4 Total Number of automated cases: 2 Total Number of manual cases: 2 Test cases with no docstrings: 1 $ echo $? 255
$ testimony validate_docstring /home/testimony/tests/ Fetching Test Path /home/testimony/tests/ Scanning test_sample.py... test_positive_login_1: Invalid DocString: Feture: Login - Positive test_positive_login_1: Invalid DocString: Bug: 123456 test_positive_login_1: Invalid DocString: Statues: Manual test_positive_login_1: Need feature, test and assert at the minimum test_positive_login_2: Docstring missing. Please update. test_negative_login_5: Need feature, test and assert at the minimum Total Number of invalid docstrings: 3 Test cases with no docstrings: 1 Test cases missing minimal docstrings: 2 $ echo $? 255
$ testimony bugs /home/testimony/tests/ Fetching Test Path /home/estimony/tests/ Scanning test_sample.py... Total Number of test cases affected by bugs: 1 Bug list: 123456 $ echo $? 255
$ testimony manual /home/testimony/tests/ Fetching Test Path /home/estimony/tests/ Scanning test_sample.py... Feature: Login - Positive Test: Login with Credentials having special characters Steps: 1. Login to the application with valid credentials having special characters Assert: Activation key is created Status: Manual Steps: 1. Login to the application with invalid credentials BZ: 123456 Status: Manual $ echo $? 255
$ testimony auto /home/testimony/tests/ Fetching Test Path /home/estimony/tests/ Scanning test_sample.py... Feture: Login - Positive Test: Login with right credentials Steps: 1. Login to the application with valid credentials Assert: Login is successful Bug: 123456 Statues: Manual Feature: Login - Positive Test: Login with Latin credentials Steps: 1. Login to the application with valid Latin credentials Assert: Login is successful $ echo $? 255
Success scenario in which testimony returns 0
$ testimony validate_docstring /home/tests/ui/sample/ Fetching Test Path home/tests/ui/sample/ Scanning test_activationkey.py... Total Number of invalid docstrings: 0 Test cases with no docstrings: 0 Test cases missing minimal docstrings: 0 $ echo $? 0
Having termcolor installed, testimony produces colored output by default. It can be disabled by:
$ testimony auto /home/apple/tests/login/ --nocolor (or) $ testimony auto /home/apple/tests/login/ -n
Known Issues
None
Version History
Version 0.2.0
- fix to check the tests starting with test_ rather than just test - Testimony will return error code when docstrings are missing, incorrect docstrings found, minimal docstrings not present - Make validate_docstring return a 0 success return code if no errors are found - Organized Constants - Now testimony accepts --nocolor or --n argument to avoid color output - testimony will now not error out if termcolor is not installed. - Make termcolor an optional dependency - Add Travis configuration to automatically run pep8 when testimony is updated - Get tests from subfolders of the given path
Version 0.1.0
- Initial Release
Contributors
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
File details
Details for the file testimony-0.3.0.tar.gz
.
File metadata
- Download URL: testimony-0.3.0.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a58ba4f0f6309eb77549579e4c89354bdb0231dd9c0c532bf32a15023a8d7001 |
|
MD5 | d0a81de68439a75cf58fd556a3d87b11 |
|
BLAKE2b-256 | 0ad9a0be698265de76153668c84ab07745c2a102dcc449058dc38c9ecaf46246 |