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

Tests with timeout are not skipped by Governor #24

Open
jpechane opened this issue May 13, 2016 · 10 comments
Open

Tests with timeout are not skipped by Governor #24

jpechane opened this issue May 13, 2016 · 10 comments

Comments

@jpechane
Copy link

Modify ITJiraGovernorTest to have method

    @Test(timeout = 60000)
    @Jira("ARQ-831")
    public void willBeSkippedBecauseUnresolved()
    {
        Assert.assertTrue(false);
    }

The test then fails

@smiklosovic
Copy link
Member

does it fail just when that timeout is there or if there is any other value in it? e.g. expected exception or a message

@jpechane
Copy link
Author

The problem is that the test is executed although it should not be.
The ExecutionDecision is correctly evaluated but it seems that when the
timeout is present it is added to the list of executions again.

On Fri, May 13, 2016 at 9:45 AM, Štefan Miklošovič <notifications@github.com

wrote:

does it fail just when that timeout is there or if there is any other
value in it? e.g. expected exception or a message


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#24 (comment)

Jiri Pechanec
QA Engineer
Red Hat
Brno, Czech Republic

@jpechane
Copy link
Author

It seems it is timeout specific. The other paramter supperted by @test is
expected exception and using this one it work correctly.

On Fri, May 13, 2016 at 9:59 AM, Štefan Miklošovič <notifications@github.com

wrote:

yeah i got it, the question is whether it fails only in case there is
timeout if there is any other value in test annotation set


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#24 (comment)

Jiri Pechanec
QA Engineer
Red Hat
Brno, Czech Republic

@smiklosovic
Copy link
Member

could you post the stacktrace please?

@jpechane
Copy link
Author

diff --git a/jira/src/test/java/org/arquillian/extension/governor/jira/ITJiraGovernorTest.java b/jira/src/test/java/org/arquillian/extension/governor/jira/ITJiraGovernorTest.java
index ee2bd3e..13c2cf5 100644
--- a/jira/src/test/java/org/arquillian/extension/governor/jira/ITJiraGovernorTest.java
+++ b/jira/src/test/java/org/arquillian/extension/governor/jira/ITJiraGovernorTest.java
@@ -34,7 +34,7 @@ public class ITJiraGovernorTest
         Assert.assertTrue(true);
     }

-    @Test
+    @Test(timeout = 30000)^M
     @Jira("ARQ-831")
     public void willBeSkippedBecauseUnresolved()
     {

maven log is attached
mvn.log.zip

@smiklosovic
Copy link
Member

@basovnik could you look at this issue, please?

@basovnik
Copy link
Contributor

The problem is on this line: https://github.com/arquillian/arquillian-core/blob/master/test/impl-base/src/main/java/org/jboss/arquillian/test/impl/EventTestRunnerAdaptor.java#L170
Variable serviceLoader is null. From some reason no context is active and therefore no TestExecutionDecider is resolved.

If you try to execute this code before mentioned line then it will work. But I have not investigated yet why the ApplicationContextImpl is inactive.

if (!manager.getContext(ApplicationContextImpl.class).isActive()) {
    manager.getContext(ApplicationContextImpl.class).activate();
}

@basovnik
Copy link
Contributor

basovnik commented Aug 19, 2016

I found one possible fix:
https://github.com/arquillian/arquillian-core/blob/master/core/spi/src/main/java/org/jboss/arquillian/core/spi/context/AbstractContext.java#L38
We can change ThreadLocal to InheritableThreadLocal and it will work. When we use timeout attribute then new thread is started...
https://github.com/junit-team/junit4/blob/r4.12/src/main/java/org/junit/internal/runners/statements/FailOnTimeout.java#L125

@smiklosovic Shall I create pull request to arquillian-core with my fix or do you have some other idea?

@basovnik
Copy link
Contributor

basovnik commented Aug 19, 2016

The solution will be not so easy... https://issues.jboss.org/browse/ARQ-1071

@basovnik
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants