testup-2 icon indicating copy to clipboard operation
testup-2 copied to clipboard

How to testing async program?

Open linying1991 opened this issue 3 years ago • 4 comments

The following content is translated by machine from DeepL, please forgive if the language is not correct

There are many asynchronous methods in SketchUp, such as UI::start_timer, HtmlDialog#add_action_callback, we sometimes encapsulate these asynchronous methods (the result of encapsulation is naturally asynchronous), how do we unit test these? Thanks!

linying1991 avatar Nov 10 '21 08:11 linying1991

Hm... I'm not sure. I've not setup any tests for HtmlDialog callbacks or timers. TestUp is just a wrapper on top of Minitest, and I don't think Minitest (or any other typical unit test framework) is well suited for this kind of testing.

This sounds like you are testing UI interaction. In which case you might want to look at other tools that specialize on testing UI (simulating mouse events and keyboard events.)

thomthom avatar Nov 10 '21 10:11 thomthom

Indeed, I searched quite a few keywords and couldn't find a way to test asynchronously. I'll look for another way. Thanks for the reply!

linying1991 avatar Nov 11 '21 03:11 linying1991

I asked around internally, we use Squish for UI test automation.

thomthom avatar Nov 15 '21 14:11 thomthom

The following content is translated by machine from DeepL, please forgive if the language is not correct

Great, I'll look into it, thanks a lot~

linying1991 avatar Nov 16 '21 00:11 linying1991