reportportal/agent-java-junit

Hard to use in a big project out of the box

smecsia opened this issue · 7 comments

Hi guys. I decided to try this promising project and to feed my local ReportPortal instance with the test results from JUnit tests. And I faced with the following problems:

  • It is not available from the Maven Central, so everybody has to add the custom repository to the config, which is not obvious.
  • It has a lot of dependencies (why there are so many?). And the worst thing is that it is using such libraries as Guava and Guice, that are known to be extremely incompatible from version to version. So it becomes almost impossible to solve the appearing depndency hell issues in the big proect with tons of dependencies...

hi Ilya. Valid points. Let me comment on them:

  1. Deps from bintray will be replicated to Maven Central soon. Actually, i do not think absence in maven central is major issue, but we understand that it's just 'must have' :)
  2. Historically, we started implementation with Google libraries. Don't really think Guice is so backward-incompatible, but absolutely agree that Guava constantly changing API. Moreover, new version of client is coming and it will have rxjava as dependency. So there is one more dependency.
    Good news is that we get rid of spring-related stuff on client side (there were spring-hateaos in the REST model).
    Personally, i don't really like idea to rewrite existing stuff to get rid of guice or guava.
    But i understand that users possibly may face 'dependency hell' issues.
    To avoid that, we will continue using repackaging technique and hide all stuff related to apache http client and guava.

In general, i agree with need to rewrite client using on vanilla jdk only, but unfortunately we don't have resources to do that in short term.

Could you please let me know which problems do you have with guice? What classes/packages/logic are not backward-compatible with older versions?

Thanks a lot for interest and valuable comment!

@avarabyeu thank you for your answers and quick response!
Actually I did not have much time to investigate the incompatibilities. But when I tried to upgrade Guava version, I ended up with some Guice NPE and just gave up, because our dependency tree already looks like a hell :)
It would be nice to have an easy-to-plug-in solution. So Maven Central mirroring and avoiding the popular libraries, such as Guava in the dependencies would help.
Anyway, it's great to see this framework in open source. Nice start, keep moving forward.

P.S. here is the stack trace I got (hopefully it will be helpful):

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:130)
	at org.apache.maven.surefire.booter.SurefireReflector.instantiateProvider(SurefireReflector.java:239)
	at org.apache.maven.surefire.booter.ProviderFactory.createProvider(ProviderFactory.java:122)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class com.google.inject.internal.Annotations$AnnotationChecker
	at com.google.inject.internal.Annotations$AnnotationChecker.<init>(Annotations.java:104)
	at com.google.inject.internal.Annotations.<clinit>(Annotations.java:122)
	at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
	at com.google.inject.Key.strategyFor(Key.java:339)
	at com.google.inject.Key.get(Key.java:229)
	at com.google.inject.name.Names.bindProperties(Names.java:67)
	at com.epam.reportportal.guice.ReportPortalClientModule.configure(ReportPortalClientModule.java:59)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
	at com.google.inject.spi.Elements.getElements(Elements.java:103)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
	at com.google.inject.Guice.createInjector(Guice.java:94)
	at com.google.inject.Guice.createInjector(Guice.java:71)
	at com.google.inject.Guice.createInjector(Guice.java:61)
	at com.epam.reportportal.guice.BaseInjector.<init>(BaseInjector.java:44)
	at com.epam.reportportal.guice.Injector.<init>(Injector.java:56)
	at com.epam.reportportal.guice.Injector.<init>(Injector.java:34)
	at com.epam.reportportal.guice.Injector$1.get(Injector.java:44)
	at com.epam.reportportal.guice.Injector$1.get(Injector.java:40)
	at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:125)
	at com.epam.reportportal.guice.Injector.getInstance(Injector.java:49)
	at com.epam.reportportal.junit.JUnitInjectorProvider$1.get(JUnitInjectorProvider.java:40)
	at com.epam.reportportal.junit.JUnitInjectorProvider$1.get(JUnitInjectorProvider.java:37)
	at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:125)
	at com.epam.reportportal.junit.JUnitInjectorProvider.getInstance(JUnitInjectorProvider.java:45)
	at com.epam.reportportal.junit.ReportPortalListener.<init>(ReportPortalListener.java:42)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.apache.maven.surefire.util.ReflectionUtils.instantiate(ReflectionUtils.java:110)
	at org.apache.maven.surefire.common.junit4.JUnit4RunListenerFactory.createCustomListeners(JUnit4RunListenerFactory.java:43)
	at org.apache.maven.surefire.junit4.JUnit4Provider.<init>(JUnit4Provider.java:80)
	... 10 more

@smecsia That's very useful! Thank you!

So, finally, we embedded guava and left guice as transitive dependency. The fun here is that guice is also depends on guava. So, the best option is to embed both of them. But again, not sure if we really need it. If several people raise the same issue again, we will embed them.

Regarding junit integration, we are not sure about 3.x update for junit4. The nearest plan is to implement integration with junit5

@avarabyeu Thank you very much, will try to use newer version and let you know my experience! 👍

One year later, but still no Maven Central artifacts... :(

me looking for maven central one