Skip to content

Commit b863d8f

Browse files
author
Cecylia Borek
committed
wip: update tests' README
1 parent a238ab1 commit b863d8f

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

tests/README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
# Splunk Test Suite
1+
# Python SDK tests
22

33
The test suite uses Python's standard library and the built-in **unittest**
44
library. The Splunk Enterprise SDK for Python has been tested with Python v3.7
55
and v3.9.
66

7-
To run the unit tests, open a command prompt in the **/splunk-sdk-python**
8-
directory and enter:
7+
TODO: info about using tox.
8+
9+
TODO: info about different types of tests (unit/integration/system) + need to setup docker for integration and system.
10+
11+
## Running tests
12+
13+
- running without -f will run on currently active python version
14+
- Run unit tests on all python versions:
15+
16+
`tox -f unit`
17+
18+
- running all tests (unit, integration and system)
19+
- `tox`
20+
21+
- running specific test
22+
- running type of test on only one python version
23+
-
924

10-
python setup.py test
1125

12-
You can also run individual test files, which are located in
13-
**/splunk-sdk-python/tests**. Each distinct area of the SDK is tested in a
14-
single file. For example, roles are tested
15-
in `test_role.py`. To run this test, open a command prompt in
16-
the **/splunk-sdk-python/tests** subdirectory and enter:
1726

18-
python test_role.py
1927

2028
NOTE: Before running the test suite, make sure the instance of Splunk you
2129
are testing against doesn't have new events being dumped continuously
@@ -28,23 +36,8 @@ with the free Splunk license.
2836

2937
## Code Coverage
3038

31-
Coverage.py is an excellent tool for measuring code coverage of Python programs.
32-
33-
To install it, use easy_install:
34-
35-
easy_install coverage
36-
37-
Or use pip:
38-
39-
pip install coverage
40-
41-
To generate a report of the code coverage of the unit test suite, open a command
42-
prompt in the **/splunk-sdk-python** directory and enter:
43-
44-
python setup.py coverage
39+
Code coverage is also provided with `pytest-cov` which uses `Coverage.py` under the hood. The code coverage stats are displayed at the end of each tox test run.
4540

46-
This command runs the entire test suite and writes an HTML coverage report to
47-
the **/splunk-sdk-python/coverage_report** directory.
41+
## Test reports
4842

49-
For more information about Coverage.py, see the author's website
50-
([http://nedbatchelder.com/code/coverage/](http://nedbatchelder.com/code/coverage/)).
43+
Pytest also generates test reports in JUnit XML format. For each tox environment, the test reports are saved in `test-reports/junit-{test-env}.xml`

0 commit comments

Comments
 (0)