I have previously used Ranorex 8.1.2 to create a Unit Test that calls my Ranorex project in C#.
After upgrading my Ranorex project to 8.2.1, and the corresponding Ranorex references in my Unit Test I get an error that might be indicating that I'm missing something, or not setting something up correctly.
Specifically I get an Object reference not set to an instance of an object and the stack trace links to the following:
The following is my Unit Test
Code: Select all
public void GoogleCats_RunApplication_ApplicationRan()
{
int error;
try
{
Ranorex.Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
string pathToExecutable = "";
var executableName = "GoogleCats.exe";
#if DEBUG
pathToExecutable = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), executableName);
#endif
string testCase = TestContext.Properties["TestCase"].ToString();
var param = $"{pathToExecutable} {testCase}";
error = TestSuiteRunner.Run(typeof(GoogleCats.Program), param);
if (error != 0)
{
Ranorex.Report.Failure("Failure.");
throw new RanorexException("Test has failed.");
}
Assert.AreEqual(error, 0);
}
catch(Exception e)
{
Report.Error($"Unexpected exception occurred: {e.ToString()}");
error = -1;
throw e;
}
}
To clarify my project runs fine in Ranorex Studio, just not in my Unit Test.