How to define repository item programmatically.

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
felixk91
Posts: 34
Joined: Wed Feb 10, 2016 11:16 pm

How to define repository item programmatically.

Post by felixk91 » Tue Aug 20, 2019 11:31 pm

Hi everyone,

I am interested to know what will be the right way to define object repository programmatically without any recording.
I am trying to create test suite using Visual Studio 2017, SpecFlow and Nunit framework for functional BDD test framework.
My target is to have set of objects that can be defined before run and accessible during run, something similar to PageObject model in web testing.
Any code examples would be highly appreciated.

Thanks,
Felix.

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

Re: How to define repository item programmatically.

Post by odklizec » Wed Aug 21, 2019 7:30 am

Hi,

I'm afraid, there is currently no way to define repository elements programmatically. In fact, if you are going to use pure Ranorex libs in VS (i.e. without Ranorex Studio), you will have to live without Ranorex repository, which is exclusive to Ranorex Studio (as well as test suites and other goodies).

What you will have to do is to create your own set of Ranorex xpaths, kept in source code of your tests and eventually, use Find method and its derivatives, to find elements based of existing xpaths or certain attributes. Unfortunately, without seeing your AUT and tests you are supposed to automate, it's impossible to provide you with examples related to your problem.
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

User avatar
felixk91
Posts: 34
Joined: Wed Feb 10, 2016 11:16 pm

Re: How to define repository item programmatically.

Post by felixk91 » Fri Aug 23, 2019 12:03 am

Hi odklizec,

Thank you for replay.
I had to create my own "repository" almost the same way it is done within Ranorex.
If anyone will be interested I can drop an example later.

Thanks,
Felix.

theraviz
Posts: 111
Joined: Sun Apr 14, 2019 9:46 am

Re: How to define repository item programmatically.

Post by theraviz » Mon Aug 26, 2019 2:01 pm

Yes please. Would like to know how you did it.