Forum Discussion

dingrn_1's avatar
12 years ago

AQTime can't profile code coverage on a unit test project based on .NET 4 and NUnit

Hi guys,



I recently encounter a problem with AQtime when try to use it to profile code coverage on a unit test project which is based on .NET framework 4 and asserted by NUnit. Your comments and ideas are highly appreciated. 



Suppose I have a unit test project, which is based .NET framework 4.0, and is asserted by NUnit. I try to execute unit tests in NUnit console, and ask AQTime to launch NUnit when I run AQTime code coverage profiler. However, after all tests are done in NUnit, AQTime always shows that no routine, nor lines are hit. Therefore, the coverage shows in AQTime is always 0.0%. Not sure why this is happening, since it works fine for another unit test project which is based on .NET framework 3.5.



We have another unit test project which is based on .NET 3.5, and AQTime works very well without issue. Since our new test project has to base on .NET4, so change its base to 3.5 is not an option.

 

Please let me know if you have met similar situations, and your input is appreciated. Thanks in advance.









  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)
    Hi Kevin,



    It looks like NUnit console is running not the same version of .NET Framework as the version the profiled assembly was built for. This makes NUnit load the assembly to a separate process where the needed version of the framework is initialized. However, you are not profiling that other process apparently, you are profiling the main NUnit process. So, try working around the problem by running the console under the same version of .NET Framework. This can be done through the <supportedRuntime> element.