Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception type not shown in the report #154

Closed
adrian-herscu opened this issue Oct 28, 2015 · 0 comments
Closed

exception type not shown in the report #154

adrian-herscu opened this issue Oct 28, 2015 · 0 comments

Comments

@adrian-herscu
Copy link

Given JGiven version 0.9.3
And a test failing with an exception or on timeout
When the test is executed
Then the report does not contain the exception type (that is the failure reason)

Example:

@Test(timeOut = 1000)
public void shouldFailOnTimeout() throws Exception {
    when().$("sleeping too much", //$NON-NLS-1$
            new StepFunction<When<Any, ?>>() {
                @Override
                public void apply(final When<Any, ?> stage)
                        throws Exception {
                    Thread.sleep(2000);
                }
            });
}

Is reported as follows:

Generic Should fail on timeout  FAILED (22ms)
FAILED:
com.tngtech.jgiven.base.ScenarioTestBase.when(ScenarioTestBase.java:30)
com.ebay.jgiven.commons.scenarios.GenericTest.shouldFailOnTimeout(GenericTest.java:77)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:196)
com.ebay.qa.jgiven.commons.utils.UnitilsScenarioTest.run(UnitilsScenarioTest.java:107)
org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:208)
org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:56)
org.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:44)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
java.util.concurrent.FutureTask.run(FutureTask.java:262)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)

Note the "FAILED:" line. It does not contain the reason.

And another example:

@Test
public void shouldFailWithUnexpectedRuntimeException() throws Exception {
    then().$("should throw a runtime exception", //$NON-NLS-1$
            new StepFunction<Then<Any, ?>>() {
                @Override
                public void apply(final Then<Any, ?> stage)
                        throws Exception {
                    throw new RuntimeException();
                }
            });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants