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-
Ad

More Related Content

What's hot (20)

Ranorex presentation
Ranorex presentationRanorex presentation
Ranorex presentation
ISsoft
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
TEST Huddle
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
Seth McLaughlin
 
Jenkins Overview
Jenkins OverviewJenkins Overview
Jenkins Overview
Ahmed M. Gomaa
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
Akshay Sharma
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Simplilearn
 
PWA - Progressive Web App
PWA - Progressive Web AppPWA - Progressive Web App
PWA - Progressive Web App
Robert Robinson
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
Jomar Tigcal
 
.Net Core
.Net Core.Net Core
.Net Core
Software Infrastructure
 
TDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & WhereTDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & Where
Daniel Davis
 
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los serviciosWSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web App
Subodh Garg
 
Performance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity TestingPerformance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity Testing
Akshay Patole
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
Manoj Kumar Kumar
 
Introduction to Ranorex: Components & Features
Introduction to Ranorex: Components & FeaturesIntroduction to Ranorex: Components & Features
Introduction to Ranorex: Components & Features
BugRaptors
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlow
Aiste Stikliute
 
Webinar: Selenium WebDriver - Automation Uncomplicated
Webinar: Selenium WebDriver - Automation UncomplicatedWebinar: Selenium WebDriver - Automation Uncomplicated
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)
Zhentian Wan
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap ui
pkslide28
 
Ranorex presentation
Ranorex presentationRanorex presentation
Ranorex presentation
ISsoft
 
API Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj RollisonAPI Testing: The heart of functional testing" with Bj Rollison
API Testing: The heart of functional testing" with Bj Rollison
TEST Huddle
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
Seth McLaughlin
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
Akshay Sharma
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Jenkins Pipeline Tutorial | Jenkins Build And Delivery Pipeline | Jenkins Tut...
Simplilearn
 
PWA - Progressive Web App
PWA - Progressive Web AppPWA - Progressive Web App
PWA - Progressive Web App
Robert Robinson
 
Location-Based Services on Android
Location-Based Services on AndroidLocation-Based Services on Android
Location-Based Services on Android
Jomar Tigcal
 
TDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & WhereTDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & Where
Daniel Davis
 
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los serviciosWSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2 API Manager y ESB la plataforma perfecta para evolucionar los servicios
WSO2
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web App
Subodh Garg
 
Performance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity TestingPerformance Testing using Jmeter and Capacity Testing
Performance Testing using Jmeter and Capacity Testing
Akshay Patole
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
Manoj Kumar Kumar
 
Introduction to Ranorex: Components & Features
Introduction to Ranorex: Components & FeaturesIntroduction to Ranorex: Components & Features
Introduction to Ranorex: Components & Features
BugRaptors
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlow
Aiste Stikliute
 
Webinar: Selenium WebDriver - Automation Uncomplicated
Webinar: Selenium WebDriver - Automation UncomplicatedWebinar: Selenium WebDriver - Automation Uncomplicated
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)
Zhentian Wan
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap ui
pkslide28
 

Viewers also liked (19)

Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
Ranorex Studio - Introduction, Features & Limitations -  Mobile Test Automati...Ranorex Studio - Introduction, Features & Limitations -  Mobile Test Automati...
Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
eVideoTuition
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
Why Test Automation Fails
Why Test Automation FailsWhy Test Automation Fails
Why Test Automation Fails
Ranorex
 
Automated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile SoftwareAutomated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile Software
Ranorex
 
Automated Desktop and Web Testing Webinars
Automated Desktop and Web Testing WebinarsAutomated Desktop and Web Testing Webinars
Automated Desktop and Web Testing Webinars
Ranorex
 
Cross browser testing
Cross browser testingCross browser testing
Cross browser testing
Sauce Labs
 
SeeTestAutomation - Mobile Test Automation Tool by Experitest
SeeTestAutomation - Mobile Test Automation Tool by ExperitestSeeTestAutomation - Mobile Test Automation Tool by Experitest
SeeTestAutomation - Mobile Test Automation Tool by Experitest
Experitest
 
Automation_testing
Automation_testingAutomation_testing
Automation_testing
Yana Altunyan
 
Top 5 pitfalls of software test automatiion
Top 5 pitfalls of software test automatiionTop 5 pitfalls of software test automatiion
Top 5 pitfalls of software test automatiion
ekatechserv
 
New trends in testing automation
New trends in testing automationNew trends in testing automation
New trends in testing automation
Eran Kinsbrunner
 
Organization of Automated Testing
Organization of Automated TestingOrganization of Automated Testing
Organization of Automated Testing
Klika Tech, Inc
 
Test automation framework
Test automation frameworkTest automation framework
Test automation framework
QACampus
 
Winium — это как Selenium, только под Windows
Winium — это как Selenium, только под WindowsWinium — это как Selenium, только под Windows
Winium — это как Selenium, только под Windows
SQALab
 
Role of Automation in Testing
Role of Automation in TestingRole of Automation in Testing
Role of Automation in Testing
Anand Bagmar
 
Software Testing Process, Testing Automation and Software Testing Trends
Software Testing Process, Testing Automation and Software Testing TrendsSoftware Testing Process, Testing Automation and Software Testing Trends
Software Testing Process, Testing Automation and Software Testing Trends
KMS Technology
 
Combining Automated Functional And Load Testing
Combining Automated Functional And Load TestingCombining Automated Functional And Load Testing
Combining Automated Functional And Load Testing
Ranorex
 
Test automation process
Test automation processTest automation process
Test automation process
Bharathi Krishnamurthi
 
Automation testing strategy, approach & planning
Automation testing  strategy, approach & planningAutomation testing  strategy, approach & planning
Automation testing strategy, approach & planning
SivaprasanthRentala1975
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Natasha Murashev
 
Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
Ranorex Studio - Introduction, Features & Limitations -  Mobile Test Automati...Ranorex Studio - Introduction, Features & Limitations -  Mobile Test Automati...
Ranorex Studio - Introduction, Features & Limitations - Mobile Test Automati...
eVideoTuition
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
Why Test Automation Fails
Why Test Automation FailsWhy Test Automation Fails
Why Test Automation Fails
Ranorex
 
Automated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile SoftwareAutomated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile Software
Ranorex
 
Automated Desktop and Web Testing Webinars
Automated Desktop and Web Testing WebinarsAutomated Desktop and Web Testing Webinars
Automated Desktop and Web Testing Webinars
Ranorex
 
Cross browser testing
Cross browser testingCross browser testing
Cross browser testing
Sauce Labs
 
SeeTestAutomation - Mobile Test Automation Tool by Experitest
SeeTestAutomation - Mobile Test Automation Tool by ExperitestSeeTestAutomation - Mobile Test Automation Tool by Experitest
SeeTestAutomation - Mobile Test Automation Tool by Experitest
Experitest
 
Top 5 pitfalls of software test automatiion
Top 5 pitfalls of software test automatiionTop 5 pitfalls of software test automatiion
Top 5 pitfalls of software test automatiion
ekatechserv
 
New trends in testing automation
New trends in testing automationNew trends in testing automation
New trends in testing automation
Eran Kinsbrunner
 
Organization of Automated Testing
Organization of Automated TestingOrganization of Automated Testing
Organization of Automated Testing
Klika Tech, Inc
 
Test automation framework
Test automation frameworkTest automation framework
Test automation framework
QACampus
 
Winium — это как Selenium, только под Windows
Winium — это как Selenium, только под WindowsWinium — это как Selenium, только под Windows
Winium — это как Selenium, только под Windows
SQALab
 
Role of Automation in Testing
Role of Automation in TestingRole of Automation in Testing
Role of Automation in Testing
Anand Bagmar
 
Software Testing Process, Testing Automation and Software Testing Trends
Software Testing Process, Testing Automation and Software Testing TrendsSoftware Testing Process, Testing Automation and Software Testing Trends
Software Testing Process, Testing Automation and Software Testing Trends
KMS Technology
 
Combining Automated Functional And Load Testing
Combining Automated Functional And Load TestingCombining Automated Functional And Load Testing
Combining Automated Functional And Load Testing
Ranorex
 
Automation testing strategy, approach & planning
Automation testing  strategy, approach & planningAutomation testing  strategy, approach & planning
Automation testing strategy, approach & planning
SivaprasanthRentala1975
 
Ad

Similar to Tutorial ranorex (20)

Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
RubenGray1
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Anand Kumar Rajana
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
Fwdays
 
Qtp 9.2 examples
Qtp 9.2 examplesQtp 9.2 examples
Qtp 9.2 examples
medsherb
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
Sigma Software
 
J unit presentation
J unit presentationJ unit presentation
J unit presentation
Priya Sharma
 
JUnit Presentation
JUnit PresentationJUnit Presentation
JUnit Presentation
priya_trivedi
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
Tricode (part of Dept)
 
NicoleMaguire_NEES_FinalReport
NicoleMaguire_NEES_FinalReportNicoleMaguire_NEES_FinalReport
NicoleMaguire_NEES_FinalReport
Nicole Maguire
 
Junit
JunitJunit
Junit
Vivek Kulkarni
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
Baskar K
 
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
kalichargn70th171
 
Introduction To Programming IP5
Introduction To Programming IP5Introduction To Programming IP5
Introduction To Programming IP5
Mark Simon
 
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
Andrey Karpov
 
QTP 9.2
QTP 9.2QTP 9.2
QTP 9.2
Kuldeep Sharma
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorials
medsherb
 
Unit testing in Unity
Unit testing in UnityUnit testing in Unity
Unit testing in Unity
Mikko McMenamin
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
Ramu Palanki
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
Ramu Palanki
 
QTP with Descriptive programming
QTP with Descriptive programmingQTP with Descriptive programming
QTP with Descriptive programming
Kuldeep Sharma
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
RubenGray1
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
Fwdays
 
Qtp 9.2 examples
Qtp 9.2 examplesQtp 9.2 examples
Qtp 9.2 examples
medsherb
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
Sigma Software
 
J unit presentation
J unit presentationJ unit presentation
J unit presentation
Priya Sharma
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
Tricode (part of Dept)
 
NicoleMaguire_NEES_FinalReport
NicoleMaguire_NEES_FinalReportNicoleMaguire_NEES_FinalReport
NicoleMaguire_NEES_FinalReport
Nicole Maguire
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
Baskar K
 
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
A Comprehensive Guide to Essential Workflows for Improving Flutter Unit Testi...
kalichargn70th171
 
Introduction To Programming IP5
Introduction To Programming IP5Introduction To Programming IP5
Introduction To Programming IP5
Mark Simon
 
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
PVS-Studio Now Supports Any Build System under Windows and Any Compiler. Easy...
Andrey Karpov
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorials
medsherb
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
Ramu Palanki
 
Qtp interview questions and answers
Qtp interview questions and answersQtp interview questions and answers
Qtp interview questions and answers
Ramu Palanki
 
QTP with Descriptive programming
QTP with Descriptive programmingQTP with Descriptive programming
QTP with Descriptive programming
Kuldeep Sharma
 
Ad

More from radikalzen (19)

Wangi+kaki+ibu
Wangi+kaki+ibuWangi+kaki+ibu
Wangi+kaki+ibu
radikalzen
 
Syekh+siti+jenar
Syekh+siti+jenarSyekh+siti+jenar
Syekh+siti+jenar
radikalzen
 
Serat+sabdo+jati
Serat+sabdo+jatiSerat+sabdo+jati
Serat+sabdo+jati
radikalzen
 
Perkampungan+hantu+bag+6
Perkampungan+hantu+bag+6Perkampungan+hantu+bag+6
Perkampungan+hantu+bag+6
radikalzen
 
Budidaya jamurtiram
Budidaya jamurtiramBudidaya jamurtiram
Budidaya jamurtiram
radikalzen
 
Budidaya jamurtiram
Budidaya jamurtiramBudidaya jamurtiram
Budidaya jamurtiram
radikalzen
 
Joke+pembohong
Joke+pembohongJoke+pembohong
Joke+pembohong
radikalzen
 
Ilmu hitamrawarontek
Ilmu hitamrawarontekIlmu hitamrawarontek
Ilmu hitamrawarontek
radikalzen
 
Ilmu+gaib+islam+kejawen
Ilmu+gaib+islam+kejawenIlmu+gaib+islam+kejawen
Ilmu+gaib+islam+kejawen
radikalzen
 
Hakekat+dan+sumber+kekuatan+ilmu+gaib
Hakekat+dan+sumber+kekuatan+ilmu+gaibHakekat+dan+sumber+kekuatan+ilmu+gaib
Hakekat+dan+sumber+kekuatan+ilmu+gaib
radikalzen
 
Deka deteksidininerakaatausiksa
Deka deteksidininerakaatausiksaDeka deteksidininerakaatausiksa
Deka deteksidininerakaatausiksa
radikalzen
 
Cendana+dan+cendini
Cendana+dan+cendiniCendana+dan+cendini
Cendana+dan+cendini
radikalzen
 
Cara+mengatisipasi+sihir
Cara+mengatisipasi+sihirCara+mengatisipasi+sihir
Cara+mengatisipasi+sihir
radikalzen
 
Makna+ajaran+dewa+ruci
Makna+ajaran+dewa+ruciMakna+ajaran+dewa+ruci
Makna+ajaran+dewa+ruci
radikalzen
 
Kurma+dan+kesehatan
Kurma+dan+kesehatanKurma+dan+kesehatan
Kurma+dan+kesehatan
radikalzen
 
Skripsi%20 andi%20jayanti.
Skripsi%20 andi%20jayanti.Skripsi%20 andi%20jayanti.
Skripsi%20 andi%20jayanti.
radikalzen
 
Skripsi 2
Skripsi 2Skripsi 2
Skripsi 2
radikalzen
 
06110040 nafi-fadilah-hayati
06110040 nafi-fadilah-hayati06110040 nafi-fadilah-hayati
06110040 nafi-fadilah-hayati
radikalzen
 
Unixtoolbox
UnixtoolboxUnixtoolbox
Unixtoolbox
radikalzen
 
Wangi+kaki+ibu
Wangi+kaki+ibuWangi+kaki+ibu
Wangi+kaki+ibu
radikalzen
 
Syekh+siti+jenar
Syekh+siti+jenarSyekh+siti+jenar
Syekh+siti+jenar
radikalzen
 
Serat+sabdo+jati
Serat+sabdo+jatiSerat+sabdo+jati
Serat+sabdo+jati
radikalzen
 
Perkampungan+hantu+bag+6
Perkampungan+hantu+bag+6Perkampungan+hantu+bag+6
Perkampungan+hantu+bag+6
radikalzen
 
Budidaya jamurtiram
Budidaya jamurtiramBudidaya jamurtiram
Budidaya jamurtiram
radikalzen
 
Budidaya jamurtiram
Budidaya jamurtiramBudidaya jamurtiram
Budidaya jamurtiram
radikalzen
 
Joke+pembohong
Joke+pembohongJoke+pembohong
Joke+pembohong
radikalzen
 
Ilmu hitamrawarontek
Ilmu hitamrawarontekIlmu hitamrawarontek
Ilmu hitamrawarontek
radikalzen
 
Ilmu+gaib+islam+kejawen
Ilmu+gaib+islam+kejawenIlmu+gaib+islam+kejawen
Ilmu+gaib+islam+kejawen
radikalzen
 
Hakekat+dan+sumber+kekuatan+ilmu+gaib
Hakekat+dan+sumber+kekuatan+ilmu+gaibHakekat+dan+sumber+kekuatan+ilmu+gaib
Hakekat+dan+sumber+kekuatan+ilmu+gaib
radikalzen
 
Deka deteksidininerakaatausiksa
Deka deteksidininerakaatausiksaDeka deteksidininerakaatausiksa
Deka deteksidininerakaatausiksa
radikalzen
 
Cendana+dan+cendini
Cendana+dan+cendiniCendana+dan+cendini
Cendana+dan+cendini
radikalzen
 
Cara+mengatisipasi+sihir
Cara+mengatisipasi+sihirCara+mengatisipasi+sihir
Cara+mengatisipasi+sihir
radikalzen
 
Makna+ajaran+dewa+ruci
Makna+ajaran+dewa+ruciMakna+ajaran+dewa+ruci
Makna+ajaran+dewa+ruci
radikalzen
 
Kurma+dan+kesehatan
Kurma+dan+kesehatanKurma+dan+kesehatan
Kurma+dan+kesehatan
radikalzen
 
Skripsi%20 andi%20jayanti.
Skripsi%20 andi%20jayanti.Skripsi%20 andi%20jayanti.
Skripsi%20 andi%20jayanti.
radikalzen
 
06110040 nafi-fadilah-hayati
06110040 nafi-fadilah-hayati06110040 nafi-fadilah-hayati
06110040 nafi-fadilah-hayati
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-