1

We have implemented a test and some helper classes in the same file. When trying to run the test, we get a compiler error stating:

Compile Error: Argument 1: cannot convert from 'X' to 'Ranorex.Core.Testing.ITestModule'

When I compile using the "Build/Rebuild solution" menu, it works. To me this does not seem to be a compiler error.

How can I fix that compiler error?

2

The problem is that you have defined multiple classes in the same file.

When starting the test, Ranorex tries to run the class in which the cursor is currently located. If there's only one class per file, the cursor will always be in the test class and the test class can be converted to ITestModule.

With multiple classes per file, the cursor might be placed in a different class that cannot be converted to ITestModule and it will generate a compiler error.

To me this violates several usability principles. IMHO Ranorex should

  • disable the Run button in such a case
  • not generate a compiler error but a runtime error, because the code can be compiled. It's just not possible to perform the case at runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.