Cannot run tests successfully on fresh clone

64 views
Skip to first unread message

Ronald Paul

unread,
Aug 7, 2015, 5:41:20 PM8/7/15
to GWTP
I'm trying to make tests complete successfully after a clone & checkout in an empty directory.

$ git clone https://github.com/ArcBees/GWTP.git
$ git checkout tags/gwtp-1.4
$ git clean test

This fails with

Tests in error: 
  PlaceManagerImplTest.placeManagerRevealPlaceStandard » Provision Guice provisi...
  PlaceManagerImplTest.placeManagerRevealPlaceRedirectInPrepareFromRequestNoHistory » Provision
  PlaceManagerImplTest.placeManagerUserUpdateHistoryWhenRevealPlace » Provision ...
  PlaceManagerImplTest.placeManagerRevealPlaceRedirectInPrepareFromRequest » Provision
  GatekeeperTest.placeManagerRevealRequestPlaceWhenGatekeeperCanReveal » Provision
  GatekeeperTest.placeManagerRevealDefaultPlaceWhenGatekeeperCanNotReveal » Provision
  GatekeeperWithParamsTest.placeManagerRevealRequestPlaceWhenGatekeeperWithParamsCanReveal » Provision
  GatekeeperWithParamsTest.placeManagerRevealDefaultPlaceWhenGatekeeperWithParamsCanNotReveal » Provisio

which is caused by

Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code!  It cannot be called, for example, from server code.  If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
at com.google.gwt.core.shared.GWT.createImpl(GWT.java:77)
at com.google.gwt.core.shared.GWT.create(GWT.java:65)
at com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.<init>(PlaceManagerImpl.java:60)
at com.gwtplatform.mvp.client.proxy.PlaceManagerTestUtil.<init>(PlaceManagerTestUtil.java:38)

I'm aware that the tests run without problems on the CI-server (http://teamcity.arcbees.com/viewType.html?buildTypeId=GwtPlatformGwtp_IntegrationTests) but I cannot figure out why they fail locally. Am I doing something wrong?

- Ronald

Jean-Christophe Lariviere

unread,
Aug 10, 2015, 1:57:47 PM8/10/15
to GWTP
Did you change anything after the clone (git status to make sure everything is clean)? What's your maven and java version? What OS are you using? I tried on Windows, MacOS and Linux and passes on all 3.

Ronald Paul

unread,
Aug 11, 2015, 7:57:31 AM8/11/15
to GWTP
I did not change anything after the clone and indeed, git status shows everything is clean. After further investigation however, it is now clear it has something to do with my home directory under Ubuntu because it works fine under a guest account. Even if I copied over the local Maven repository from the "faulty" home directory. Maven and Java are installed system wide so they cannot be the culprit.

The next thing I want to try is to systematically clean up a copy of my user profile and see what's causing it. I'm rather curious because I really thought that nothing could go wrong with a fresh clone and an empty local maven repository. To be continued...

Ronald Paul

unread,
Aug 25, 2015, 4:59:52 AM8/25/15
to GWTP
I found the cause of my failing tests.

1. Some of the tests of GWTP are dependent on the order they run in. PlaceManagerImpl2Test must be tested before PlaceManagerImplTest for example.

2. The order Surefire executes tests in defaults to the order of the files in the filesystem. See http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#runOrder.

3. Files were ordered differently on the system on which the tests failed (this can be seen with ls -U)

In general, one can't rely on a specific order of files as returned by the filesystem. See http://serverfault.com/questions/406229/ensuring-a-repeatable-directory-ordering-in-linux for example.

Adding

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <runOrder>alphabetical</runOrder>
    </configuration>
</plugin>

to gwtp-core/gwtp-mvp-client/pom.xml solves this problem on the problematic machine. Change alphabetical to reversealphabetical and you'll see tests fail even on non-problematic machines. The best thing is to have tests isolated and not depend on each other but in the meantime I propose adding the above surefire-plugin configuration. I created an issue for this and a corresponding pull request: https://github.com/ArcBees/GWTP/issues/725

- Ronald
Reply all
Reply to author
Forward
0 new messages