Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 3
Joined: Tue Oct 22, 2019 1:21 pm


Post by Worker » Thu Dec 19, 2019 1:11 pm

How to write tests for desktop app using OOP. please give me a few examples.
current i write test in code module files but as i understand it is not OOP it is Procedural programming

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7465
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia


Post by odklizec » Thu Dec 19, 2019 1:29 pm


Is there a particular reason, why you want to write all your tests in code? No matter if you are just starting with Ranorex or you are a hardcore Ranorex user, it's a good idea to use Recording modules as much as possible. Using recording modules speeds the developement of TA solution, plus eliminates potential code errors. Additionally, thanks to integrated repository, it's much easier and secure to access the repo elements in Recording and user code actions, than if using pure code-based approach.

I'm using a lot of code in my tests, but the main test structure is based of recordings and smart folders. I'm using code only if there is no way to achieve what I want with Recording modules (e.g. accessing DB, filling complex forms, comparing tables and similar tasks, which would be too difficult or time consuming to do with recordings).

Additionally, I don't understand the specific need of OOP? But anyway, Ranorex coding is based of C# or VB. Net (if you want), which are both OOP languages. And most of code examples you can find at this forum (majority of them) are C# based.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration