Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!
Software Development News: .NET, Java, PHP, Ruby, Agile, Databases, SOA, JavaScript, Open Source
Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!
If software is configurable, it often means that the software relies on dynamic content – dynamic content is typically based on dynamic identifiers (IDs). Using dynamic IDs often leads to problems in test automation because they are newly generated each and every time an element is displayed. This blog post will illustrate how easy it is with Ranorex to overcome this frequent problem in test automation in an automated way.
First of all we have to identify in general whether we do have a dynamic ID problem or not. Let’s have a look at yahoo.com which is based on YUI (Yahoo User Interface library), a free open source JavaScript and CSS library. This library uses dynamic IDs by default. To analyze the occurrence of dynamic contents you can use Ranorex Spy from the start menu. Use the “Track” button to analyze an element of the web page. When you take a closer look at the attribute “Id” of the just tracked element, you will see that it contains dynamic content (yui_3_8_1_1_13679224741219_543). That leads on the one hand to a poor readability, and on the other hand destroys the testability of the page as the element cannot be identified by its ID anymore after reloading. To illustrate this behavior, add the analyzed element to the repository (using the context menu), reload the website and add the element again. You will see that the same element will occur twice in your repository having different RanoreXPaths based on different IDs. Highlighting the first (red) repository element will not work as an element with the given ID is not available anymore. Also, the second (blue) element will only work until you reload the page again and a new ID is generated. So this way we identified that we do have a dynamic ID problem. (For the sake of completeness: In most of the cases the attribute “Id” leads to dynamic content issues, but of course there can be other attributes creating identification problems as well.)
Identify Dynamic Content
By lowering the weight of the attribute “Id” for the capability “WebElement”, the attribute “Id” will no longer be used for object identification in general. This rule will not only filter out dynamic IDs on yahoo.com but also all other IDs for all other web pages which might not be what you want to achieve. To overcome this behavior, you can add a condition by pressing the “Add Condition” button. This defines which IDs should be filtered and which shouldn’t. You might have found out already that dynamically generated YUI IDs always have the prefix “yui” followed by “_” and a number for x times. This can simply be represented by the regular expression yui(_[0-9]+)+ The matching expression must start with the string “yui” followed by “_” and a number for one or more times. The whole “_” and number stuff must occur one or more times. For further details about regular expression have a look at the regular expressions wiki page or the chapter RanoreXPath in our user guide. Select the attribute you want to match against the regular expression from the dropdown, and then enter the regular expression. Check whether the newly created rule in the left sided list is enabled, and save your changes by pressing the “OK” button. You can check whether the newly added RanoreXPath weight rule works or not by tracking the element again on the website. You will see that the attribute “Id” is no longer used to identify the element, but by the “InnerText” attribute now. You can best see the difference by adding the element to the repository again (green).
Add a Condition to the Weight Rule
Using the RanoreXPath Weight Rules can assist you in automatically creating a robust repository which is the fundament of a robust test automation framework. Also, it gives you the great advantage to continue using the recorder, and no longer being forced to change all your dynamic UI-elements in the repository manually. Just re-record and you will be fine. Since you created a global “path weight rule” for your object identification, the rule will also be applied if you create a repository manually (as described in the blog post “Did you know… that you can manually generate a recording?“).
Conclusion




This blog post will discuss the possibilities to share your automatically generated Ranorex Reports over your local network or via email. There is no need to have Ranorex installed on the machine you will open the shared report. This is possible because the Ranorex Report format is based on XSL, XML and HTML.
Performing the following very simple adaptions, you will be able to open the report file using any common browser.
To share a Ranorex Report you can manually compress all files necessary for reporting and attach the corresponding package to your mail. Or you can simply activate the creation of a zipped report file and attach the generated zipped report file (*.rxzlog) to your mail. These two mentioned methods require that the Ranorex Report Viewer is installed on the machine receiving the shared Report.
To overcome this requirement simply change the extension form “*.rxlog” to “*.html” in the Test Suites properties pane.
After that, you will be able to open the generated report file using any common browser as well as compress all files necessary for reporting and attach them to an email.
Share Over Local NetworkNext to sharing your Ranorex Reports via mail, you can also share them over your company network. You can for example use the Microsoft Internet Information Service (IIS) for doing so.
In Ranorex Studio right-click on the project you want to share the report of and choose “Open Folder in Explorer”. Right-click the “bin” folder and open the “Properties” dialog. Switch to the “Security” tab and click on “Edit” button.
Click on Add, enter “Authenticated Users” in the “Names” edit field and confirm the added permissions by pressing the “OK” button in all opened dialogs.

Define a folder in your Test Suite settings, where the report files should be stored at and change the report file extension from “*.rxlog” to “*.html”.
After doing so, add a website linking to the defined Content Directory in Internet Information Service Manager.
To correctly display your report data you have to add the extension “.data” to the list of “MIME-Types”. To do so, open the “MIME Types” settings dialog. Add a MIME Type for the file name extension “.data” with the type “application/xml”.
Enable “Directory Browsing” for displaying all generated report files on your website.
Now you are able to view your report file over the network using all common browsers.
ConclusionBy performing these easy to follow steps you will be able to share your Ranorex Reports to any machine regardless of a Ranorex installation or even the operating system by opening them using any common browser. You can even share Ranorex Reports to mobile devices.








This blog post illustrates how to automate testing of cross-platform apps implemented with MonoTouch for iOS and Mono for Android with Ranorex.
MonoTouch and Mono for Android, both developed by Xamarin, are commercial implementations of Mono – a cross-platform implementation of C# – for iPhone and Android-based smartphones.
Using these two implementations it’s easy to reuse most of your existing code when porting from Android to iOS or vice versa. Next to that it’s possible to import existing .NET libraries and to use them in your Android/iOS apps.
Ranorex supports test automation for both, Mono Touch and Mono for Android. Simply follow the steps below to make your cross-platform app testable.
Make Your MonoTouch (iOS) App Testable with Ranorex
To instrument your MonoTouch app you simply have to add the Ranorex automation library for iOSÂ to your MonoTouch project as native library.
To instrument your Mono for Android app simply follow the step by step instructions below.





public override bool DispatchKeyEvent (KeyEvent e)
{
Ranorex.RanorexAndroidMonoInstrumentation.dispatchKeyEvent(e);
return base.DispatchKeyEvent (e);
}
protected override void OnResume ()
{
base.OnResume ();
Ranorex.RanorexAndroidMonoInstrumentation.onResume(this);
}
protected override void OnPause ()
{
base.OnPause ();
Ranorex.RanorexAndroidMonoInstrumentation.onPause(this);
}


Following these simple step by step instructions will make your MonoTouch and Mono for Android apps accessible for Ranorex and nothing should be standing between you and your robust cross-platform test automation.
To get started with mobile test automation, have a look at the chapters “Android Testing” and “iOS Testing” in our user guide.
