How to test a dialog/how to pass data to action for testing? Follow
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:
Sure i could pass the data via static variables, but this is ugly. Is there no better way?
Please sign in to leave a comment.
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.: