junit test runs OK locally and in jenkins but not in bamboo

I have 1 test case which is running OK locally (both in maven from console and directly from the IDE) and in our jenkins server.

But when we run it in Bamboo (we are migrating our builds to Bamboo) I am not getting the expected assertion result. The test expect a CommitException to be thrown for invalid input, eg negative amount.

The special thing with the test input causing the anomaly is that it is a negative value.

Code snippet is:

@SuppressWarnings("unused")
private static Object[] randomInvalidAmounts() {
    //The test parameters are shortened to the specific one causing the error.
    return $(new DkkAmount(-200.0));
}

@Test(expected = CommitException.class)
@Parameters(method = "randomInvalidAmounts")
public void ERROR_WHEN_FIELD_INPUT_FOR_VAULT50_IS_NOT_VALID(DkkAmount amount)
        throws PageIntializationFailedException,
        ServiceException, ResourceException, CommitException {
    //Some init methods to mock and get some private members
    validateAndCreatePage();

    getModelAndViewValues();

    view.getVault50().setValue(amount);

    //This is the method that actually fires up the flow that should cause the CommitException.
    ((FieldGroup) ReflectionTestUtils.getField(presenter, "fieldGroup")).commit();
}

Any clue on what can be causing the error?

Additional Info Locally and in Bamboo, maven 3 is used (3.0.4 / 3.0.3) and using JDK 1.7. In Jenkins Maven 2 is used but is also using JDK 1.7.

When it fails in bamboo, the log shown is:

[0] -200.0 DKK (ERROR_WHEN_FIELD_INPUT_FOR_VAULT1_IS_NOT_VALID)(com.package.TestClass) Time elapsed: 0.025 sec <<< FAILURE! build 24-Mar-2015 16:31:49 java.lang.AssertionError: Expected exception: com.vaadin.data.fieldgroup.FieldGroup$CommitException build 24-Mar-2015 16:31:49 at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:32) build 24-Mar-2015 16:31:49 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) build 24-Mar-2015 16:31:49 at junitparams.internal.ParameterisedTestMethodRunner.runMethodInvoker(ParameterisedTestMethodRunner.java:47) build 24-Mar-2015 16:31:49 at junitparams.internal.ParameterisedTestMethodRunner.runTestMethod(ParameterisedTestMethodRunner.java:40) build 24-Mar-2015 16:31:49 at junitparams.internal.ParameterisedTestClassRunner.runParameterisedTest(ParameterisedTestClassRunner.java:147) build 24-Mar-2015 16:31:49 at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:414) build 24-Mar-2015 16:31:49 at junitparams.JUnitParamsRunner.runChild(JUnitParamsRunner.java:385) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.run(ParentRunner.java:309) build 24-Mar-2015 16:31:49 at org.junit.runners.Suite.runChild(Suite.java:127) build 24-Mar-2015 16:31:49 at org.junit.runners.Suite.runChild(Suite.java:26) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) build 24-Mar-2015 16:31:49 at org.junit.runners.ParentRunner.run(ParentRunner.java:309) build 24-Mar-2015 16:31:49 at org.junit.runner.JUnitCore.run(JUnitCore.java:160) build 24-Mar-2015 16:31:49 at org.junit.runner.JUnitCore.run(JUnitCore.java:138) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) build 24-Mar-2015 16:31:49 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

链接地址: http://www.djcxy.com/p/63214.html

上一篇: 有效地使用Perforce工作区和Bamboo

下一篇: junit测试可以在本地和jenkins运行,但不能运行在竹子上