[ 
https://issues.apache.org/jira/browse/SUREFIRE-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17108717#comment-17108717
 ] 

Tibor Digana commented on SUREFIRE-1792:
----------------------------------------

Maybe some hints:

It is also worth to segregate test utilities in a separate Git project with a 
separate ownership, development life cycle, build process and deployment.

The example in {{maven-compiler-plugin}} should be written other way.
Some companies say that "we want to test entire module structure". They create 
separate modules in the *flat structure* for these testing purposes. (need to 
suppress deployment)
And some other companies use {{maven-invoker-plugin}} which supports nested 
module(s) in *hierarchical structure*.
Some OSS project like the Maven has the third principle calling the [IT 
project|https://github.com/apache/maven-integration-testing] from [Maven 
project|https://github.com/apache/maven], see 
[Jenkinsfile|https://github.com/apache/maven/blob/master/Jenkinsfile] in the 
Maven project.

Altogether these are three way but i would never recommend sharing test Jar 
file.

> Reusable dependency tests
> -------------------------
>
>                 Key: SUREFIRE-1792
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1792
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 3.0.0-M3
>         Environment: Windows 10 home
> Maven 3.6.3 (w/ wrapper)
> Adopt OpenJDK 11(11.0.4-hotspot)
>            Reporter: Mantas Gridinas
>            Assignee: Tibor Digana
>            Priority: Major
>         Attachments: 2020-05-13T23-49-29_619-jvmRun1.dump, 
> 2020-05-13T23-49-29_619.dumpstream
>
>
> Hi!
> I read that you can do attached tests by installing the test-jar (from 
> http://maven.apache.org/guides/mini/guide-attached-tests.html) and then using 
> dependenciesToScan configuration option to scan the test-jar dependency for 
> tests and run them. This gave me an idea of providing a test jar that I could 
> test implementation of my interfaces without having to write repeated tests 
> for them (I load the implementations via ServiceLoader mechanism) . I've got 
> a project for that at https://gitlab.com/Dragas/eternal-witness. Mind you the 
> project does use project jigsaw features.
> While experimenting, I ended up extracting the "api" tests into its own 
> module, but the issue continues to remain.
> Trying this approach I seem to observe an interesting behavior. Surefire 
> plugin does indeed find that there are PlayerServiceTest and DeckServiceTest 
> files on the dependency graph, but it fails to load them for some reason. 
> Perhaps it does not patch the test module with the dependency module? I have 
> attached the JVM dumpstreams from my experimenting.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to