Unit test and test coverage in Ranorex

Ask general questions here.
Posts: 183
Joined: Wed Aug 06, 2014 12:00 pm

Unit test and test coverage in Ranorex

Post by rastek » Sun Feb 21, 2021 12:57 pm

I want to use Unit Test and cove coverage features in Ranorex but I do not know where to start (I know SharpDevelop and openCover thinks please do not write me these in the first)

I really wonder why there is no official Ranorex page for some feature existing in Ranorex -> Tools -> Unit Test and Code Coverage
We only know this options exist in Ranorex but no one knows how to use it, and never answered fully in the previous pots

I see few posts about Code Coverage , most of them points of this link which does not open

http://community.sharpdevelop.net/blogs ... Cover.aspx

I found PDF of this page which tels opencover. However it is still unclear where to downlaod and how to use it Ranorex.

How to write a unit test in Ranorex ? using nunig nugets ?

Is code coverage about covering of some development code with unit test, or its coverate of test code itsef ? ıf so whats is coverage based on ?

User avatar
Certified Professional
Certified Professional
Posts: 16
Joined: Tue Jan 19, 2021 5:24 pm
Location: Colorado, US

Re: Unit test and test coverage in Ranorex

Post by vseaver » Tue May 04, 2021 10:58 pm

Hi Rastek, if you want to unit test your C# code from Ranorex you're going to want to pull in the import the libraries from your original code and then test them. From a coverage perspective that usually something you would implement from inside your AUT or application under test.

First you need to add a reference to the the code you want to unit test.
Do that like this:
add refernce.png
add refernce.png (42.99 KiB) Viewed 34 times

Then include it in your code here:
use refernce.png
use refernce.png (36.14 KiB) Viewed 34 times

Then instantiate whatever you want to test in your code and make assertions against it.
Sales Engineer @ Ranorex