SlideShare a Scribd company logo
Ranorex Tutorial
                                                                                      Spirit Du
                                                                    March 27th, 2007 Ver. 1.1.4


Contents 
About this Document....................................................................................... 1
Ranorex Installation and Setup ...................................................................... 1
Tutorial – Test SimpleCalculator using Ranorex............................................ 2


About this Document
     NUnit framework is very useful for testing a small piece of program
without GUI. But how do we test the correctness of GUI interactions? This
document introduces a tool Ranorex, which can “simulate” user
interactions and perform assertions. We will integrate this tool with the
NUnit framework to test the SimpleCalculator developed in your
homework.


Ranorex Installation and Setup
     Ranorex is a Windows GUI test and automation Library for C++,
Python, and the .Net languages. The user (e.g. the software tester)
should use the functionalities of the programming languages like Python
or C# as a base, and enlarge it with the GUI automation functionality of
Ranorex. Before starting this tutorial, it needs to get the Ranorex installer
form the URL:
     http://www.ranorex.com/download/
     Download the free edition and execute the installer with default
settings. After installation 1 , copy the file: RanorexCore.dll 2 from [Ranorex
Location] 3 BinNet2.0 and then paste to [Windows] 4 system32 as
global library cache 5 .

1  You don’t have to install the Ranorex. But you do need to do this set up step by
yourself because there is no such file in system32 folder in the computer lab.
2 Any project developed with Ranorex will run with RanorexCore.dll
3 The default location is C:Program FilesRanorex-1.1.0
4 The default location for Windows XP/2000 is C:WinNT
5 It will facilitate the development without denoting the location of RanorexCore.dll in

each project.

Windows Programming Tutorial – Ranorex                                                                 - 1-
Tutorial – Test SimpleCalculator using Ranorex
Step1.Open the existing Visual Studio Solution which contains your
      calculator.
         As shown in Figure 1, SimpleCalculator is the project developed in the previous
         homework which is contained in Windows Programming solution.




                 Figure 1 The Solution contains SimpleCalculator project


Step2.Add a class: GUITester into existing project.




                           Figure 2 Add a new class: GUITester


Step3.Add RanorexNet references 6




                            Figure 3 Add Ranorex reference


Step4.Add using declarations
         Open the GUITester.cs and add the following two declarations.


6   Default location: C:Program FilesRanorex-1.1.0BinNet2.0

Windows Programming Tutorial – Ranorex                                             - 2-
using NUnit.Framework;
    using Ranorex;

Step5.Declare a test fixture and a member data
        This is similar to the previous tutorial; add a test fixture attribute before the class
        declaration. Then, change the visibility to public and add a new field: _testee.

    namespace SimpleCalculatorGUITests {
        [TestFixture]
        public class GUITester {
              Form _testee;
        }
    }



Step6.Use the Ranorex to activate SimpleCalculator in setup method 7 .
        Add a member method, setup(), into GUITester class. Note that the [SetUp]
        attribute and the value of application string must be the same as the title
        (name of the .exe file) of your simple calculator.

    [SetUp]
    public void setUp() {
        // Project Name or executable file name
        string application = "SimpleCalculator";
        Application.SleepTime = 50;
        Mouse.MoveTime = 10;
        Application.Start(application);
        _testee = Application.FindFormTitle(application,
                       SearchMatchMode.MatchExact, true, 2000);
        Assert.IsTrue(_testee != null);
    }



Step7.Add a tear down member method to close the activated form
        In the previous tutorial, it is not necessary to declare the tear down method,
        because garbage collection is automatically performed. But in this tutorial, a
        tear down method is required to close the application (form) activated by the
        set up method.


7The assertion failed in setup() that will skip the runTest() and then call teardown()
directly.

Windows Programming Tutorial – Ranorex                                                    - 3-
[TearDown]
    public void tearDown() {
        _testee.Close();
    }

Step8.Add a member method to control the mouse 8
        Ranorex offers several ways to find 9 GUI widgets (controls) on the screen and
        also offers the control of mouse and keyboard. Now add a member method as
        below which can move the mouse pointer to the target control and then click
        on it.

    public void moveToControlAndClick(Form form, string text) {
        Assert.IsTrue(form != null);
        Control control = form.FindChildText(text);
        Assert.IsTrue(control != null);
        Mouse.MoveToControl(control);
        Mouse.ClickControl(control);
    }



Step9.Write a test script
        Now we can write test cases by using the above moveToControlAndClick
        method. Add a new member method with the following codes to
        automatically perform the user’s actions 10 : 1+12-3-4*5/6=




8     The same as the setUp() method, if there is any assertion failed in the
moveToControlAndClick() method, the NUnit will skip the remaining codes and then
call tearDown() directly.
9   Ranorex provides several methods: by object name or id, text and class name. For
more information, please refer to the Ranorex document.
10 Design your actions sequence for practice if you have more time after finishing the

tutorial

Windows Programming Tutorial – Ranorex                                            - 4-
public void runScripts() {
      moveToControlAndClick(_testee, "1");
      moveToControlAndClick(_testee, "+");
      moveToControlAndClick(_testee, "1");
      moveToControlAndClick(_testee, "2");
      moveToControlAndClick(_testee, "-");
      moveToControlAndClick(_testee, "3");
      moveToControlAndClick(_testee, "-");
      moveToControlAndClick(_testee, "4");
      moveToControlAndClick(_testee, "*");
      moveToControlAndClick(_testee, "5");
      moveToControlAndClick(_testee, "/");
      moveToControlAndClick(_testee, "6");
      moveToControlAndClick(_testee, "=");
 }



Step10. Add assertion integrated with NUnit Framework
      Now we would like to make sure the result of the previous calculation is 5. Add
      a member method with [Test] attribute (so that it can be identified by UnitRun
      add-in) as follows:

 [Test]
 public void runTest() {
      Assert.IsTrue(_testee != null);
      runScripts();
      Control control = _testee.FindControlName("_resultDisplayer");
      Assert.IsTrue(control != null);
      Assert.AreEqual(control.Text, "5.");
 }



Step11. Run the unit test through UnitRun add-in
      While the unit test is under running, please do not move your mouse or click
      any key. Any event generated by mouse moving or clicking will cause the test
      failed.




Windows Programming Tutorial – Ranorex                                           - 5-
Figure 4 Run unit test through UnitRun add-in.




   Figure 5 NUnit activate simple calculator through Ranorex and assert the value.


                                                                     – End Tutorial –




Windows Programming Tutorial – Ranorex                                           - 6-

More Related Content

What's hot (20)

PDF
Jenkins 101: Getting Started
R Geoffrey Avery
 
PPSX
Quality Engineering in the New Era
Cygnet Infotech
 
PDF
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Matt Raible
 
PDF
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
VMware Tanzu
 
PPTX
Introduction to devops
UtpalenduChakrobortt1
 
PDF
Cloud Native Application Development
Siva Rama Krishna Chunduru
 
PPTX
Test Case Management Tools
Malang QA Community
 
PDF
Manual software-testing-interview-questions-with-answers
Sachin Gupta
 
PDF
Selenium Deep Dive
Anand Bagmar
 
PPTX
Importance of a Test Management Tool for Your Project
Sarah Elson
 
PDF
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
PPTX
containerd the universal container runtime
Docker, Inc.
 
PPTX
DevOps and Tools
Mohammed Fazuluddin
 
PDF
RISC-V software state of the union
RISC-V International
 
PDF
Openstack trystack
Eueung Mulyana
 
PPTX
Introduction to Ranorex: Components & Features
BugRaptors
 
PPTX
Refactoring, Emergent Design & Evolutionary Architecture
Brad Appleton
 
DOCX
Industrial training report on core java
Nitesh Dubey
 
PPTX
Cross browser testing
Perfecto Mobile
 
PPTX
DevOps Training | DevOps Training Video | DevOps Tools | DevOps Tutorial For ...
Simplilearn
 
Jenkins 101: Getting Started
R Geoffrey Avery
 
Quality Engineering in the New Era
Cygnet Infotech
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Matt Raible
 
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
VMware Tanzu
 
Introduction to devops
UtpalenduChakrobortt1
 
Cloud Native Application Development
Siva Rama Krishna Chunduru
 
Test Case Management Tools
Malang QA Community
 
Manual software-testing-interview-questions-with-answers
Sachin Gupta
 
Selenium Deep Dive
Anand Bagmar
 
Importance of a Test Management Tool for Your Project
Sarah Elson
 
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
containerd the universal container runtime
Docker, Inc.
 
DevOps and Tools
Mohammed Fazuluddin
 
RISC-V software state of the union
RISC-V International
 
Openstack trystack
Eueung Mulyana
 
Introduction to Ranorex: Components & Features
BugRaptors
 
Refactoring, Emergent Design & Evolutionary Architecture
Brad Appleton
 
Industrial training report on core java
Nitesh Dubey
 
Cross browser testing
Perfecto Mobile
 
DevOps Training | DevOps Training Video | DevOps Tools | DevOps Tutorial For ...
Simplilearn
 

Viewers also liked (20)

PPTX
Ranorex presentation
ISsoft
 
PDF
Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
eVideoTuition
 
PDF
Why Ranorex
Ranorex
 
PPTX
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
PDF
Why Test Automation Fails
Ranorex
 
PDF
Automated Testing Tools for Desktop, Web and Mobile Software
Ranorex
 
PDF
Automated Desktop and Web Testing Webinars
Ranorex
 
PPTX
Cross browser testing
Sauce Labs
 
PPTX
SeeTestAutomation - Mobile Test Automation Tool by Experitest
Experitest
 
PPTX
Automation_testing
Yana Altunyan
 
PPTX
Top 5 pitfalls of software test automatiion
ekatechserv
 
PDF
New trends in testing automation
Eran Kinsbrunner
 
PPTX
Organization of Automated Testing
Klika Tech, Inc
 
PPTX
Test automation framework
QACampus
 
PDF
Winium — это как Selenium, только под Windows
SQALab
 
PDF
Role of Automation in Testing
Anand Bagmar
 
PDF
Software Testing Process, Testing Automation and Software Testing Trends
KMS Technology
 
PPTX
Combining Automated Functional And Load Testing
Ranorex
 
PPT
Test automation process
Bharathi Krishnamurthi
 
PPT
Automation testing strategy, approach & planning
SivaprasanthRentala1975
 
Ranorex presentation
ISsoft
 
Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
eVideoTuition
 
Why Ranorex
Ranorex
 
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
Why Test Automation Fails
Ranorex
 
Automated Testing Tools for Desktop, Web and Mobile Software
Ranorex
 
Automated Desktop and Web Testing Webinars
Ranorex
 
Cross browser testing
Sauce Labs
 
SeeTestAutomation - Mobile Test Automation Tool by Experitest
Experitest
 
Automation_testing
Yana Altunyan
 
Top 5 pitfalls of software test automatiion
ekatechserv
 
New trends in testing automation
Eran Kinsbrunner
 
Organization of Automated Testing
Klika Tech, Inc
 
Test automation framework
QACampus
 
Winium — это как Selenium, только под Windows
SQALab
 
Role of Automation in Testing
Anand Bagmar
 
Software Testing Process, Testing Automation and Software Testing Trends
KMS Technology
 
Combining Automated Functional And Load Testing
Ranorex
 
Test automation process
Bharathi Krishnamurthi
 
Automation testing strategy, approach & planning
SivaprasanthRentala1975
 
Ad

Similar to Tutorial ranorex (20)

PPT
Alina Cojocariu - Flex and Android tests with Ranorex
Codecamp Romania
 
PDF
UI Testing with Spec
ESUG
 
PDF
Test Automation Framework for the Desktop
David Harrison
 
PDF
PhoenixRisingArticle.pdf
David Harrison
 
PDF
PhoenixRisingArticle.pdf
David Harrison
 
PPTX
Getting Started with Coded UI Testing: Building Your First Automated Test
Imaginet
 
PPTX
Coded ui - lesson 3 - case study - calculator
Omer Karpas
 
PPTX
Unit Testing Using N Unit
Gaurav Arora
 
DOC
Getting started with test complete 7
Hoamuoigio Hoa
 
PPT
20051019 automating regression testing for evolving gui software
Will Shen
 
PDF
UI Automation_White_CodedUI common problems and tricks
Tsimafei Avilin
 
PPT
Testing
vamshi batchu
 
PPTX
Advanced Coded UI Testing
Shai Raiten
 
DOC
New features in qtp11
Ramu Palanki
 
DOC
Qtp 11 new enhacements in
Ramu Palanki
 
PDF
Testar2014 presentation
Tanja Vos
 
PPTX
Coding Naked
Caleb Jenkins
 
PPT
Innovative Test Automation Solution
Alan Lee White
 
PPT
Why test with flex unit
michael.labriola
 
PDF
Getting started with_testcomplete
ankit.das
 
Alina Cojocariu - Flex and Android tests with Ranorex
Codecamp Romania
 
UI Testing with Spec
ESUG
 
Test Automation Framework for the Desktop
David Harrison
 
PhoenixRisingArticle.pdf
David Harrison
 
PhoenixRisingArticle.pdf
David Harrison
 
Getting Started with Coded UI Testing: Building Your First Automated Test
Imaginet
 
Coded ui - lesson 3 - case study - calculator
Omer Karpas
 
Unit Testing Using N Unit
Gaurav Arora
 
Getting started with test complete 7
Hoamuoigio Hoa
 
20051019 automating regression testing for evolving gui software
Will Shen
 
UI Automation_White_CodedUI common problems and tricks
Tsimafei Avilin
 
Testing
vamshi batchu
 
Advanced Coded UI Testing
Shai Raiten
 
New features in qtp11
Ramu Palanki
 
Qtp 11 new enhacements in
Ramu Palanki
 
Testar2014 presentation
Tanja Vos
 
Coding Naked
Caleb Jenkins
 
Innovative Test Automation Solution
Alan Lee White
 
Why test with flex unit
michael.labriola
 
Getting started with_testcomplete
ankit.das
 
Ad

More from radikalzen (19)

DOC
Wangi+kaki+ibu
radikalzen
 
DOC
Syekh+siti+jenar
radikalzen
 
DOC
Serat+sabdo+jati
radikalzen
 
DOC
Perkampungan+hantu+bag+6
radikalzen
 
DOC
Budidaya jamurtiram
radikalzen
 
DOC
Budidaya jamurtiram
radikalzen
 
DOC
Joke+pembohong
radikalzen
 
DOC
Ilmu hitamrawarontek
radikalzen
 
DOC
Ilmu+gaib+islam+kejawen
radikalzen
 
DOC
Hakekat+dan+sumber+kekuatan+ilmu+gaib
radikalzen
 
DOC
Deka deteksidininerakaatausiksa
radikalzen
 
DOC
Cendana+dan+cendini
radikalzen
 
DOC
Cara+mengatisipasi+sihir
radikalzen
 
DOC
Makna+ajaran+dewa+ruci
radikalzen
 
DOC
Kurma+dan+kesehatan
radikalzen
 
PDF
Skripsi%20 andi%20jayanti.
radikalzen
 
PDF
Skripsi 2
radikalzen
 
PDF
06110040 nafi-fadilah-hayati
radikalzen
 
PDF
Unixtoolbox
radikalzen
 
Wangi+kaki+ibu
radikalzen
 
Syekh+siti+jenar
radikalzen
 
Serat+sabdo+jati
radikalzen
 
Perkampungan+hantu+bag+6
radikalzen
 
Budidaya jamurtiram
radikalzen
 
Budidaya jamurtiram
radikalzen
 
Joke+pembohong
radikalzen
 
Ilmu hitamrawarontek
radikalzen
 
Ilmu+gaib+islam+kejawen
radikalzen
 
Hakekat+dan+sumber+kekuatan+ilmu+gaib
radikalzen
 
Deka deteksidininerakaatausiksa
radikalzen
 
Cendana+dan+cendini
radikalzen
 
Cara+mengatisipasi+sihir
radikalzen
 
Makna+ajaran+dewa+ruci
radikalzen
 
Kurma+dan+kesehatan
radikalzen
 
Skripsi%20 andi%20jayanti.
radikalzen
 
Skripsi 2
radikalzen
 
06110040 nafi-fadilah-hayati
radikalzen
 
Unixtoolbox
radikalzen
 

Tutorial ranorex

  • 1. Ranorex Tutorial Spirit Du March 27th, 2007 Ver. 1.1.4 Contents  About this Document....................................................................................... 1 Ranorex Installation and Setup ...................................................................... 1 Tutorial – Test SimpleCalculator using Ranorex............................................ 2 About this Document NUnit framework is very useful for testing a small piece of program without GUI. But how do we test the correctness of GUI interactions? This document introduces a tool Ranorex, which can “simulate” user interactions and perform assertions. We will integrate this tool with the NUnit framework to test the SimpleCalculator developed in your homework. Ranorex Installation and Setup Ranorex is a Windows GUI test and automation Library for C++, Python, and the .Net languages. The user (e.g. the software tester) should use the functionalities of the programming languages like Python or C# as a base, and enlarge it with the GUI automation functionality of Ranorex. Before starting this tutorial, it needs to get the Ranorex installer form the URL: http://www.ranorex.com/download/ Download the free edition and execute the installer with default settings. After installation 1 , copy the file: RanorexCore.dll 2 from [Ranorex Location] 3 BinNet2.0 and then paste to [Windows] 4 system32 as global library cache 5 . 1 You don’t have to install the Ranorex. But you do need to do this set up step by yourself because there is no such file in system32 folder in the computer lab. 2 Any project developed with Ranorex will run with RanorexCore.dll 3 The default location is C:Program FilesRanorex-1.1.0 4 The default location for Windows XP/2000 is C:WinNT 5 It will facilitate the development without denoting the location of RanorexCore.dll in each project. Windows Programming Tutorial – Ranorex - 1-
  • 2. Tutorial – Test SimpleCalculator using Ranorex Step1.Open the existing Visual Studio Solution which contains your calculator. As shown in Figure 1, SimpleCalculator is the project developed in the previous homework which is contained in Windows Programming solution. Figure 1 The Solution contains SimpleCalculator project Step2.Add a class: GUITester into existing project. Figure 2 Add a new class: GUITester Step3.Add RanorexNet references 6 Figure 3 Add Ranorex reference Step4.Add using declarations Open the GUITester.cs and add the following two declarations. 6 Default location: C:Program FilesRanorex-1.1.0BinNet2.0 Windows Programming Tutorial – Ranorex - 2-
  • 3. using NUnit.Framework; using Ranorex; Step5.Declare a test fixture and a member data This is similar to the previous tutorial; add a test fixture attribute before the class declaration. Then, change the visibility to public and add a new field: _testee. namespace SimpleCalculatorGUITests { [TestFixture] public class GUITester { Form _testee; } } Step6.Use the Ranorex to activate SimpleCalculator in setup method 7 . Add a member method, setup(), into GUITester class. Note that the [SetUp] attribute and the value of application string must be the same as the title (name of the .exe file) of your simple calculator. [SetUp] public void setUp() { // Project Name or executable file name string application = "SimpleCalculator"; Application.SleepTime = 50; Mouse.MoveTime = 10; Application.Start(application); _testee = Application.FindFormTitle(application, SearchMatchMode.MatchExact, true, 2000); Assert.IsTrue(_testee != null); } Step7.Add a tear down member method to close the activated form In the previous tutorial, it is not necessary to declare the tear down method, because garbage collection is automatically performed. But in this tutorial, a tear down method is required to close the application (form) activated by the set up method. 7The assertion failed in setup() that will skip the runTest() and then call teardown() directly. Windows Programming Tutorial – Ranorex - 3-
  • 4. [TearDown] public void tearDown() { _testee.Close(); } Step8.Add a member method to control the mouse 8 Ranorex offers several ways to find 9 GUI widgets (controls) on the screen and also offers the control of mouse and keyboard. Now add a member method as below which can move the mouse pointer to the target control and then click on it. public void moveToControlAndClick(Form form, string text) { Assert.IsTrue(form != null); Control control = form.FindChildText(text); Assert.IsTrue(control != null); Mouse.MoveToControl(control); Mouse.ClickControl(control); } Step9.Write a test script Now we can write test cases by using the above moveToControlAndClick method. Add a new member method with the following codes to automatically perform the user’s actions 10 : 1+12-3-4*5/6= 8 The same as the setUp() method, if there is any assertion failed in the moveToControlAndClick() method, the NUnit will skip the remaining codes and then call tearDown() directly. 9 Ranorex provides several methods: by object name or id, text and class name. For more information, please refer to the Ranorex document. 10 Design your actions sequence for practice if you have more time after finishing the tutorial Windows Programming Tutorial – Ranorex - 4-
  • 5. public void runScripts() { moveToControlAndClick(_testee, "1"); moveToControlAndClick(_testee, "+"); moveToControlAndClick(_testee, "1"); moveToControlAndClick(_testee, "2"); moveToControlAndClick(_testee, "-"); moveToControlAndClick(_testee, "3"); moveToControlAndClick(_testee, "-"); moveToControlAndClick(_testee, "4"); moveToControlAndClick(_testee, "*"); moveToControlAndClick(_testee, "5"); moveToControlAndClick(_testee, "/"); moveToControlAndClick(_testee, "6"); moveToControlAndClick(_testee, "="); } Step10. Add assertion integrated with NUnit Framework Now we would like to make sure the result of the previous calculation is 5. Add a member method with [Test] attribute (so that it can be identified by UnitRun add-in) as follows: [Test] public void runTest() { Assert.IsTrue(_testee != null); runScripts(); Control control = _testee.FindControlName("_resultDisplayer"); Assert.IsTrue(control != null); Assert.AreEqual(control.Text, "5."); } Step11. Run the unit test through UnitRun add-in While the unit test is under running, please do not move your mouse or click any key. Any event generated by mouse moving or clicking will cause the test failed. Windows Programming Tutorial – Ranorex - 5-
  • 6. Figure 4 Run unit test through UnitRun add-in. Figure 5 NUnit activate simple calculator through Ranorex and assert the value. – End Tutorial – Windows Programming Tutorial – Ranorex - 6-