GWT Junit is failing after upgrade to 2.8.2 - junit

I have been using GWT 2.4 for one of my projects. Recently, I have upgraded the GWT version to 2.8.2 and the existing Junit is failing for no reason. Please help me troubleshoot the issue.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.769 sec
------------- Standard Error -----------------
Unknown argument: -standardsMode
Google Web Toolkit 2.8.2
------------- ---------------- ---------------
Testcase: testOne took 0.537 sec
Caused an ERROR Error processing shell arguments
com.google.gwt.junit.JUnitFatalLaunchException: Error processing shell arguments
at com.google.gwt.junit.JUnitShell.getUnitTestShell(JUnitShell.java:696)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:682)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:421)
at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:247)
[exec] -test.dev:
[exec] [mkdir] Created dir: C:\gitrepos\Python\petroApps\isdBuild\JDK_1.8\isdApps\topaz\gui\impl\web\client\gwt\pres\reports\htmlunit.dev
[exec] [junit] WARNING: multiple versions of ant detected in path for junit
[exec] [junit] jar:file:/C:/gitrepos/Python/petroApps/isdMWare/buildTools/apache/ant/V1.9.6/lib/ant.jar!/org/apache/tools/ant/Project.class
[exec] [junit] and jar:file:/C:/gitrepos/Python/petroApps/isdMWare/java/apis/google/gwt/V2.8.2/lib/gwt-dev.jar!/org/apache/tools/ant/Project.class
[exec] [junit] Running com.verifone.isd.topaz.gui.impl.web.client.gwt.pres.POSPresTestSuite
[exec] [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.769 sec
[exec] BUILD FAILED

In GWT 2.7.0 (RC1) the -standardsMode has been removed.
"Removed flags: -standardsMode, -nostandardsMode, -quirksMode. (GWTTestCase tests are always run in an HTML page in standards mode.)"
See: GWT Release Notes
To solve your problem, remove the argument.

Related

ant junit not running single method with test target

I've got a build system running Ant Version 1.10.6
The macrodef that I've summarised below is constructed to switch on "run.multi" either it runs a single test method or it does something else (which i've not included as its not relevant).
The issue I have here is that I cannot get it to run just the one method 'test.method' - I've turned the verbose on and can see it all going in and being set correctly, but it runs all the methods regardless!
<echo level="info" message="Single method=#{test.method}" />
<junit printsummary="on" showoutput="true" fork="yes" forkmode="once">
<assertions>
<enable/>
</assertions>
<test unless="${run.multi}"
name="#{test.single}"
methods="#{test.method}"
haltonfailure="no"
haltonerror="no">
<formatter type="plain" usefile="false"/>
</test>
And here is a portion of the output:
[echo] Single method=testSimple
[junit] Running com.test.util.TheTestToRun
[junit] Testsuite: com.test.util.TheTestToRun
[junit] Running on Java 9.0.4
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.473 sec
The reason that this was happening is either a bug or a feature in ant - around the fork option on the junit section. set 'fork=no' and the issue goes away:
<junit printsummary="on" showoutput="true" fork="no" forkmode="once">
<test unless="${run.multi}"
name="#{test.single}"
methods="#{test.method}"
haltonfailure="no"
haltonerror="no">
<formatter type="plain" usefile="false"/>
</test>
A portion of the output:
[junit] Running com.test.util.TheTestToRun
[junit] Testsuite: com.test.util.TheTestToRun
[junit] Running on Java 9.0.4
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.12 sec

Build failed with an exception Execution failed for task ':app:processDebugResources'. >

Launching lib\main.dart on Snap 4G2 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Android resource linking failed
Output: error: resource android:attr/fontVariationSettings not found.
C:\Users\rajesh.yadav\AndroidStudioProjects\microfinance\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:337: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\rajesh.yadav.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\333594338724db9cac843ec5e02726f3\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\rajesh.yadav\AppData\Local\Android\sdk\platforms\android-27\android.jar\
--manifest\
C:\Users\rajesh.yadav\AndroidStudioProjects\microfinance\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\rajesh.yadav\AndroidStudioProjects\microfinance\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
C:\Users\rajesh.yadav\AndroidStudioProjects\microfinance\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
BUILD FAILED in 2m 25s
Finished with error: Gradle task assembleDebug failed with exit code 1
You're using compile SDK version 27 (that's why android-27\android.jar is passed to AAPT2), but you or one of your dependencies is using resources from SDK version 28 (i.e. fontVariationSettings and ttcIndex). Update your compile SDK version in your build.gradle file to version 28.

Gradle build / test failed - kryo.KryoException: Buffer overflow

While running a Gradle build, tests are failing.
PS:
1. Gradle is using the correct JDK (1.6) to build.
2. I tried this with JDK 1.7, same error comes there as well.
3. I don't see this error when I build it locally (with JDK 1.6) on a linux/windows
4. machine but one of the machine is giving me this error.
My ?s
1. What can be done to fix the com.esotericsoftware.kryo.KryoException: Buffer overflow error.
2. Why Gradle process failed, even when test section in build.gradle says:
test {
ignoreFailures=true
//more code here for test section...
//..
}
Any hints/help appreciated. Error snapshot is shown below:
:test
Unexpected exception thrown.
org.gradle.messaging.remote.internal.MessageIOException: Could not read message from '/0:0:0:0:0:0:0:1:53371'.
at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:88)
at org.gradle.messaging.remote.internal.hub.MessageHub$ConnectionReceive.run(MessageHub.java:230)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.esotericsoftware.kryo.KryoException: Buffer underflow.
at com.esotericsoftware.kryo.io.Input.require(Input.java:162)
at com.esotericsoftware.kryo.io.Input.readByte(Input.java:255)
at org.gradle.messaging.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:64)
at org.gradle.messaging.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:53)
at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:83)
... 5 more
> Building > :test > 84 tests completed
:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> Process 'Gradle Worker 6' finished with non-zero exit value 139
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
It's an internal error. Best chance is to try with the latest Gradle version.

Running all tests from a #Category using Maven

I want to run only a subset of my unit tests, the ones defined by a specific #Category.
So I read several SO questions, such as this one (which is exactly what I am looking for), and also this one.
The solution of my problem seems to be provided by the ClasspathSuite project. So I started to write the NewTest and OldTest interfaces that will define my test categories. Then, I created the AllTests suite:
#RunWith(ClasspathSuite.class)
public class AllTests { }
After that, I created a AllNewTests suite:
#RunWith(Categories.class)
#IncludeCategory(NewTest.class)
#SuiteClasses( { AllTests.class })
public class AllNewTests { }
Finally, I create two JUnit classes, one per category:
#Category(NewTest.class)
public class SomeNewTests {
// some tests...
}
#Category(OldTest.class)
public class SomeOldTests {
// some tests...
}
Now, if I run AllTests, Eclipse launches all the tests of my project, while Maven fails as no test are found:
mvn test -Dtest=AllTests
...
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running my.company.AllTests
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.093 sec
There are no tests to run.
If I run AllNewTests (which is the correct thing to do, right?), in Eclipse everything is fine (i.e. it only run the tests annoted with #Category(NewTest.class)) but Maven returns an error:
mvn test -Dtest=AllNewTests
...
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running my.company.AllNewTests
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.125 sec <<< FAILURE!
Results :
Tests in error:
initializationError(my.company.AllNewTests)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
The exception thrown is the following:
org.junit.runner.manipulation.NoTestsRemainException
at org.junit.runners.ParentRunner.filter(ParentRunner.java:256)
at org.junit.experimental.categories.Categories.<init>(Categories.java:142)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:35)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:33)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:70)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
My question is what I did wrong?
Technical details: Java 6, Maven 3.0.2, JUnit 4.8.1, Surefire plugin 2.7.1, cpsuite-1.2.5
As an update: as of Surefire plugin v2.11, JUnit 4.8+ style categories are now supported.
The release notes for Surefire v2.11 mention the new feature. The surefire:test goal can is configured using groups.
I have solved my problem by creating my own JUnit Runner, that extends the Suite.
The idea is close to the principle by the Classpath Suite project, i.e. looking for the classes existing in the classpath, and keep only the ones that are annotated with a given annotation (#NewTest for example).
If you are interested, you can read the full story on my blog.
After reading some blog posts and stackoverflow questions, I finally was able to make this work with the surefire plugin, as user1034382 answered. In my case with version 2.17 of maven-surefire-plugin.
Just to add my two cents, the more up-to-date explanation can be found here:
Using JUnit Categories to group tests
But you may run with the following surefire plugin problem:
[ERROR] java.lang.RuntimeException: Unable to load category:
That can be fixed with this other stackoverflow question/answer:
Where should I put interface class for Junit #Category?
My answer is just to gather all these info here and avoid googling/reading to many diferent solutions. Al least, this worked to me.

Junit with Embedded Glassfish fails - JMS Resource Adapter should be EMBEDDED

I'm trying to test a session bean (NetBeans 6.8, Glassfish V3). Unfortunately, the embedded glassfish is unable to start properly, as it tries to connect to a remote JMS Provider (at localhost:7676):
$ ant test
...
[junit] Mar 23, 2010 12:13:51 PM com.sun.messaging.jms.ra.ResourceAdapter start
[junit] INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting: REMOTE
[junit] Mar 23, 2010 12:13:51 PM com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
[junit] WARNING: [C4003]: Error occurred on connection creation [localhost:7676]. - cause: java.net.ConnectException: Connection refused
The error is in itself correct, as no (other) JMS provider is running. I was expecting the embedded glassfish to start the JMS provider in EMBEDDED mode.
My test uses javax.ejb.embeddable.EJBContainer :
#BeforeClass
public static void initContainer() throws Exception {
ec = EJBContainer.createEJBContainer();
ctx = ec.getContext();
}
When I start glassfish normally, it's fine:
$ bin/asadmin get server.jms-service.type
server.jms-service.type=EMBEDDED
How can I get my junit tests to use an embedded glassfish with an EMBEDDED JMS Provider?
Ok, I downloaded an official glassfish build (v3.0.1) from here, and now it's starting the JMS Provider EMBEDDED as expected.