Reputation: 111
We are developing a new WPF application that interacts with a server. The application sends a request to server and gets a response. The response is shown in different ways in different views (i.e. single model with multiple views).
Now we want to automate the testing of the WPF application. I have the following test-automation needs:
Please let me know how to achieve above using any of the Test automation tools.
Upvotes: 1
Views: 1397
Reputation: 622
This feature you described is called "Record and Playback". And as you already mentioned it is quite limited to simple UI interaction and can become difficult in maintaining.
As soon as your interaction logic gets more complex you will have to implement the main parts of your test case logic manually by using a more layered architecture. One possible architecture could have the following layers (some of the ideas here are taken from the book Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation)
The lowest layer would implement the access to the UI controls itself (for example by using one of the UI Test APIs you mentioned.)
Application driver layer which describes the functionalities of your application. Here you could have methods like LoginForm.LoginUser(userName,passWord)
. Internally this method could for example handle the complete user input, press all necessary buttons and even do some additional validation if needed (for example if the password has expired and must be retyped). The methods in this layer will access the different UI controls through the lower layer. In general this layer is an abstraction of your application under test.
Use case / Test case layer. Here you define the different test steps by calling your application layer.
So in your concrete case, you could have a class called ClientSoftware
in your Application Driver Layer and this class could have methods like ValidateUserInput
or SendRequestToServer
. These methods would then implement the necessary UI interaction to execute the desired behavior. In your test case itself you would then have to setup an instance of the ClientSoftware
and call the required methods to implement your test case.
Upvotes: 1