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

Respect headless mode instead of enforcing it #137

Merged
merged 1 commit into from Aug 20, 2014
Merged

Respect headless mode instead of enforcing it #137

merged 1 commit into from Aug 20, 2014

Conversation

sergei-ivanov
Copy link
Contributor

We have a mix of vanilla unit tests, TestFX-3.2 based tests and some legacy hand-crafted JavaFX tests in the project. Our main CI build is running on a Linux server, where we have not got a graphic environment, and our target JavaFX platform is Windows anyway. We tried to segregate unit tests that could be run in a headless mode from the JavaFX tests, but that proved to be a challenge. I know there is a @category(TestFX.class) available, but category activation/deactivation is rather clumsily implemented in Junit and Maven, and also it does not play well with custom JUnit Runners. We ended up improving one of our custom Runners to automatically mark all JavaFX tests as "ignored" in headless mode, but it would be good if TestFX looked after it itself. Also, the current forcing off of headless mode is also rather non-obvious and deprives us of control during build time.

hastebrot added a commit that referenced this pull request Aug 20, 2014
Respect headless mode instead of enforcing it
@hastebrot hastebrot merged commit 0d8eeb7 into TestFX:master Aug 20, 2014
@hastebrot
Copy link
Member

Thanks for the PR!

@hastebrot
Copy link
Member

I've refactored code related to this PR in #146. If isAwtEnvironmentHeadless() is true then it will throw a RuntimeException instead of silently returning. Please report if this interfers with your tests.

@sergei-ivanov
Copy link
Contributor Author

Well, that will be of no much good to us (see above). It would be much better if it continued to mark the tests as ignored in headless mode. If TestFX throws an exception, we'll need to find a way of optionally skipping those tests, and junit+surefire don't offer much flexibility there. I may revert to using a custom runner again, but I'd rather TestFX handled it itself.

@hastebrot
Copy link
Member

I understand. I'll revert this.

TODO: Test this change on OS X.

@sergei-ivanov
Copy link
Contributor Author

I took a look at the commit, and there had been a lot of work done there, which you would not want to revert and throw away! I think we need to edit it creatively and reintroduce the junit "assumption". Or perhaps you can come up with a better idea on how to suppress these tests easily when needed.

Thanks,

Sergei Ivanov

Tuesday, 21 October 2014 23:56 +0100 from Benjamin Gudehus notifications@github.com:
I understand. I'll revert this.
TODO: Test this change on OS X.

Reply to this email directly or view it on GitHub .

@hastebrot
Copy link
Member

First I would change that AwtRobotAdapter#robotCreate() will just return, if isAwtEnvironmentHeadless(). If this breaks test runs on OS X, we'll need some other ways, maybe something with assumeFalse that you mentioned.

There is also an upcoming PR, that will provide better integration into characteristics of JUnit. We'll be able to use Before and BeforeClass instead of GuiTest#getRootNode(). Maybe this would make the handling more flexible.

@hastebrot hastebrot mentioned this pull request Dec 2, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants