Update docs/src/junit-java.md

Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
Signed-off-by: Jean-François Greffier <jfgreffier@users.noreply.github.com>
This commit is contained in:
Jean-François Greffier 2024-02-29 21:29:11 +01:00 committed by GitHub
parent 1c44385e42
commit 2306f84ce9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,7 +125,7 @@ Since it is not safe to use same Playwright objects from multiple threads withou
instance per thread and use it on that thread exclusively. Here is an example how to run multiple test classes in parallel. instance per thread and use it on that thread exclusively. Here is an example how to run multiple test classes in parallel.
Use [`@TestInstance(TestInstance.Lifecycle.PER_CLASS)`](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/TestInstance.html) Use [`@TestInstance(TestInstance.Lifecycle.PER_CLASS)`](https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/TestInstance.html)
annotation to make JUnit create one instance of a class for all test methods within that class (by default each JUnit will create a new instance of the class annotation to make JUnit create one instance of a class for all test methods within that class (by default JUnit will create a new instance of the class
for each test method). Store [Playwright] and [Browser] objects in instance fields. They will be shared between tests. Each instance of the class will use its for each test method). Store [Playwright] and [Browser] objects in instance fields. They will be shared between tests. Each instance of the class will use its
own copy of Playwright. This is done automatically if you use the `@UsePlaywright` JUnit annotation. own copy of Playwright. This is done automatically if you use the `@UsePlaywright` JUnit annotation.