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: JavaFX Toolkit state is not cleaned up after test class #1387

Closed
Katharsas opened this issue Aug 12, 2019 · 3 comments
Closed

Tests: JavaFX Toolkit state is not cleaned up after test class #1387

Katharsas opened this issue Aug 12, 2019 · 3 comments
Labels

Comments

@Katharsas
Copy link
Collaborator

How to reproduce:

  • Create new package mypackage with these 2 new test classes:
public class A extends AbstractPlainJavaFxTest {
  @Test
  public void test() {
    assertTrue(true);
    WaitForAsyncUtils.waitForFxEvents();
  }
}
public class B {
  @Test
  public void test() {
    assertTrue(true);
    WaitForAsyncUtils.waitForFxEvents();
  }
}
  • Run entire package, for example gradle test --tests com.faforever.client.mypackage.*
    -> Both tests will succeed
  • Run ONLY test class B
    -> Test will fail because it is missing parent class AbstractPlainJavaFxTest for JavaFX toolkit initialization

AbstractPlainJavaFxTest is "leaking" the toolkit initialization into other classes.

@Katharsas Katharsas changed the title Tests: JavaFX Toolkit state is not cleanup after test class Tests: JavaFX Toolkit state is not cleaned up after test class Aug 12, 2019
@1-alex98
Copy link
Member

Hmm no idea

@Katharsas
Copy link
Collaborator Author

There is a chance maybe that its fixed if we change to a new version of JavaFX / TextFX. Other than that we would have to look into TextFx ourselves.

@Sheikah45
Copy link
Member

I believe this issue is because the application persists for the entire execution. JavaFx does not allow you to have two applications running at once as you cannot call the launch method twice in the same session. TestFx sets the application so that it won't close when all the windows are closed so that it continues to run for the entire session.

I do not believe there is a way to get around this behavior.

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

No branches or pull requests

3 participants