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

Data provider methods should type of setup method #215

Closed
martingrossmann opened this issue Mar 11, 2022 · 2 comments · Fixed by #387
Closed

Data provider methods should type of setup method #215

martingrossmann opened this issue Mar 11, 2022 · 2 comments · Fixed by #387
Assignees
Labels
enhancement New feature or request

Comments

@martingrossmann
Copy link
Contributor

Is your feature request related to a problem? Please describe.
At the moment data provider methods have no corresponding method context. Only in case of assertion or exceptions a method context is created (see fix #214).
But a data provider method is a kind of setup method and should get its own method context.

Describe the solution you'd like
The TesterraListener already implements IDataProviderListener. Its needed to implement some more methods like beforeDataProviderExecution and afterDataProviderExecution.
The method context should have the type Setup.

@martingrossmann martingrossmann added the enhancement New feature or request label Mar 11, 2022
@martingrossmann martingrossmann self-assigned this Mar 11, 2022
@martingrossmann
Copy link
Contributor Author

First analyses and current unsolved problem:

Overwriting the following TestNG methods in TesterraListener:

@Override
public void beforeDataProviderExecution(IDataProviderMethod dataProviderMethod, ITestNGMethod testNGMethod, ITestContext testContext) {
   ...
}

@Override
public void afterDataProviderExecution(IDataProviderMethod dataProviderMethod, ITestNGMethod testNGMethod, ITestContext testContext) {
   ...
}

For creating new MethodContext we need to call pBeforeInvocation(IInvokedMethod invokedMethod, ITestResult testResult, ITestContext testContext) within the TesterraListener. testNGMethod contains the called test method. The complete MethodContext logic based on ITestNGMethod.

Well, the object testNGMethod contains enough information about the data provider but from my point there is no chance to get to know if testNGMethod is created from a data provider listener method or from 'real call' of the test method (see beforeInvocation of TesterraListener).

The information that the current method context contains the data provider must forwarded to ClassContext.getMethodContext() (l. 130).

@martingrossmann
Copy link
Contributor Author

Some additional hints:

  • extend status tests (count of method contexts, ...)
  • extend ReportNG tests (method details)

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

Successfully merging a pull request may close this issue.

1 participant