[Feature]: provide test fixtures for TestNG similar to JUnits @UsePlaywright functionality
🚀 Feature Request
Please provide test fixtures for TestNG testing framework which would work similarly as in JUnit framework. This could work similarly to @UsePlaywright, reducing boilerplate code.
In other words a similar funcitonality to Junit one provided here: https://playwright.dev/java/docs/junit
Example
Example is to use annotation like suggested in : https://playwright.dev/java/docs/junit
@UsePlaywright public class TestExample { @Test void shouldClickButton(Page page) { page.navigate("data:text/html,"); page.locator("button").click(); assertEquals("Clicked", page.evaluate("result")); }
Motivation
Motivation is a fact that TestNG is also broadly used
TestNG doesn't have the capability to provide fixtures easily. We would need to create a base class that test classes would need to inherit from which isn't ideal because java doesn't allow multiple inheritance. All the other ways to pass parameters to a test results in conflicts with other aspects of TestNG.
For example, if we use a @DataProvider annotation to provide Playwright fixtures, the user can no longer use @Parameters functionality of TestNG.
In my opinion, supporting TestNG will bring more maintenance headaches than is worth it because we don't know how the user is using TestNG.
As a workaround, you could use @UsePlaywright annotation and in your own base class, create an instance of the factory and configure Playwright objects yourself.