Skip to content

Commit a5b4a2b

Browse files
authored
Release v0_10_3 (#33)
* for reporter_web: - allow port definition - improve logging and status * - add ReportManager into TestDetails - new TestStep class * move models to models folder * - add pre-commit - update README.md * fix save file in reporter_log.py
1 parent 78ec66e commit a5b4a2b

7 files changed

Lines changed: 172 additions & 72 deletions

File tree

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 180

.github/workflows/python-publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ name: Upload Python Package
1010

1111
on:
1212
release:
13-
types: [published]
13+
types:
14+
- published
1415

1516
permissions:
1617
contents: read
@@ -21,11 +22,11 @@ jobs:
2122
runs-on: ubuntu-latest
2223

2324
steps:
24-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2526
- name: Set up Python
26-
uses: actions/setup-python@v3
27+
uses: actions/setup-python@v4
2728
with:
28-
python-version: '3.9'
29+
python-version: '3.x'
2930
- name: Install dependencies
3031
run: |
3132
python -m pip install --upgrade pip

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-merge-conflict
7+
- id: check-yaml
8+
- id: no-commit-to-branch
9+
args: [--branch, main, --branch, develop]
10+
- id: mixed-line-ending
11+
args: ["--fix=auto"]
12+
- id: trailing-whitespace
13+
- id: debug-statements
14+
- id: check-executables-have-shebangs
15+
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.5.7
18+
hooks:
19+
- id: ruff
20+
args: [--fix]
21+
- id: ruff-format
22+
23+
- repo: https://github.com/pycqa/flake8
24+
rev: 5.0.4
25+
hooks:
26+
- id: flake8

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## TestiPy - Python Test Tool
2+
3+
[![PyPI Version](https://img.shields.io/pypi/v/TestiPy.svg)](https://pypi.python.org/pypi/TestiPy)
4+
[![Python Versions](https://img.shields.io/pypi/pyversions/TestiPy.svg)](https://pypi.org/project/TestiPy)
5+
6+
This documentation provides an overview of TestiPy, a Python tool designed for test selection, execution, and reporting. TestiPy offers features like test management, parallel execution, and integration with various reporting tools. It aims to streamline the testing process, making it easier to organize, execute, and analyze test results.
7+
18

29
# 1. Installation
310
- ## From GitHub
@@ -26,7 +33,7 @@
2633
```bash
2734
# goto your folder where you've cloned this repo
2835
cd /where_you_have_cloned_this_repo
29-
36+
3037
# run demo tests indicating where the tests are and using the web reporter
3138
python testipy/run.py -tf testipy/tests -r web
3239
```
@@ -55,7 +62,7 @@
5562
-ef Exclude tests by @FEATURES tag
5663
-itn Include tests by @TN tag (beginsWith) (ex: -itn 1.3.1.10)
5764
-etn Exclude tests by @TN tag (beginsWith)
58-
65+
5966

6067
# 2.2. Select Reporters
6168
- ### options:
@@ -72,36 +79,46 @@
7279

7380
# 2.3. Run:
7481
- ### options:
75-
* **-rid** RunID (ex: -rid 17, if not passed then current hour and minute will be used ex: 2359)
76-
* **-pn** ProjectName (ex: -pn jules)
77-
* **-env** EnvironmentName to test (ex: -env dev)
78-
* **-rf** ResultsFolder (ex: -rf "/qa/test_results/"), where the tests results will be stored
79-
* **-tf** TestsFolder (ex: -tf "/qa/tests_scripts/jules/"), full path to where the tests are
80-
* **-repeat** Run the exact same pipeline that amount of times (ex: -repeat 3)
81-
* **-st** Suite Threads = 1..8 (ex: -st 4, meaning 4 suites can run in parallel)
82-
82+
* `-rid`: Run ID (e.g., `-rid 17`). If not provided, the current hour and minute will be used (e.g., `2359`).
83+
* `-pn`: Project Name (e.g., `-pn my_project`).
84+
* `-env`: Environment Name for testing (e.g., `-env qa`).
85+
* `-rf`: Results Folder (e.g., `-rf /path/to/results/`), where test results will be stored.
86+
* `-tf`: Tests Folder (e.g., `-tf /path/to/tests/`), the directory containing test scripts.
87+
* `-r` or `-reporter`: Add a reporter (e.g., `-r echo -r log -r web`).
88+
* Available reporters include: `echo`, `excel`, `log`, `portalio`, `slack`, `web`, `xml`.
89+
* `-repeat`: Number of times to repeat the test execution (e.g., `-repeat 3`).
90+
* `-st`: Suite Threads (1 to 8), controls the number of suites that can run in parallel (e.g., `-st 4`).
91+
8392
- ### flags
84-
* **--dryrun** All tests will run but without really being executed (all of them will end with SKIPPED)
85-
* **--debugcode** Disables the try/except on tests so errors are shown
86-
* **--debug-testipy** will show the stacktrace for testipy classes
87-
* **--1** Override test definitions of how many times tests will run (ncycle)
88-
* **--prof** Create file .prof with profiling data
89-
93+
* `--dryrun`: Runs tests without actual execution (all tests are marked as 'SKIPPED').
94+
* `--debugcode`: Disables try/except blocks in tests, showing detailed error messages.
95+
* `--debug-testipy`: Shows stack traces for TestiPy classes (useful for debugging the tool itself).
96+
* `--1`: Overrides the default number of test cycles (ncycles) defined in test suites, forcing all tests to run only once.
97+
* `--prof`: Generates a `.prof` file with profiling data.
98+
9099

91100
# 3. Example of usage:
92101
- #### Example of usage:
93102
```
94103
python3 run.py -env dev -reporter log -reporter web -rid 1 -tf "/home/testipy/my_test_scripts" -et NO_RUN -it DEV
95104
```
96-
- #### Storyboard:
105+
- #### Storyboard:
97106
- If storyboard passed, tests will run by the order defined on json file
98107
- If no storyboard is passed, then tests will run ordered (DESC) by package name, @PRIO defined on suite, then by @PRIO defined on test itself
99108
- #### Results Folder:
100109
- A folder will be created under the (specified -rf option) composed by: projectName_currentDate_RID (ex: testipy_20201231_00525)
101110
- Under the folder defined above, subfolders can be created with package_name/suite_name containing the tests results (created by each reporter)
102111
- #### Tests not ended:
103112
- If a test ends without being formally ended (by a testFailed, testSkipped or testPassed), it will be passed by the executor
104-
113+
114+
115+
In addition to the reporter-specific outputs, TestiPy creates a `results.yaml` file in the results folder, containing a summary of the overall test execution results.
116+
117+
This tool provides a flexible and customizable framework for Python testing, offering features for test organization, execution control, and comprehensive reporting through various channels.
118+
119+
120+
For integrations with Behave framework, [check the example here](https://github.com/pjn2work/testipy-tests)
121+
105122

106123
# 4. Suite Example
107124
``` python

setup.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
try:
1212
with open(readme, "r") as fh:
1313
long_description = fh.read()
14-
except:
14+
except Exception:
1515
long_description = """
1616
Testing tool for python with:
1717
- Test selection/execution
@@ -22,7 +22,17 @@
2222
requirements = os.path.join(curr_path, "testipy", "requirements.txt")
2323
print(f"Installing {requirements}")
2424
with open(requirements, "r") as fr:
25-
install_requires = str(fr.read()).split("\n")
25+
install_requires = [
26+
line.strip() for line in fr if line.strip() and not line.startswith("#")
27+
]
28+
29+
30+
extras_require = {
31+
"dev": [
32+
"pre-commit>=2.21",
33+
"flake8>=3.9",
34+
]
35+
}
2636

2737

2838
setuptools.setup(
@@ -38,11 +48,16 @@
3848
packages=setuptools.find_namespace_packages(include=("*",)),
3949
include_package_data=True,
4050
install_requires=install_requires,
51+
extras_require=extras_require,
4152
entry_points={"console_scripts": ["testipy = testipy.__main__:run_testipy"]},
53+
keywords=["testing", "reporting", "behave"],
4254
classifiers=[
43-
"Programming Language :: Python :: 3",
55+
"Programming Language :: Python :: 3.9",
56+
"Programming Language :: Python :: 3.10",
57+
"Programming Language :: Python :: 3.11",
58+
"Programming Language :: Python :: 3.12",
4459
"License :: OSI Approved :: MIT License",
4560
"Operating System :: OS Independent",
4661
],
47-
python_requires='>=3.9'
62+
python_requires=">=3.9",
4863
)

testipy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22

33

4-
__version__ = "0.10.2"
4+
__version__ = "0.10.3"
55
__app__ = "TestiPy"
66
__app_full__ = "Python Test Tool"
77
__author__ = "Pedro Nunes"

0 commit comments

Comments
 (0)