-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(robot): add readme for robot tests.
Refs:CTOR-666
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# centreon-plugins Automated tests | ||
|
||
## Robot tests | ||
|
||
In this project robot is used to order the integration tests. | ||
|
||
### install snmpsim | ||
|
||
See docker image to find the right package to install and the method to install it. | ||
Once snmpsim is installed, you need to create the snmp user : | ||
|
||
````bash | ||
useradd snmp | ||
mkdir -p /var/lib/snmp/cert_indexes/ | ||
chown snmp:snmp -R /var/lib/snmp/cert_indexes/ | ||
```` | ||
|
||
to launch snmpsim use this from the root of the project (one level above this file) : | ||
```bash | ||
sudo snmpsim-command-responder --logging-method=null --agent-udpv4-endpoint=127.0.0.1:2024 --process-user=snmp --process-group=snmp --data-dir='./tests' | ||
# to test it : snmpwalk -v2c -c hardware/server/lenovo/xcc/snmp/system-health-ok 127.0.0.1:2024 | ||
``` | ||
|
||
test should be run with the "robot" binary, indicating the path to the test file to run. | ||
robot consider every file with .robot extension and try to execute every test case in it. | ||
|
||
```bash | ||
robot tests/ | ||
``` | ||
|
||
you can filter the tests run by specifying -e to exclude and -i to include a specific tag before the file path. | ||
|
||
|
||
## unit tests | ||
|
||
In this project perl test::v0 is used to run unit tests. | ||
|
||
## test coverage | ||
To check your test coverage you can use Deve::Cover | ||
when launching any type of test, prepend this to your command : | ||
|
||
```bash | ||
PERL5OPT=-MDevel::Cover | ||
``` | ||
|
||
for exemple for robot : | ||
|
||
```bash | ||
PERL5OPT=-MDevel::Cover robot tests/ | ||
``` | ||
|
||
It will create a cover_db/ folder to store all data, you can use the `cover` to generate a html report. | ||
```bash | ||
cover | ||
``` | ||
|
||
Then open the coverage.html file in the cover_db/ folder to navigate your code with coverage. |