Running Ranorex Test cases from Coded UI Test method

Ask general questions here.
rajkamal04
Certified Professional
Certified Professional
Posts: 2
Joined: Thu Sep 11, 2014 3:25 am

Running Ranorex Test cases from Coded UI Test method

Post by rajkamal04 » Tue Jun 13, 2017 2:25 am

Hi,

I am trying to call a Ranorex test cases from a coded UI Test method.

Here's my code:

Code: Select all

 public void StartRanorexTestCase(string tc)
        {
            Directory.SetCurrentDirectory(@"C:\Dlls\");
            int error = TestSuiteRunner.Run(typeof(Framework.Program), "/tc:" + tc);            
            TestContext.AddResultFile("report.rxzlog");
            if (error != 0)
                throw new RanorexException("Test run failed! See report.rxzlog for further details!");
        }
        [TestMethod]
        public void CodedUITestMethod1()
        {            
            StartRanorexTestCase("SampleTestcase");
        }
However, this code doesn't execute and throw error stating that it cannot found the "Framework.rxtst" in the location".. visual studio 2015/Projects/CodedUIAndRanorex/TestResults/dummyHostname_ 2017-06-12 16_18_53/Out/.

I have copied all the output files generated from both coded UI and Ranorex solution to a folder "C:\dlls".

How can I ensure that this code

Code: Select all

 TestSuiteRunner.Run(typeof(Framework.Program), "/tc:" + tc);            
search for related files in "C:\dlls" but not in coded UI auto generated folder "out" ?

Is there any way that I can force "TestSuiteRunner.Run" to execute the test cases located in " a specific folder". Assuming all the required Ranorex output files are already available in same folder.

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Running Ranorex Test cases from Coded UI Test method

Post by McTurtle » Wed Jun 14, 2017 2:11 pm

Hello rajkamal04,

The coded UI file that you are executing is located in "C:\Dlls\"? Are you using MTM?

Furthermore, it seems that TestSuiteRunner.Run does not have an option to change the directory where it would look for the files.
Ranorex Studio.png
Would it be possible for you to reference the dlls in your test solution and have the Framework.Program and other related Ranorex files in the coded UI output directory?

Regards,
McTurtle
You do not have the required permissions to view the files attached to this post.