Skip to content

Ranorex
Syndicate content
Updated: 18 min 58 sec ago

Integrate Automated Testing into Jenkins

Fri, 09/23/2016 - 12:00

In software engineering, continuous integration means the continuous application of quality control processes — small units of effort, applied frequently.

In this blog we’ll show you how to set up a CI job with Hudson/Jenkins that automatically builds and executes your Ranorex automation as well as automatically sends out the generated test reports for every committed change in a Subversion repository.

Advantages of Continuous Integration Testing

Continuous integration has many advantages:

  • When tests fail or bugs emerge, developers can revert the codebase to a bug-free state without wasting time for debugging
  • Developers detect and fix integration problems continuously – and thus avoid last-minute chaos at release dates
  • Early warning of broken/incompatible code
  • Early warning of conflicting changes
  • Immediate testing of all changes
  • Constant availability of a “current” build for testing, demo, or release purposes
  • Immediate feedback to developers on the quality, functionality, or system-wide impact of their written code
  • Frequent code check-ins push developers to create modular, less complex code
Infrastructure Continuous Integration Tool

You can find a download link and installation description for Hudson and Jenkins here:

In this blog post we are going to use Jenkins as CI tool. There shouldn’t be much of a difference when using Hudson.

As Jenkins or the nodes executing the CI jobs normally are started as Windows services, they do not have sufficient rights to start UI-applications.

Please make sure that Jenkins as master or its slave nodes, where the Ranorex automation should be triggered, are not started as a service.

For the Jenkins master, open the “Services” tool (which is part of the “Administrative Tools” in the control panel), choose “Jenkins” service, stop the service, and set the “Startup type” to disabled:

disable start as service

Use the following command to start Jenkins manually from the installation folder:

java -jar jenkins.war

manually start jenkins

After starting Jenkins, use this address to access the web interface:

http://localhost:8080/

To configure your Jenkins server, navigate to the Jenkins menu and select “Manage Jenkins” -> “Configure System”:

Configure System

Note: It is necessary to have the Ranorex main components – and a valid Ranorex license – installed on each machine you want to build and execute Ranorex code.

Source Code Management

As mentioned before, we are going to use a Subversion repository as base of our continuous integration process.

In this sample, we have two solutions in our repository: the application under test and as the automated Ranorex tests.

Repository

To start the application under test from your test project, simply add a new “Run Application” action to your action table in Ranorex Studio, which starts the application under test, using a relative path to the repository root:

Run Application Action

Plugins

As we want to build our code for each committed change within our SVN repository, we need a Subversion as well as a MS Build plugin for Jenkins. An additional mail plugin will make sure that a mail is sent with each build.

Install Plugins

Open the “Manage Plugins” section (“Manage Jenkins” -> “Manage Plugins”), choose the following plugins from the list of available plugins and install them if they are not installed already:

  • MSBuild Plugin
  • Email Extension Plugin
  • Subversion Plugin
Configure Plugins

The installed plugins also need to be configured. To do so

  • open the “Configure System” and configure the “Extended E-Mail Notification” plugin. To do so, set the recipients and alter the subject and content (adding the environment variable $BUILD_LOG to the content will add the whole console output of the build and the test to the sent mail),
    Configure Mails
  • configure the “E-mail Notification” plugin by setting the SMTP server.
  • and navigate to “Global Tool Configuraiton” and configure your “MSBuild” plugin by choosing the “msbuild.exe” installed on your machine.
    Configure MSBuild
Add New Job

Now, as the system is configured, we can add a new Jenkins job, which will update the checked out files from a SVN repository, build both the application under test and the Ranorex automation project, execute the application under test as well as the automation code and send a mail with the report file attached.

Start by creating a new item. Choose “Build free-style software project” as job type and enter a job name:

Add New Item

Configure Source Code Management

Next, we have to check out the source of both the application under test and our test automation project. Start with choosing Subversion as source code management tool. Then, enter the repository holding your application under test as well as your test automation project. Finally, choose “Use ‘svn update’ as much as possible” as check out strategy:

Configure SVN

With this configuration, the application under test as well as the test automation project will be checked out and updated locally.

Add Build Steps

Now, as the source code management is configured, we can start with processing the updated files.
First of all, let’s add MSBuild steps for both projects:

Add MSBuild Buildstep

Choose your configured MSBuild version and enter the path of the solution file relative to the repository root (which is the workspace folder of the Jenkins job) for both the automated and the automating project:

Added MSBuild Buildsteps

With adding these two build steps, the executables will be automatically built. Now the newly built application should be tested.
This can be accomplished by adding a new “Windows batch command” that starts the test suite executable:

Add Batch Buildstep

Added Batch Buildstep

As you can see, some command line arguments are passed to the test suite executable.

In this sample, the command line arguments “/zr”, which triggers the test suite executable to generate a zipped report file, and “/zrf:.ReportsReport-Build-%BUILD_NUMBER%.rxzlog”, which defines the name and the location of the generated zipped report file, are used.

You can find a list of all available command line arguments in the section “Running Tests without Ranorex Studio” in our user guide.
The test suite executable returns “0” on success and “-1” on failure. Based on this return value, Jenkins will mark the build as successful or failure.

Add Post-Build Action

After building and executing the application under test and the Ranorex test script, we will send an email which informs us about the success of the triggered build.
This email should include the zipped report file, mentioned before, as attachment.
To do so, add the new post-build action “Editable Email Notification”, choose the report file location defined before as attachment, and add triggers for each job status you want to be informed about. In this sample, an email will be sent if a job has failed or succeeded.

Added Mail Action

Run Job

Once you’ve completed these steps and saved your changes, check if everything works as expected by clicking “Build now”:

Build Now

After running the generated job, you will see all finished builds within the build hierarchy. Icons indicate the status of the individual builds.
You can view the zipped report files of all builds by opening them in the local workspace (“Workspace/Reports”):

Build History

As configured before, an email will be sent to the specified email address(es), including the console output in the email text as well as the generated zipped report file as attachment.

Add Repository Hook

Now we can manually trigger a build. As we are working with Subversion, it would be beneficial to trigger the script for each commit.
To do so, you can add a server side repository hook, which automatically triggers Jenkins to start a new build for each change committed, as described in the subversion plugin documentation.

Alternatively, you can activate polling of the source code management system as build trigger in your Jenkins job configuration.

As shown in following picture, you can define the interval, after which the source code management will be invoked (e.g. 5 minutes after every full hour):

Added Build Trigger

Conclusion

Following the steps above you will be able to easily setup a continuous integration process performing the automated test of the application you develop. Each commit will now trigger an automated test run. Once the test run has finished, you’ll instantly receive a mail with the Ranorex test report.

Note: This blog was originally published in July 2012 and has been revised to reflect recent technical developments.

Download Free 30-Day Trial

The post Integrate Automated Testing into Jenkins appeared first on Ranorex Blog.

Categories: Companies

Test Your iOS 10 Apps

Thu, 09/15/2016 - 13:31

Apple’s iOS 10 update for iPhone and iPad lives up to its milestone software version number and implements major changes to your daily phone and tablet routine.

Benefit from features such as:

  • A fully redesigned lock screen
  • Siri open for developers
  • Huge changes and new features for messages
  • A redesigned Apple Music app
  • Deletable stock apps
  • A completely new Home app for HomeKit
  • and many more features.

We are delighted to announce that with our latest release, Ranorex 6.1, iOS 10 is supported.

Upgrade to the latest OS on your mobile devices now to start automating your cutting edge mobile app tests with Ranorex!

Get the latest version of Ranorex now

The post Test Your iOS 10 Apps appeared first on Ranorex Blog.

Categories: Companies

Ranorex 6.1 Released

Thu, 09/08/2016 - 16:37

We’re happy to announce that we’ve released Ranorex 6.1! This new generation of functional test automation is now fresh and polished to make working in teams even easier! Next to remote test execution, improved test suite file format and Git integration, this software update introduces an intuitive setting storage and a progressive report preview. Let’s have a look at the benefits, shall we?

Solution Settings Ensure everyone in a team uses the same settings when working on a test automation project.

You can now save technology-specific solution settings directly in the test automation solution, while user settings can still be stored locally. This brings some rather fantastic benefits with it:

  • You can check in your settings together with the solution into a version control system. This makes it easier to share solutions with other team members and, ultimately, to work together on them.
  • Are you working on multiple test automation projects? Very likely, each is in its own test environment. Now, when you switch between solutions, you don’t have to manually adjust the settings.

Have fun sharing your settings and working together on test automation projects!

Learn more about the solution settings

Progressive Report Preview For those who’d like to take a peek in the test report during test execution.

We’ve all been there. You’d like to know how many test cases have failed, but it could take hours until the test run is complete and the full report is available. You’d need this information to react early to failed test cases – or maybe just to have a peace of mind before you go home. Trust us, we get it. So here’s what we’ve done: During test execution, test results are saved in configurable intervals. So whenever you feel like it, you can preview the report from anywhere without disrupting the test run. Enjoy!

Learn more about the progressive report preview

For a full list of new features and enhancements, please view our Release Notes. This software update is available now and included in software maintenance at no additional costs.

Learn more about Ranorex 6.1 Download Free 6.1 Trial

The post Ranorex 6.1 Released appeared first on Ranorex Blog.

Categories: Companies

Manually Create Automated Tests

Thu, 09/01/2016 - 14:00

Ranorex is more than just a simple capture and replay tool. It is a versatile test automation software that offers a range of tools suitable for every skill level. While you don’t need any programming skills to easily create and maintain your tests with the Ranorex Recorder, you can also manually create your automated tests.

What are the benefits of manual test case creation?

  • Keep your Ranorex Object Repository structured and easily maintainable from the start.
  • Create robust test cases that uniquely identify dynamic IDs.
  • Ensure only those UI elements you want to test are available in your Ranorex Object Repository.
  • Automate complex test scenarios in code using the Ranorex Object Repository.

Workflow

Test Scenario

In this example, we’ll use the KeePass as application under test (AUT). This open source password manager application is one of our sample applications delivered with Ranorex Studio, so you can easily recreate this example.

In this blog, we’ll show you how to

  • generate a Ranorex Object Repository containing exactly those UI elements you want to address in your automated test,
  • drag and drop the resulting repository items to your action table or
  • drag and drop items directly into your user code to represent the workflow you want to test.
The Ranorex Object Repository

The Ranorex Object Repository manages the UI elements of your automated test. A repository item is automatically created in this central Ranorex Object Repository when you record or track a UI element. If you change a repository item, these changes are automatically applied in the code as well as in the recording module.

Start by opening your solution and add an empty recording module. You will notice that the central Ranorex Object Repository of your test automation project is displayed directly below the action table. You can now add UI elements to the repository using the ‘Track’ button in the Ranorex Object Repository.

Track UI Elements

Enhancing the RanoreXPath

You can alter the RanoreXPath of specific repository items to make them more robust. Simply open the path editor and click on the ‘Edit’ button next to the item. For more information about the RanoreXPath, please have a look at the user guide chapters RanoreXPath and RanoreXPath Editor. If you’d like to know how to best enhance the object recognition of your AUT using the RanoreXPath operators, check out the blog post RanoreXPath – Tips and Tricks.

Keep your repository clear and structured

If your Ranorex Object Repository contains many objects, it’s particularly important to keep it clearly structured and organized. Here are two tips:

Rename repository items

Each UI element within the repository can have a logical user-defined name. Renaming repository items and giving them logical names will make it easier to understand test automation code and report files.

Create Logical Folders

You can also create logical folders to structure and group UI elements that logically belong together. For detailed instructions on how to structure your Ranorex Object Repository, please check out our user guide chapter Adapting an Existing Repository.

Keep Repo Clear

The Recording

As your Ranorex Object Repository now contains multiple UI elements, you can add actions to the recording. Do so by either selecting ‘Add New Action’, or simply drag & drop specific repository items from the repository to the action table in the recording.

Add Action Via Menu

Add Action Via Drag Drop

If you’d like to connect data to your automated tests and use variables in the action table or the repository, have a look at the user guide chapter Data-Driven Testing.

The User Code

You can also create your actions directly in user code. Simply drag and drop the specific repository item from the Ranorex Object Repository directly into the code editor.

Add Code Via Drag Drop

In the user guide chapter Code Examples you can find further examples on how to extend modules with user specific code.

Conclusion

As you can see, you can create your automated tests manually without pressing the record button at any time. This will give you more control over the actions that should be triggered.

Download Free Trial

The post Manually Create Automated Tests appeared first on Ranorex Blog.

Categories: Companies

RanoreXPath – Tips and Tricks

Thu, 08/25/2016 - 15:00

The RanoreXPath is a powerful identifier of UI elements for desktop, web and mobile applications and is derived from the XPath query language. In this blog we will show you a few tips & tricks on how to best use the various RanoreXPath operators to uniquely identify UI elements. You can then use these RanoreXPaths in your recording and code modules to make your automated tests more robust.

Overview

Using RanoreXPath operators

Element Browser

The Ranorex Spy displays the UI as hierarchical representation of elements in the Element Browser view. The RanoreXPath can be used to search and identify items in this UI hierarchy.

In this example, we’ll use the tool KeePass as application under test (AUT). This open source password manager application is one of our sample applications delivered with Ranorex Studio. If you have multiple applications open, Ranorex Spy will list them all. Filtering the application you want to test will increase speed and give you a better overview. To do so, track the application node of KeePass and set it as root node (context menu > ‘Set Element as Root’). Now, only the main KeePass form and its underlying elements are visible.

Ranorex Spy

General Layout of RanoreXPath

RanoreXPath expressions are similar to XPath expressions. They share both syntax and logical behavior. A RanoreXPath always consists of adapters, attributes and values:

Layout of RanoreXPath

The adapter specifies the type or application of the UI element. The attribute and values specify adapter properties.

The absolute RanoreXPath of our KeePass form looks like this:

RanoreXPath of AUT

The form is an adapter specifying the type or classification of the UI element. It is followed by the attribute value comparison, which identifies the requested element. In this example, the comparison operator is a simple equality.

If you want to know more about how the RanoreXPath works, we recommend our dedicated user guide section.

Search for multiple button elements

You can list all buttons elements that are direct children of a designated positon in your AUT. Have a look at these two examples:

1. List all buttons that are direct children of the KeePass toolbar:

To do so, simply set the toolbar as root node and type ./button into the RanoreXPath edit field, directly after the given RanoreXPath.

Relative path to all child buttons

This will create a relative path to all child nodes of the actual node, which are buttons.

Element Tree with Child Buttons

2. List all buttons of your AUT:

Navigate back to the form adapter, set it as root node and type in .//button.

Relative path to all buttons

You’ve now created a relative path to all descendants of the actual node, which are buttons. These are all buttons of all levels of the subtree of the current element.

Element Tree with all Buttons

Identify controls with a specific attribute

You can also create a path to controls, to filter them according to specific attributes. In this example, we want to find all checked checkboxes.

Open the “Find” dialog in KeePass (<CTRL><F>), as this dialog contains checkboxes, and set it as root node. Now, you can validate which item of the checkbox control has the attribute “checked” set to true. To do so, enter “//checkbox[@checked=’True’]”:

RanoreXPah for Checked Checkboxes

As you can see, only the checked checkboxes will be visible in the Element Browser.

Element Tree with all checked checkboxes

Identify checkboxes by combining attributes

You can further extend the previous example by combining attributes. This enables you to, for example, omit certain items from the search, or search for specific items.

1. Omit a specific item from the search

You can omit a specific item from the search using the “not equal” operator and the “and” conjunction. In this case, we want to omit the item “&Title”:

RanoreXPah for Checked Checkboxes excluding Title

Element Tree with all checked checkboxes excluding Title

2. Seach for specific items

You can use the “or” instead of the “and” conjunction to extend your search and only look for specific items. Extend the checkbox search to look for the items “&Title” and “&URL”:

RanoreXPah for Checkboxes

Element Tree with checkboxes

Recognize related elements using the parent operator

After running the Ranorex desktop sample project, there will be two entries in our AUT – one for a WordPress and one for a Gmail account. In this case, we’d like to find the username of the “Gmail” KeePass entry:

RanoreXPah for username of gmail entry

Element Tree username of gmail entry

Username of gmail entry

Start with the RanoreXPath to the cell containing the text “Gmail” (framed in red). Next, use the relationship operator “parent” to reference the parent node of the current element. In this example, it’s a row (framed in blue). The index “[2]” navigates to the second cell, which contains the Gmail username (framed in green).

Recognize related elements by using preceding- and following-sibling

Another way to search for related elements is to use the relationship operator “preceding-sibling”. In this example, we want to find the title of a KeePass entry based on its username.

Relationship operators

The command “preceding-sibling::cell” lists all preceding cells. In this case, the result is the title (framed in green) which corresponds to the given username (framed in red).

RanoreXPath Preceding Sibling

Element Browser Preceding Sibling

In contrast, the command “following-sibling::cell” delivers all following cells. In our case, these are all following cells (framed in blue) that correspond to the given username (framed in red).

RanoreXPath Following Sibling

Element Browser Following Sibling

Identify attributes fields using regular expressions

You can also use regular expressions in attribute conditions to identify attribute fields. In this example, we’d like to filter cell adapters that contain an email address in their text attribute. Regular expressions matching an email address may look like this: “.+@.+\..+’”.

RanoreXPath Regular Expression

Element Browser Regular Expression

The “~” operator instructs Ranorex to filter attribute fields using a regular expression. The “.” in our regular expression matches every single character, while the “+” specifies that the preceding element has to occur one or more times. To escape special characters (such as “.”), enter a backlash before the character.

In our example, every expression will match that contains the character “@” with one or more characters before and after it, followed by a “.”, which is followed by one or more characters.

For more examples on how to use regular expressions in RanoreXPaths, please have a look at this user guide section: RanoreXPath with regular expression.

Identify attributes with dynamic values

Dynamic attribute values change each time an element is displayed anew. Fortunately, dynamically generated content usually has a prefix or postfix. To identify dynamic elements, you can either use regular expressions, as described above, or use the ‘starts with’ or the ‘ends with’ comparison operators:

  • ‘>’: The value of the attribute must start with the given string
  • ‘<‘: The value of the attribute must end with the given string
Conclusion

The RanoreXPath enables you to find and uniquely identify every single UI element of desktop, web and mobile applications. You can use the RanoreXPath operators to make your test suite more robust and identify even dynamic attribute values.

RanoreXPath Overview  RanoreXPath Editor 

The post RanoreXPath – Tips and Tricks appeared first on Ranorex Blog.

Categories: Companies