Skip to content

Testing Java modules with exportable test fixtures #3549

Answered by sormuras
ppkarwasz asked this question in Q&A
Discussion options

You must be logged in to vote

I wrote a blog about modular testing and most parts still apply today: https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world

Most parts? I don't like the module-info.test approach as much as I did back then. Today, I prefer dedicated module-info.java files in test-only modules. So, yes to your question:

Should we have an additional test-only Maven module for JPMS integration tests?

An integration test should be as close as possible to what your real users do. They would write something like:

module org.example.app {
  requires org.apache.logging.log4j;
}

Thus, a test could read:

module test.org.apache.logging.log4j {

  requires org.apache.logging.log4j; // module unde…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@ppkarwasz
Comment options

@sormuras
Comment options

@ppkarwasz
Comment options

Comment options

You must be logged in to vote
1 reply
@ppkarwasz
Comment options

Answer selected by ppkarwasz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants