Skip to content
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

Make session tests in o.e.osgi.tests independent from OSGiTest/CoreTest #456

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

HeikoKlare
Copy link
Contributor

Several session test classes in org.eclipse.osgi.tests are subclasses of either CoreTest or the OSGiTest subclass of CoreTest. This change make the test classes directly inherit from JUnit 3's TestCase to become independent of the CoreTest class. The TestCase inheritance is necessary until session tests do not rely on JUnit 3 anymore.

  • Remove inheritance of CoreTest and replace OSGiTest inheritance with static imports of inherited helper methods
  • Replace try-catch for actual errors with making the test method throw the exception

Copy link

github-actions bot commented Dec 21, 2023

Test Results

   24 files  ±0     24 suites  ±0   11m 27s ⏱️ -1s
2 150 tests ±0  2 105 ✅ ±0  45 💤 ±0  0 ❌ ±0 
2 194 runs  ±0  2 149 ✅ ±0  45 💤 ±0  0 ❌ ±0 

Results for commit 55cbe3f. ± Comparison against base commit 9eae0f7.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review December 21, 2023 15:15
@HannesWell
Copy link
Member

This change make the test classes directly inherit from JUnit 3's TestCase to become independent of the CoreTest class. The TestCase inheritance is necessary until session tests do not rely on JUnit 3 anymore.

From your comment in the other PR I assume the migration to Junit-4 is too much work respectively too different to a JUnit-5 pendant so that they should be migrated to Junit-5 directly?

Several session test classes in org.eclipse.osgi.tests are subclasses of
either CoreTest or the OSGiTest subclass of CoreTest. This change make
the test classes directly inherit from JUnit 3's TestCase to become
independent of the CoreTest class. The TestCase inheritance is necessary
until session tests do not rely on JUnit 3 anymore.

* Remove inheritance of CoreTest and replace OSGiTest inheritance with
static imports of inherited helper methods
* Replace try-catch for actual errors with making the test method throw
the exception
@HannesWell HannesWell force-pushed the sessiontests-testcase branch from 7923264 to 55cbe3f Compare December 22, 2023 19:05
@HeikoKlare
Copy link
Contributor Author

From your comment in the other PR I assume the migration to Junit-4 is too much work respectively too different to a JUnit-5 pendant so that they should be migrated to Junit-5 directly?

That's my expectation, yes. I will try to figure that out in an attempt to migrate the session test framework. First thing to do for the migration of session tests is the migration of the framework (SessionTest, SessionTestSuite and all its derivatives), as they assume a specific (JUnit-3-conforming) structure of the session test classes. So the migrating of the classes in Equinox affected by this PR to either JUnit 4 or 5 first requires an update of that framework in the Platform. This PR only removes the unnecessary inheritance hierarchy between TestCase and the actual test class to (1) allow the removal of CoreTest in Platform and (2) prepare for a later JUnit migration in which complex inheritance hierarchies are a problem anyway.

@akurtakov akurtakov merged commit 04099da into eclipse-equinox:master Jan 12, 2024
23 of 24 checks passed
@HeikoKlare HeikoKlare deleted the sessiontests-testcase branch January 12, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants