How to collect information about Ignored (@ignore) scenarios? #544
-
I want to collect how many tests are ignored in test run to make report with how many tests are ignored.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
When a scenario is marked with the @ignore tag, none of the user Binding code will be invoked. The code generated from the feature file will first check for that tag and if found will skip execution of its steps. There is an Execution Event published (the ScenarioSkippedEvent) which you could capture by writing a run-time plug-in. Unfortunately, that event won't tell you which scenario it was that was skipped. 😞 Here is the relevant code within the TestExecutionEngine that handles the scenario skipped situation: public virtual void OnScenarioSkipped()
{
// after discussing the placement of message sending points, this placement causes far less effort than rewriting the whole logic
_contextManager.ScenarioContext.ScenarioExecutionStatus = ScenarioExecutionStatus.Skipped;
// in case of skipping a Scenario, the OnScenarioStart() is not called, so publish the event here
_testThreadExecutionEventPublisher.PublishEvent(new ScenarioStartedEvent(FeatureContext, ScenarioContext));
_testThreadExecutionEventPublisher.PublishEvent(new ScenarioSkippedEvent());
} It would be a pretty simple enhancement to the constructor of the ScenarioSkippedEvent class to capture the FeatureContext and ScenarioContext. Once that is done, then a run-time plugin could listen for that event and write out to a log or other system as you desire. |
Beta Was this translation helpful? Give feedback.
-
I've created the following plugin:
And I'm getting into Initialize method but not OnEvent(in Listener) Regarding collaboration, I could add featureContext and scenarioContext to ScenarioSkippedEvent so I would add info about scenario but how could I listen or read these data? Sorry for a lot of questions :( |
Beta Was this translation helpful? Give feedback.
When a scenario is marked with the @ignore tag, none of the user Binding code will be invoked. The code generated from the feature file will first check for that tag and if found will skip execution of its steps.
There is an Execution Event published (the ScenarioSkippedEvent) which you could capture by writing a run-time plug-in. Unfortunately, that event won't tell you which scenario it was that was skipped. 😞
Here is the relevant code within the TestExecutionEngine that handles the scenario skipped situation: