Skip to content

Forbid usage of static inner test classes in TestNG#11316

Merged
hashhar merged 2 commits intotrinodb:masterfrom
grantatspothero:gn/ForbidStaticInnerTestClasses
Mar 16, 2022
Merged

Forbid usage of static inner test classes in TestNG#11316
hashhar merged 2 commits intotrinodb:masterfrom
grantatspothero:gn/ForbidStaticInnerTestClasses

Conversation

@grantatspothero
Copy link
Copy Markdown
Contributor

@grantatspothero grantatspothero commented Mar 3, 2022

Description

TestNG support for static inner test classes is poor

Adds a TestNG listener to fail if a test class is defined as a static inner class

Related issues, pull requests, and links

This PR introduced usage of static inner test classes in kudu:
#10940

This PR subsequently removed the static inner test classes after some tests were not being run:
#11185

Documentation

(X) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(X) No release notes entries required.
( ) Release notes entries required with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Mar 3, 2022
@grantatspothero grantatspothero force-pushed the gn/ForbidStaticInnerTestClasses branch from 56cca63 to d2985c6 Compare March 3, 2022 22:41
@grantatspothero grantatspothero changed the title Forbid usage of static inner test classes in testNG Forbid usage of static inner test classes in TestNG Mar 3, 2022
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

static boolean isInnerClass(Class<?> testClas)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove "Static", it doesn't matter.

Comment on lines 24 to 38
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The tested method is one-liner "is inner class". I don't think this test adds any value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to prove to myself the automation works, I can remove the MultipleInnerTestClasses cases but I think keeping at least the first testcase is helpful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if/once you apply https://github.com/trinodb/trino/pull/11316/files#r819513710, there is nothing this test actually tests.

@grantatspothero grantatspothero force-pushed the gn/ForbidStaticInnerTestClasses branch 2 times, most recently from aa8893c to 689bdb5 Compare March 14, 2022 19:18
TestNG support for inner test classes is poor, see this issue:
trinodb#11185
@hashhar hashhar force-pushed the gn/ForbidStaticInnerTestClasses branch from 689bdb5 to 1dc1814 Compare March 15, 2022 06:12
@hashhar hashhar merged commit e0cf4a9 into trinodb:master Mar 16, 2022
@github-actions github-actions bot added this to the 374 milestone Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants