-
Notifications
You must be signed in to change notification settings - Fork 26
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
@BeforeTest / @AfterTest in parent classes #215
Comments
IMO it should wok. I mean it should check super class. However, till now nobody got to this issue and we had really complicated use cases with usage of Teradata and Presto together. Have you considered to use composition over inheritance? |
My use case was the LDAP tests which have a bunch of @Inject fields (test parameters). Basically, I wanted to reuse that in the parent class. Can that be done with composition?
Normal TestNG inheritance is rather difficult to follow and somewhat buggy (or perhaps I don't understand it because it's not documented), so I could agree with not wanting to support inheritance.
However, if we choose not to support that, it would be helpful to scan the parents for annotations and fail explicitly, rather than trying to figure out what happened when you get NPE or similar due to the setup not running.
|
I think it is always possible to use composition ; ) One of ideas is to write tempto Using that way, you could setup some entity in your brand new How does it sound to you? |
Thanks for the tip! I didn't know this existed. It looks like it can work here, too. |
Are
@BeforeTestWithContext
/@AfterTestWithContext
supposed to work in parent classes? The methodTestInitializationListenerinvokeMethodsAnnotatedWith()
usesgetDeclaredMethods()
which only finds methods on that exact class. Should it look for methods recursively in the super classes?The text was updated successfully, but these errors were encountered: