-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
11 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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# Tests for actors | ||
|
||
You can implement two types of tests for an actor in the leapp-repository - component and unit tests. | ||
The Leapp actors are currently covered by three types of tests - unit, component and e2e. | ||
|
||
## Component tests | ||
- These tests provide fabricated input messages for the actor, check the outputs stated in the actor's description. | ||
- These tests should not be written based on the actor's code but rather based on the behavior stated in the actor's description. Ideally they could be written by somebody who doesn't know the code. | ||
- Example of a component test: https://github.com/oamg/leapp-repository/blob/master/repos/system_upgrade/el7toel8/actors/redhatsignedrpmcheck/tests/test_redhatsignedrpmcheck.py | ||
|
||
## Unit tests | ||
## Unit and component tests | ||
- Both unit and component tests are to be placed in the actor's _tests_ folder. | ||
- Tutorial on how to write unit and component tests: https://leapp.readthedocs.io/en/latest/unit-testing.html | ||
|
||
### Unit tests | ||
- These tests deal with individual actor's functions/methods. | ||
- You can't unit test any method/function within the actor.py. You can write unit tests only for the functions/methods within actor's libraries. | ||
- Thus, to be able to write unit tests for an actor, ideally the only thing in the actor.py's _process()_ method is calling the entry-point function of the actor's library python module. | ||
- Tutorial on how to write unit tests: https://leapp.readthedocs.io/en/latest/unit-testing.html | ||
- Currently it's not possible to unit test any method/function within the *actor.py*. You can write unit tests only for functions/methods within the actor's libraries. | ||
- Thus, to be able to write unit tests for an actor, ideally the only thing in the _actor.py_'s _process()_ method is calling the entry-point function of the actor's library python module. | ||
- Example of unit tests: https://github.com/oamg/leapp-repository/blob/master/repos/system_upgrade/el7toel8/actors/checkbootavailspace/tests/unit_test.py | ||
|
||
### Component tests | ||
- These tests provide fabricated input messages for the actor, check the outputs stated in the actor's description. | ||
- These tests should not be written based on the actor's code but rather based on the behavior stated in the actor's description. They could be written by somebody who didn't write the code. | ||
- Example of component tests: https://github.com/oamg/leapp-repository/blob/master/repos/system_upgrade/el7toel8/actors/checknfs/tests/test_checknfs.py | ||
|
||
## End to end (e2e) tests | ||
|
||
Both types of tests are to be placed in the actor's _tests_ folder. | ||
- The QA team for the OAMG projects maintains an internal testing framework facilitating e2e tests. |