When I execute codecept run
on my terminal, I get all my tests executed. I would like to suppress one specific method from being executed.
Api Tests (6) ---------------------------------------------------------------------
✔ ...Cest: It_should_deny_access_to_anonymous_user (1.112s)
✔ ...Cest: It_should_deny_access_to_unauthorized_user (0.26s)
✔ ...Cest: It_should_deny_access_to_host_without_any_user (0.22s)
✔ ...Cest: It_should_access_firewall_settings_with_authorized_user (0.28s)
✔ ...Cest: Token (0.21s)
✔ ...Cest: It_should_create_new_firewall_setting (0.5s)
The method called Token
actually belongs to a Trait
that my Test Class uses
class FirewallSettingsAuthorizationCest {
use MakeTokens;
...
}
How do I block methods in that trait from being executed as a test?
In general, how do I write a method that will not be tested by Codeception?
"Each public method of Cest (except those starting with _) will be executed as a test"
So to write a method that will not be tested, you could try changing method visibility (if possible) or leading the method name with an underscore (_).