Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i register an AbstractStepListener #144

Open
BlueBell-XA opened this issue Apr 30, 2024 · 1 comment
Open

How do i register an AbstractStepListener #144

BlueBell-XA opened this issue Apr 30, 2024 · 1 comment

Comments

@BlueBell-XA
Copy link

I've created a custom listener class under src/test/java/listeners, and implemented the AbstractStepListener.

public class CustomListener extends AbstractStepListener {
    // Implemented methods here.
}

However, I'm unable to get the listener registered, or picked up in any way.... none of the functions are triggered.
Reason: I need access to the Scenario Outline examples before the test is executed. I figure that can be achieved through overriding the 'exampleStarted' methods.

I have already tried this Before hook:

    @Before
    public void before(Scenario scenario) {
        // Code here
    }

But the Scenario parameter doesn't have access to the outline examples... I can only see the Scenario Name, and tags.

@BlueBell-XA
Copy link
Author

I haven't yet solved the original issue, but I have managed to achieve the outcome I was actually looking for.

    @BeforeScenario
    public void beforeScenario(TestOutcome outcome) {
    }

Adding TestOutcome as a parameter for a function tagged with @BeforeScenario grants me access to the full scenario details, including the DataTable/s associated with a Scenario Outline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant