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

Add BeforeClass/AfterClass like on ITestListener #776

Closed
vguna opened this issue Aug 6, 2015 · 4 comments
Closed

Add BeforeClass/AfterClass like on ITestListener #776

vguna opened this issue Aug 6, 2015 · 4 comments

Comments

@vguna
Copy link

vguna commented Aug 6, 2015

It would be great, if the ITestListener would offer a method that is invoked, when a Test Class is created and gets executed.

I'm trying to write a TestNG listener that is fired once on each test class to print the test class name to the log/console. I tried it with ITestListener onTestStart(), but this is called per test - as the name states. To log only once, I would have to synchronize it somehow when e.g. running in a multithreaded test (threadPoolSize=..) - otherwise it would log n times (once per thread).

Referencing this discussion:

http://testng.1065351.n5.nabble.com/Getting-an-event-when-test-class-is-created-td21715.html#a21735

@juherr
Copy link
Member

juherr commented Aug 6, 2015

You are asking a listener way to do @BeforeClass and @afterclass, isn't it?

@vguna
Copy link
Author

vguna commented Aug 6, 2015

Exactly. Without the need to touch my test classes. It should be transparently available to them without requiring specific superclasses etc.

@juherr
Copy link
Member

juherr commented Aug 6, 2015

Would you like to try to add it yourself and propose it?

@juherr juherr changed the title add onTestClass event to ITestListener Add BeforeClass/AfterClass like on ITestListener Aug 6, 2015
@vguna
Copy link
Author

vguna commented Aug 6, 2015

I'll check with my manager :).

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

No branches or pull requests

2 participants