How to test a dialog/how to pass data to action for testing?

Answered

Hi,

My action needs some external data, which the user will providevia a dialog: Action -> Open Dialog -> Compute

Apparently writing a test for this is not possible after some google search. (also checking the code, the "headless dialog" has getWindow() == null which throws when i do dialog.show();

The question is now, how do i test something like this? I cannot pass in any data to an action since it is getting executed by passing in a string:

myFixture.performEditorAction(ACTION_ID)

Sure i could pass the data via static variables, but this is ugly. Is there no better way?

0
1 comment

Hi,

I don't see a better way than passing the data from the test and using ApplicationManager.getApplication().isUnitTestMode() to access actual data from dialog or provided by the test, depending on the context. This is how it is done in the platform code, e.g.:

0

Please sign in to leave a comment.