question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

test: separate integration tests to their own gradle task

See original GitHub issue

Some tests are slow and flaky and not safe to run in parallel. We’ve added tags to these tests and would like to use them to define a separate test run.

We have TteTest and MteTest tags for these tests. The remainder of the tests (hopefully less slow and flaky) remain untagged. We will be treating TteTest and MteTest as equivalent for this new test task.

We need one gradle task (possibly the default test task?) that excludes tests with either of these tags,
and one gradle task that includes only tests with either of these tags.

This needs to be done for

  • engine and/or engine-test projects in the main repo
  • modules, which are configured by terasology-module under build-logic

engine-tests/build.gradle is probably the easiest place to start.

References

Terasology tests are written using JUnit 5 and run with the JUnit Platform.

Naming Questions

  • Should we make new tasks for “tests with MTE” and “tests without MTE”, and keep test in its current behavior of running all JUnit tests? Or should we change the default test task to be the “without MTE” one?
  • What should the “tests with MTE” task be named? Could be less specific than “MTE” to include other implementations in this category. integrationTest, simulationTest, flakyTest?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jdrueckertcommented, Apr 2, 2021

Oh I was already thinking about the stages in Jenkins when I said we want to have (only) those two separate ones. I would expect gradlew test to still run all of them.

1reaction
jdrueckertcommented, Mar 29, 2021

@keturn Thank you for writing this up 👍 and @mahela97 thank you for volunteering to implement this 👍

I believe we don’t want to keep test in its current behavior of running all tests, but have two new tasks, one for the tagged tests, one for the non-tagged tests. I’d suggest going for the following naming:

  • “unitTest” (or just “unit”?) - everything “MteTest” and “TteTest” tags
  • “integrationTest” (or just “integration”?) - everything with “MteTest” and “TteTest” tags

IMO this makes sense because of the following expectations: Proper unittests are expected to be many, but small in scope (testing a small aspect of the code), fast-running and parallelizable. Integration tests (including end-to-end (E2E) and scenario tests as well as tests combining a few units) on the contrary are expected to be fewer, but bigger in scope, slower-running and likely not parallelizable.

While it’s possible that currently, our non-tagged (neither MTE nor TTE) tests are not pure unit tests but could also be categorized as integration tests, they are expected to be a lot quicker than MTE and TTE tests. If they turn out not to be, we can think about tagging them as well and grouping them with the MTE and TTE tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Separate Gradle Tasks for Unit and Integration Tests - Inspeerity
Since now you can move all your integration tests to proper folder, and all of them will have all dependencies which are defined...
Read more >
Running integration tests in Gradle - Tom Gregory
This separates the integration tests from unit tests, making the project easier to understand and helping developers to work more productively.
Read more >
How to create a Gradle Task to run only a specific Tests in ...
I would suggest separating integration tests into separate source set. By default you already have 2 source sets, one for production code ...
Read more >
Testing in Java & JVM projects - Gradle User Manual
Gradle executes tests in a separate ('forked') JVM, isolated from the main build process. This prevents classpath pollution and excessive memory consumption for ......
Read more >
Running Integration Tests With Gradle - Test With Spring Course
We can add custom test sets into our Gradle build by using the Gradle TestSets plugin. · The Gradle TestSets plugin creates dependency ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found