Reporting System
Reporting is a crucial aspect of any testing or development framework. Vedro provides a rich and flexible reporting system to help engineers track and understand the results of their scenarios.
By default, Vedro uses RichReporter, which offers a powerful, customizable, and intuitive interface.
A Look into the RichReporter
To make the most of the RichReporter's capabilities, you can customize various settings either in the configuration file or directly on the command line during test execution.
Show Timings
Test execution time is often a crucial metric in software testing. The RichReporter allows you to easily include timing information for each scenario and step by setting show_timings
in your configuration file. Alternatively, you can specify this in the command line.
- Command Line
- Config File
$ vedro run --show-timings
# ./vedro.cfg.py
import vedro
import vedro.plugins.director.rich as rich_reporter
class Config(vedro.Config):
class Plugins(vedro.Config.Plugins):
class RichReporter(rich_reporter.RichReporter):
enabled = True
show_timings = True
Output:
Scenarios
* auth / login
✔ login as registered user (0.21s)
✔ try to login as nonexisting user (0.11s)
✔ try to login with incorrect password (0.22s)
# 3 scenarios, 3 passed, 0 failed, 0 skipped (0.53s)
Moreover, you can pair this with --show-steps
to show timings for individual test steps as follows:
$ vedro run --show-timings --show-steps
Output:
Scenarios
* auth / login
✔ login as registered user (0.36s)
✔ given_user (0.19s)
✔ when_user_logs_in (0.18s)
✔ then_it_should_return_success_response (0.00s)
✔ and_it_should_return_created_token (0.00s)
# 1 scenarios, 1 passed, 0 failed, 0 skipped (0.36s)
Show Paths
At times, it might be necessary to know the paths of the executed scenarios. With RichReporter, you can enable show_paths
either in your configuration or directly on the command line.
- Command Line
- Config File
$ vedro run --show-paths
# ./vedro.cfg.py
import vedro
import vedro.plugins.director.rich as rich_reporter
class Config(vedro.Config):
class Plugins(vedro.Config.Plugins):
class RichReporter(rich_reporter.RichReporter):
enabled = True
show_paths = True
Scenarios
* auth / login
✔ login as registered user
> scenarios/auth/login/login_as_registered_user.py
✔ try to login as nonexisting user
> scenarios/auth/login/try_to_login_as_nonexisting_user.py
✔ try to login with incorrect password
> scenarios/auth/login/try_to_login_with_incorrect_password.py
# 3 scenarios, 3 passed, 0 failed, 0 skipped (0.81s)
Show Scenario Spinner
Additionally, RichReporter provides a feature to display a spinner for the scenario currently being executed. This feature can be activated by setting show_scenario_spinner
in your configuration or specifying it in the command line.
- Command Line
- Config File
$ vedro run --show-scenario-spinner
# ./vedro.cfg.py
import vedro
import vedro.plugins.director.rich as rich_reporter
class Config(vedro.Config):
class Plugins(vedro.Config.Plugins):
class RichReporter(rich_reporter.RichReporter):
enabled = True
show_scenario_spinner = True
Leveraging Multiple Reporters
Vedro facilitates the simultaneous use of multiple reporters. In fact, it encourages you to use multiple reporters concurrently to benefit from the unique strengths of each.
$ vedro run -r (--reporters) reporter1 reporter2 ...
For example, to use both RichReporter and AllureReporter, the command would be:
$ vedro run -r rich allure
Additionally, Vedro includes a 'silent' reporter option, which, as the name implies, allows tests to run without generating any terminal output:
$ vedro run -r silent