Issue with reporting

345 views
Skip to first unread message

ciaran...@ft.com

unread,
May 19, 2015, 4:58:51 AM5/19/15
to thucydid...@googlegroups.com
Hi,

I'm using serenity to test custom functionality in salesforce but upon the completion of my first test i get the following error message relating to reporting and GSON:

Exception in thread "main" java.util.ServiceConfigurationError: net.thucydides.core.reports.AcceptanceTestReporter: Provider net.thucydides.core.reports.json.JSONTestOutcomeReporter could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at net.thucydides.core.reports.ReportService.getDefaultReporters(ReportService.java:194)
at net.serenitybdd.junit.runners.SerenityRunner.getDefaultReporters(SerenityRunner.java:611)
at net.serenitybdd.junit.runners.SerenityRunner.getReportService(SerenityRunner.java:380)
at net.serenitybdd.junit.runners.SerenityRunner.generateReportsFor(SerenityRunner.java:395)
at net.serenitybdd.junit.runners.SerenityRunner.generateReports(SerenityRunner.java:284)
at net.serenitybdd.junit.runners.SerenityRunner.run(SerenityRunner.java:254)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, java.lang.IncompatibleClassChangeError: class net.thucydides.core.reports.json.gson.OptionalTypeAdapter has interface com.google.gson.TypeAdapter as super class
  at net.thucydides.core.reports.json.gson.GsonJSONConverter.<init>(GsonJSONConverter.java:27)
  while locating net.thucydides.core.reports.json.gson.GsonJSONConverter
  at net.thucydides.core.guice.ThucydidesModule.configure(ThucydidesModule.java:64)
  while locating net.thucydides.core.reports.json.JSONConverter

1 error
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
at net.thucydides.core.reports.json.JSONTestOutcomeReporter.<init>(JSONTestOutcomeReporter.java:37)
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:408)
at java.lang.Class.newInstance(Class.java:438)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 12 more
Caused by: java.lang.IncompatibleClassChangeError: class net.thucydides.core.reports.json.gson.OptionalTypeAdapter has interface com.google.gson.TypeAdapter as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at net.thucydides.core.reports.json.gson.GsonJSONConverter.<init>(GsonJSONConverter.java:29)
at net.thucydides.core.reports.json.gson.GsonJSONConverter$$FastClassByGuice$$6794eb79.newInstance(<generated>)
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
... 20 more

I'm not particularly concerned about reporting and have tried removing the reporter plugin to no effect.

As it seemed similar to https://groups.google.com/forum/#!topic/thucydides-users/GdB4IvZGRvA i thought this might be a dependency issue, I tried deploying the solution provided but it still comes up. What am i missing?


This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL.  Registered in England and Wales with company number 53723.

ciaran...@ft.com

unread,
May 19, 2015, 5:00:39 AM5/19/15
to thucydid...@googlegroups.com
Forgot to add i'm using current version of serenity 1.0.47 and have tried jackson on both 2.4.3 and 2.5.3

John Smart

unread,
May 19, 2015, 5:20:57 AM5/19/15
to ciaran...@ft.com, thucydid...@googlegroups.com
That sounds like a dependency conflict, possibly with GSON (Serenity doesn't use Jackson). Make sure no other libraries are declaring an older version (Serenity uses GSON 2.3.1).

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com  |  john....@wakaleo.com
___________________________________________________

The dates for the 2014 BDD workshops have been scheduled! Check out our upcoming BDD/TDD Master classes and our Advanced BDD Requirements Workshops, coming soon to Sydney and Melbourne!
___________________________________________________

ciaran...@ft.com

unread,
May 19, 2015, 6:50:20 AM5/19/15
to thucydid...@googlegroups.com
So i've added to my pom: 

  <dependencyManagement>
     <dependencies>
        <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</dependencyManagement>
 
but I haven't resolved the problem yet, any oother suggestions would be great otherwise I'll upate once I've figured it out


This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL.  Registered in England and Wales with company number 53723.

John Smart

unread,
May 19, 2015, 6:29:12 PM5/19/15
to ciaran...@ft.com, thucydid...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ciaran...@ft.com

unread,
May 26, 2015, 9:34:40 AM5/26/15
to thucydid...@googlegroups.com, ciaran...@ft.com
Only got back to this problem today, i've got it resolved but it is a temporary solution.

"mvn dependency:tree -Dverbose -Dincludes=com.google.gson" showed only the gson dependency from serenity. The problem was in the manually installed wsc-23.jar from salesforce, which contained a rather outdated version of gson packaged inside it, rather than being depoendent on gson, so i've deleted the conflicting GsonBuilder.class inside it and my problems are solved.

Dmitriy Grablyov

unread,
Jan 6, 2016, 8:48:22 AM1/6/16
to Serenity BDD Users Group, ciaran...@ft.com
Hi, John,

Today I've faced the similar problem, but from the other end.
We are using Gson for testing rest services, so we tried gson 2.5 which is actually higher than 2.3.1 used by serenity in reporting.

With Gson 2.5 serenity sometimes fails to aggregate reports for the scenarios where example tables are used.
The reason is in the difference how different libraries generate json report outcomes.
For example (it's just a part of the test outcome) with gson 2.3.1 related json part looks like:
 "dataTable":{  
      "headers":[  
         "storeNumber"
      ],
      "rows":[  
         {  
            "values":[  
               "966"
            ],
            "result":"SUCCESS"
         }
      ],
      "predefinedRows":true,
      "currentRow":{  
         "value":0
      },
      "dataSetDescriptors":[  
         {  
            "startRow":0,
            "rowCount":0
         }
      ]
   },

Where with 2.5 it is generated like:
 "dataTable":{  
      "headers":[  
         "storeNumber"
      ],
      "rows":[  
         {  
            "values":[  
               "966"
            ],
            "result":"SUCCESS"
         }
      ],
      "predefinedRows":true,
      "currentRow":0,                         // here is the difference. Current row is no more the object
      "dataSetDescriptors":[  
         {  
            "startRow":0,
            "rowCount":0
         }
      ]
   },

Later it turns that reports aggregator fails on these scenarios, because expecting json object for the currentRow it receives a number.

I hope this info will be useful.

Best regards,
Dmytro Grablov
Reply all
Reply to author
Forward
0 new messages