Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.86 KB

File metadata and controls

36 lines (26 loc) · 1.86 KB

UITestsExample

Example how to do UI testing for WPF and WinForms applications.

Tests overview

ExampleApplication.Logic

Here is bussiness logic of the application. It is used for both WPF and also WinForms app version.

ExampleApplication.WinForms

The view layer for WinForms.

ExampleApplication.Wpf

The view layer for WPF.

ExampleApplication.UiTests.AppModel

For UI testing we need some interface to interact with the application. The interface models the applications UI from the user point of view. The interaction is made using TestStack.White.

ExampleApplication.Resources

Besides some usual resources there is a folder named AutomationIdentifiers. In this folder should be UIAutomation identifiers that are used in both the application and the application model to identify the controls.

ExampleApplication.ScreenRecorder

Useful app to record the screen during the test.

ExampleApplication.UiTests

Here are the actual tests. Tests are written as XUnit tests using ExampleApplication.UiTests.AppModel to perform the UI interaction. One class per each test scenario.

Each test class inherits the BaseTest class. Each test runs a new application instance and starts recording. At the end of the test the recording is stopped. If the test succeeds the screen video is removed. If the test fails a screenshot is taken prior the application shutdown. Screenshots and videos are named according to the test.

To switch between WPF and WinForms platforms set a desired value to the Platform constant in the BaseTest class.