Take a look at this project: http://code.msdn.microsoft.com/wpapps/Simple-UI-Test-for-Windows-dc0573a9
Shows how to simulate a button click and retrieve the value of another item.
I have not tried this myself, but the principle is as follows:
Create a separate test project
In your test init code, create an instance of the page from your application project:
public void Init() { mp1 = new PhoneApp1.MainPage(); }
Your tests find elements by linking to this instance page:
[TestMethod] [Description("Test1: Clicking button passes")] public void PassedTest() { var b = mp1.FindName("button1") as Button; ButtonAutomationPeer peer = new ButtonAutomationPeer(b); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); Assert.AreEqual((mp1.FindName("AppTitle") as TextBlock).Text.ToString(), "Results"); }
siger source share