Skip to main content

Cancel test execution in BeforeScenario Hook's method

Answered

Comments

4 comments

  • Andreas Willich

    Could you post the exact code of the hook? Because from what you described it should work. You are using the right solution.

    0
  • Dominique BOYER

    This is the code of my method :

            [BeforeScenario]
            public void BeforeScenario(ScenarioContext scenarioContext)
            {
                try
                {

                    var alcuinPageObject = new AlcuinPageObject(_browserDriver, _browserInteractions, _specflowOutputHelper, scenarioContext);

                    // Check scenario name, it should follow naming convention
                    CheckScenarioName(scenarioContext); // <= this method throw some exceptions


                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                    _specflowOutputHelper?.WriteLine(ex.ToString());
                    throw;
                }
            }

    0
  • Dominique BOYER

    Sorry I findout my mistake, initially I didn't rethrow the exception in my catch ...

    0
  • Andreas Willich

    👍

    That was my assumption but I wanted to be sure. 

    0

Please sign in to leave a comment.

Powered by Zendesk