Test execution not possible: Test execution fatal crash with NullReferenceException

Ask general questions here.
qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Fri Nov 02, 2018 4:18 pm

Hi,

I have a solution with different projects and I experienced a problem with executing a test case. In two of the projects where I did not have a test suite with test suite with test cases I could not excute them after creating them. I am not sure if it has something to do with Ranorex 8.3.0 but I only had these problems after updating to 8.3.0.
When I try to execute one of the new test cases the console windows only pops up for a second and closes right away. There is no report or any other error message. I found a Ranorex compressed report (rxzlog-file) within the bin\Debug\ folder with the following error message:

Code: Select all

Test execution fatal crash 

 Test executable crashed with unhandled exception.

 Please ensure all required prerequisites are installed:
 - .Net Framework 4.5
 - VC++ Redistributable (2017)

 For more information visit: https://www.ranorex.com/help/v8.3/xcopy-deployment
  
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
 bei Ranorex.Core.Resolver.MainInvoker.Invoke(Assembly callerAssembly, String startUpObject, String[] args)
 bei __RxMain.__RxProgram.Main(String[] args) in D:\5_Ranorex\Base\BaseLibrary\obj\Debug\__RxPrograms.g.cs:Zeile 32.  
This lead me to this question: problem-with-ranorex-core-resolver-in-8-0-0-t11808.html.
I tried the "Copy runtime to output"-setting and all the Target CPU settings but nothing helped. I never changed anything in the compiling settings before. I even copied the Ranorex.Core.Resolver.dll into the obj\Debug\ folder but nothing helped. The xcopy-deployment article did not help either as I am not trying to run the test where no Ranorex is installed.

The tests I created in another project but in the same solution before the update to Ranorex 8.3.0 still run.

I have no more ideas what I have to do to make the test run. Can anybody help me, please? Did anybody have the same issue maybe?

Thanks
U

User avatar
RobinHood42
Posts: 239
Joined: Fri Jan 09, 2015 3:24 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by RobinHood42 » Tue Nov 06, 2018 9:20 am

Hi,

Are you using Ranorex 8.3 on that specific machine to build and execute the test? Ensure to completely erase the output folder of your project, e.g. bin/Debug, and rebuild the project(s).

Furthermore, I would recommend a clean re-install of Ranorex:
  • -> Uninstall Ranorex from your machine
    -> Reboot your machine ( !!! )
    -> Install Ranorex using the setup executable
Cheers,
Robin :mrgreen:

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Tue Nov 06, 2018 12:15 pm

Thank you, Robin, for your suggestions!

Unfortunately neither clearing the output folder nor re-installing Ranorex 8.3 helped.

After trying around a little more I found out that you can't run test suites in a test suite module library project. I'm not sure if this is on purpose but if it is to me it makes no sense that I'm able to add a test suite to this kind of a project.

This leaves me with the question how I can debug code in a test suite module library project. If I use code of the library in a test suite project and an error occurs the report will only inform me about the method the error occurs in but not the line number... But I will open a new topic for this.

qwertz

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by krstcs » Tue Nov 06, 2018 3:29 pm

The Test Suite Library project type compiles to a DLL, so it isn't executable on Windows directly. You need to go into the project's properties and change the output to a Console Application type.
Shortcuts usually aren't...

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Tue Nov 06, 2018 4:49 pm

Hey krstcs,

even that does not change that the test case cannot be executed. Same error. Ranorex also has a popup dialog to tell you to change the output type to console application to be able to execute the test case.

Finally I found out that if I use the Debug-dll of the test suite module library project in the test suit project and then execute a test case with code from the test suite module library project (with breakpoints), the execution recognizes the breakpoints from there and I am able to debug it! :D

Rikke Svendsen
Posts: 4
Joined: Wed Nov 07, 2018 11:47 am

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by Rikke Svendsen » Thu Nov 08, 2018 1:39 pm

Hi, I have the same problem.

I do not understand what your are doing to start the test suite??

I am not a developer, so I do not understand the last answere of what you have been doing. Can you maybe explain with screenshots what you are doing?

And will it never be possible to run a testsuite in a normal way - with clicking at the Run buttom in Ranorex??

I have just tried to test the new stuff in Ranorex 8.3 and the possibilities with more than one test suite in one solution. But It seems that it not working very good??

/Rikke:)

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Thu Nov 08, 2018 2:14 pm

Hi Rikke,

I am not quite sure what exactly you are asking. I'll try to answer and hope it will help you:
I do not understand what your are doing to start the test suite??
I usually start test suites by right-clicking them and selecting 'Run test suite'.
And will it never be possible to run a testsuite in a normal way - with clicking at the Run buttom in Ranorex??
Sure it is possible to use the Run button. But if you have more than one project in your solution you have to be careful which test suites you start with it. You can configure that clicking the chevron icon next to the Run button.

Furthermore, what is important:
  • Your project has to be a Ranorex test suite and NOT a Ranorex test suite module library. The second cannot run tests. That will lead to the error I described above.
  • In the project properties of your project you have to set the output type to Console application. But Ranorex will tell you to do that if you haven't and try to run a test.


I hope this helps.

qwertz

Rikke Svendsen
Posts: 4
Joined: Wed Nov 07, 2018 11:47 am

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by Rikke Svendsen » Fri Nov 09, 2018 8:50 am

Hi qwertz,

Yes, you have understood it right. BUT when you are writing:

Your project has to be a Ranorex test suite and NOT a Ranorex test suite module library.

How can I then use the recording modules in another project?? I will try to explain what i mean in the picture

I hope ypu can answere this question.

/Rikke
Attachments
Ranorex question.png
Ranorex question.png (187.76 KiB) Viewed 47 times

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Fri Nov 09, 2018 12:18 pm

Hey Rikke,

I think this should help you:
https://www.ranorex.com/help/latest/ran ... estsuites/

Cheers,
qwertz

Rikke Svendsen
Posts: 4
Joined: Wed Nov 07, 2018 11:47 am

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by Rikke Svendsen » Fri Nov 09, 2018 1:39 pm

Hi,

Im sorry, i am not able to run the the testsuite either. I still get that message you have describe in the first:(

The difference between my problem and what the describtion you send is thar i have two projects and in the description there is only one project. So i do not find a solution for that.

I will fight further - but i am soon getting out of solutions:(

/Rikke

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Test execution not possible: Test execution fatal crash with NullReferenceException

Post by qwertz » Fri Nov 09, 2018 2:29 pm

Hi Rikke,

I also have multiple projects and I can use modules of one project in the test suite of another project. To be able to do that you need to add the dll-file of the first project in the second as a reference. But as you could use the module in your test case, you should have already been able to do that.

Are you sure that you two projects are Ranorex test suites? Unfortunately, I don't know how to check that after the project is created.

If you are sure, can you describe step by step what you are doing to run your test suite? Maybe I can help then. In my case the solution to the error was the project kind.

qwertz