How to integrate Ranorex to jenkins

Best practices, code snippets for common functionality, examples, and guidelines.
disastor
Posts: 1
Joined: Thu Aug 23, 2018 11:52 am

How to integrate Ranorex to jenkins

Post by disastor » Thu Aug 23, 2018 11:57 am

Hello :D
I'd like to Integrate ranorex to jenkins and i have 2 staff i'd like to check
First should only on the slave where the Ranorex automation should be triggered that Jenkins is not started as a service or on both master and slave
Second i'm working with JenkinsFile pipline and i'd like execute ranorex test from this script (jenkinsfile) but i couldn't found any solution any ideas

Thanks a lot :P

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

Re: How to integrate Ranorex to jenkins

Post by odklizec » Thu Aug 23, 2018 2:55 pm

Hi,

In case you are not planning to run tests on master machine, it should be OK to have it (master) started as a service? At least I believe so ;) The service-based limitation should apply only on systems, where you wan to run your tests. Ranorex (any TA tool) cannot access GUI if the app is started from service-based environment.

Unfortunately, I cannot help you with JenkinsFile. I'm not using pipeline (yet) ;)
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

MichielV
Posts: 17
Joined: Fri Sep 07, 2018 8:12 am

Re: How to integrate Ranorex to jenkins

Post by MichielV » Fri Nov 09, 2018 10:00 am

Below is an example of the pipeline code I'm using. I have a variable with the script name (§{name} in the example, then
- fetch the script from source control (using svn here)
- update packages (optional - only needed if you use nuget packages)
- build using msbuild (make sure you have windows development packages installed and msbuild jenkins plugin installed and configured)
- run the compiled ranorex test using "bat" and the command line options, see https://www.ranorex.com/help/latest/ran ... ex-studio/

if you store the compiled versions, you could also create a simplified version just fetching the compiled test and running it using bat command with the command line options you need

stage(name) {
//get from SVN
doSvnCheckOut("${ranorexScriptsSVN}${name}","${name}")

//update nuget packages
bat "c:\\nugetCLI\\nuget.exe restore .\\${name}\\${name}.sln"

//build
bat "\"${tool 'MSBuild15'}\" .\\${name}\\${name}.sln ${buildConfig}"

//run test
bat ".\\${name}\\${name}\\bin\\release\\${name}.exe /reportfile:${name}.rxlog
}