Organizing a Test Automation Project with Ranorex Studio

Posted by cpreschern on Tuesday, June 29th, 2010 at 4:15 pm to Best Practices

There are many different possibilities for organizing a Ranorex Studio test automation project. The main goal when doing professional test automation with Ranorex is to create reusable automation modules. This can be realized by distinguishing between commonly used automation modules which perform actions like starting an application and specialized test modules performing a narrowly defined task.

ranorextestsolution1

The test project solution consists of:

Note: The important point is to separate execution and test case definition from the automation modules.

EXE Project – ‘Execution’

The executable project specifies the test cases of the solution and defines how each test case is triggered. Additionally, a ‘Setup’ method initializes the system under test (e.g. starting the application) while the ‘TearDown’ method cleans up the system be-fore the next test case is started (e.g. closing an application). Each test case is implemented within single files and classes:

testcaseclasses

The test case refers to the ‘AddVip’ recording which is part of the ‘VipTestLibrary’ DLL project. To reuse a method or class implemented within another project, a reference to the project has to be added.

addprojectreference

Library Project – ‘VipTestLibrary’

A library project can be created by adding a new project to the solution. The project template ‘Ranorex Class Library’ is part of the ‘Advanced’ folder shown within the ‘New Project’ dialog wizard.

Creating a new library project

The reason for having a Ranorex class library is to manage the modules (recordings or pure code based classes and methods) separated from the execution project. All recordings are stored within the ‘Recordings’ folder while the modules, totally based on user written code, are part of the ‘Code’ directory. Also the repository, which manages all the UI elements of the application under test, is part of the library project.

Common Class Library – ‘Common’

It’s not required to have an additional library implemented to handle common methods like starting or closing the system under test. Regardless, when thinking about other test projects or solutions which require a common method like killing a process in order to shut down an application in cases of errors, it would be good to have one robust mechanism for that purpose. In comparison to the ‘VipTestLibrary’, the ‘Common’ class library project does not have any information about the application under test. Everything required for UI automation is provided by parameters.

commonmethods

Add the ‘Common’ library as reference in order to reuse the classes and methods implemented within it.

Test Case Execution

In that example the execution is triggered by a simple batch file, which specifies the execution sequence:

cd bin\debug
call execution.exe -tc addsinglevip
call execution.exe -tc savevip
call execution.exe -tc connecttodatabase

It’s possible to evaluate the return values (FAIL=-1, SUCCESS=0) at the command line interface as well. In addition a command line based execution is supported by many test management tools. That helps to ease integration of Ranorex tests into existing execution environments.

Download the Ranorex Studio solution “VIP Test Solution” here.

Share

Tags: , ,

Leave a Reply