Skip to content

Fix incorrect @BeforeTest usages #17650

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

Merged

Conversation

findepi
Copy link
Member

@findepi findepi commented May 26, 2023

In some places before-test-method and in some before-class was apparently meant.

TestReportPrivateMethodsis changed too to limit proliferation of this annotation.

TestNG method invocation order example

Test class 1: @BeforeTest
Test class 2: @BeforeTest
Test class 1: @BeforeCass
Test class 1: @BeforeMethod
Test class 1: a test 1
Test class 1: @AfterMethod
Test class 1: @BeforeMethod
Test class 1: a test 2
Test class 1: @AfterMethod
Test class 1: @afterclass
Test class 2: @BeforeCass
Test class 2: @BeforeMethod
Test class 2: a test 1
Test class 2: @AfterMethod
Test class 2: @BeforeMethod
Test class 2: a test 2
Test class 2: @AfterMethod
Test class 2: @afterclass
Test class 1: @AfterTest
Test class 2: @AfterTest

@findepi findepi added test no-release-notes This pull request does not require release notes entry labels May 26, 2023
@findepi findepi requested review from losipiuk, kokosing and hashhar May 26, 2023 08:36
@cla-bot cla-bot bot added the cla-signed label May 26, 2023
Copy link
Contributor

@ksobolew ksobolew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, @BeforeTest is very confusingly named in TestNG.

In some places before-test-method and in some before-class was
apparently meant.

`TestReportPrivateMethods`is changed too to limit proliferation of this
annotation.

TestNG method invocation order example

```
Test class 1: @BeforeTest
Test class 2: @BeforeTest
Test class 1: @BeforeCass
Test class 1: @BeforeMethod
Test class 1: a test 1
Test class 1: @AfterMethod
Test class 1: @BeforeMethod
Test class 1: a test 2
Test class 1: @AfterMethod
Test class 1: @afterclass
Test class 2: @BeforeCass
Test class 2: @BeforeMethod
Test class 2: a test 1
Test class 2: @AfterMethod
Test class 2: @BeforeMethod
Test class 2: a test 2
Test class 2: @AfterMethod
Test class 2: @afterclass
Test class 1: @AfterTest
Test class 2: @AfterTest
```
@findepi findepi force-pushed the findepi/fix-incorrect-beforetest-usages-b738b3 branch from e6595db to 388b246 Compare May 26, 2023 08:56
@kokosing
Copy link
Member

Should we ban usages of @BeforeTest and @AfterTest? What is the use case for that one cannot achieve with @BeforeClass or @AfterClass?

@findepi
Copy link
Member Author

findepi commented May 26, 2023

@kokosing good idea

@findepi
Copy link
Member Author

findepi commented May 26, 2023

CI #16277

@findepi findepi merged commit 0df494f into trinodb:master May 26, 2023
@github-actions github-actions bot added this to the 419 milestone May 26, 2023
@findepi findepi deleted the findepi/fix-incorrect-beforetest-usages-b738b3 branch November 8, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry test
Development

Successfully merging this pull request may close these issues.

3 participants