Using Page Object Models in Ranorex

Ask general questions here.
charleyrobertson
Posts: 8
Joined: Thu Sep 29, 2022 4:33 pm

Using Page Object Models in Ranorex

Post by charleyrobertson » Mon Dec 12, 2022 2:27 pm

Hello everyone,

My colleague and I are in the process of trying to find the best development practices for ranorex. We are specifically using User Code Modules throughout our test packs and hope to keep it this way.

We were wondering if there was any advice for creating page object models in Ranorex as it does not seem to have the same support for adding these as other automation software does.

Any help and/or advice would be appreciated. :)

IvanF
Posts: 151
Joined: Thu Aug 11, 2022 8:55 pm

Re: Using Page Object Models in Ranorex

Post by IvanF » Mon Dec 12, 2022 9:07 pm

Hi, one of the considerations could be leveraging the Ranorex project repository in your code modules (which assumes it has been built via Spy).

Once the repository exists, it can be referenced from the code file with a line like this

public static {SolutionName}Repository repo = {SolutionName}Repository.Instance;

Which then allows you to call objects with syntax like this

repo.ApplicationUnderTest.InitInvest.Element.SetAttributeValue("Value", initialInvAmount);