Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit testing workshop Jiří Pokorný Application Organization of examples in real App: Application boundaries GUI Controls Drag Drop System.

Similar presentations


Presentation on theme: "Unit testing workshop Jiří Pokorný Application Organization of examples in real App: Application boundaries GUI Controls Drag Drop System."— Presentation transcript:

1 Unit testing workshop Jiří Pokorný jirka@wug.cz

2 Application Organization of examples in real App: Application boundaries GUI Controls Drag Drop System FileWatch DateTime

3 Example 1 – Fighting with Time Testability problem: Do you like „public static“? Do you like SingleTon pattern? How to test usage of DateTime.Now? Possible solution: provide custom service to be able to replace the SingleTon Implement Reset method to be able restore the default state

4 Example 2 – How to test UI Testability problem: Need to simulate UI events (DragDrop, mouse over etc.) Possible solution: Use Hubble telescope classes Simulate the UI using custom methods Keep as much as minimum code in the User Control classes

5 Example 3 - How to serialize parallel job Testability problem: You depend on external system, which is not under your control You need to control proper time, where events are fired Possible solution: Provide custom service to isolate the application boundaries Use ManualResetEvent to shedule the parallel work Block the test thread Test is waiting till the parallel job is done Assert Setup test Test thread Job thread Do the reload in parallel Release the test thread


Download ppt "Unit testing workshop Jiří Pokorný Application Organization of examples in real App: Application boundaries GUI Controls Drag Drop System."

Similar presentations


Ads by Google