Skip to content

Run tests with isolated context#20

Open
abhinayagarwal wants to merge 2 commits intogluonhq:masterfrom
abhinayagarwal:isolate
Open

Run tests with isolated context#20
abhinayagarwal wants to merge 2 commits intogluonhq:masterfrom
abhinayagarwal:isolate

Conversation

@abhinayagarwal
Copy link
Copy Markdown

This is a WIP PR

@abhinayagarwal
Copy link
Copy Markdown
Author

Findings from TestFX:

  • Same Stage is used in every Test. This instance comes from PrimaryStageApplication
  • PrimaryStageApplication.class is also finally passed to Application.launch method.
  • In the tests, instances are as follows:
    • Always same: org.testfx.api.FxToolkitContext, javafx.stage.Stage
    • Always different: org.testfx.toolkit.impl.ToolkitServiceImpl, org.testfx.framework.junit5.ApplicationAdapter
  • ToolkitServiceImpl.setupApplication creates a new instance of application (ApplicationAdapter) but the stage is created from Supplier stageSupplier and returns the following from FxToolkitContext:
private final CompletableFuture<Stage> primaryStageFuture = * PrimaryStageApplication.PRIMARY_STAGE_FUTURE; 
  • GluonFX: Since AppManager is singleton, its instance is also same across all tests, which affects how we show and hide layers across different tests
    With IsolateContext , we have different instances of FxToolkitContext between test classes but the instance of Stage and AppManager still remains the same, not giving the effect which we initially wanted.

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.

1 participant