Is there a way to simulate button presses / mouse clicks for testing purposes?
Hello-
I'm wondering if anyone has found out a good way to simulate button clicks or just generally input into Noesis Engine for automated testing purposes. Anyone have suggestions / pointers?
thanks,
sam
I'm wondering if anyone has found out a good way to simulate button clicks or just generally input into Noesis Engine for automated testing purposes. Anyone have suggestions / pointers?
thanks,
sam
Re: Is there a way to simulate button presses / mouse clicks for testing purposes?
Yes, NoesisView exposes the following methods to manually inject input:
- KeyDown
- KeyUp
- Char
- MouseMove
- MouseButtonDown
- MouseButtonUp
- MouseDoubleClick
- MouseWheel
- TouchMove
- TouchDown
- TouchUp
Re: Is there a way to simulate button presses / mouse clicks for testing purposes?
To add to Jesús answer. A pattern I have used in the past, to make finding and interacting with particular elements in the current view, is to create an attached property which registers the element in a static map using the element's Name as a key. You can then access this static map from your automation scripts, allowing you to find out if the element exists, and get it's position to interact with (e.g. using View::MouseButtonDown), or to assert that it's dependency properties are in the correct state.
In XAML the attached property would look something like this:
The attached property changed callback would add/remove the element from a static map.
And the ViewDebug class would have a static API, something like:
This setup only allows for one element per name, but you can bind a dynamic value to the element's name, such as adding a index to the end of a Name for items in a list.
If you want more information on this, please let me know.
In XAML the attached property would look something like this:
Code: Select all
<Button x:Name="helpButton" local:ViewDebug.Register="true" />And the ViewDebug class would have a static API, something like:
Code: Select all
ViewDebug::HasElement("helpButton");
const FrameworkElement* = ViewDebug::GetElement("helpButton");
If you want more information on this, please let me know.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests