Tutorial 3 - Ranorex V2
Tutorial 3 - Ranorex V2
Tutorial 3 - Ranorex V2
Spirit Du Ver. 1.5, 22nd November, 2007 Ver. 2.3, 29th October, 2008
Contents
About this Document....................................................................................... 1 Tutorial Ranorex ............................................................................................. 2 Appendix A Install Ranorex .......................................................................... 6 Appendix B Activate Program .................................................................... 6 Appendix C Modal Dialog ........................................................................... 7 Appendix D Menu Item ................................................................................ 9
Tutorial Ranorex
Step 1 Setup environment
Create a new C# Test project. In this tutorial, we need add an additional reference into the project: RanorexNet. Because the reference is not in the default .Net library location, change the tab from .Net to Browse, and find the RanorexNet.dll in C:\Program Files\Ranorex-1.1.0\Bin\Net2.0.
just like a user is using the computer. Design your actions sequence for practice if you have time after finishing the tutorial, or leave the practice in your homework.
/// <summary> /// Script: 1 + 12 - 3 - 4 * 5 / 6 = /// </summary> public void RunScript() { ClickButton("1"); ClickButton("+"); ClickButton("1"); ClickButton("2"); ClickButton("-"); ClickButton("3"); ClickButton("-"); ClickButton("4"); ClickButton("*"); ClickButton("5"); ClickButton("/"); ClickButton("6"); ClickButton("="); }
Any event generated by mouse moving or clicking will cause the test failed.
-- The End --
// Wait 2000ms for the calculator to wake up _form = Ranorex.Application.FindFormTitle("Calculator", SearchMatchMode.MatchExact, true, 5000); }
[TestMethod] public void TestAboutDialogByESC() { Thread runner = new Thread(new ThreadStart(delegate () { Form dialog = FindAboutDialog("About the Calculator"); Assert.IsNotNull(dialog); dialog.SendKeys("{ESC}"); })); runner.Start(); ClickMenuItem("MainMenu", "Help", "About"); }