Академический Документы
Профессиональный Документы
Культура Документы
Contents
About this Document....................................................................................... 1 Ranorex Installation and Setup ...................................................................... 1 Tutorial Ranorex ............................................................................................. 2
- 1-
Tutorial Ranorex
Step 1 Setup environment
Create a new C# Console Application project. In this tutorial, we need add two references into the project: nunit.framework and RanorexNet 5 . Add a class: GUITest into the project.
each project. 5 In browser tab, you can find the RanorexNet.dll file in the installation location. - 2-
- 3-
/// Close the calc.exe /// </summary> [TearDown] public void tearDown() { _testee.Close(); }
- 4-
- 5-
homework: /// <summary> /// Test the mouse pressed and relased function, much lower level event /// </summary> [Test] public void testScript2() { // Pre-condition: three buttons and one text box found Point oneButton = new Point(75, 190); Point addButton = new Point(190, 220); Point equalButton = new Point(230, 220); Ranorex.Control display = _testee.FindClassName("Edit"); // Press and release at "1" button: the same as clicking on "1" button pressLeftButtonAt(oneButton.X, oneButton.Y); releaseLeftButtonAt(oneButton.X, oneButton.Y); // Click (press and release) at "+" button pressLeftButtonAt(addButton.X, addButton.Y); releaseLeftButtonAt(addButton.X, addButton.Y); // Click "1" again pressLeftButtonAt(oneButton.X, oneButton.Y); releaseLeftButtonAt(oneButton.X, oneButton.Y); // Press at "=" button and release at "1" button: nothing happen pressLeftButtonAt(equalButton.X, equalButton.Y); releaseLeftButtonAt(oneButton.X, oneButton.Y); // Press at "+" button and release at "1" button: nothing happen pressLeftButtonAt(equalButton.X, equalButton.Y); releaseLeftButtonAt(equalButton.X, equalButton.Y); Assert.AreEqual("2. ", display.Text); }
- 6-
Figure 2 NUnit activate simple calculator through Ranorex and assert the value.
End Tutorial
- 7-