Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cross-process coverage = HTTP tests coverage support with ASP.NET Core?
GreenMoose
#1 Posted : Tuesday, November 29, 2016 10:09:26 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 507

Thanks: 145 times
Was thanked: 66 time(s) in 64 post(s)
Hi,

I'm curious about the new "cross-process" functionality and especially related to integration tests with HTTP endpoints.

Today the main drawback with our HTTP integration tests (localhost/IIS) are that they are not included at all in impact analysis nor code coverage.
I'm curious if this cross-process means that we can e.g. utilize ASP.NET Core and get code coverage etc. for HTTP integration tests?

Thanks.
Remco
#2 Posted : Tuesday, November 29, 2016 10:30:43 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

It's hard for me to give you a straight answer on this without knowing more about your setup, but I can give more details about how the cross-process coverage works so that you can target your expectations :)

When NCrunch starts to execute tests in its task runner, it sets an environment variable containing an ID. This ID is then used to identify a chunk of shared memory that is allocated by the task runner.

Because child processes always inherit environment variables from their host process under Windows, any process created by the task runner (regardless of when or how it is created) will inherit the environment variable containing the ID.

If the child process contains code that has been instrumented by NCrunch (i.e. you're running NCrunch-generated assemblies inside this process), the instrumentation will kick in on the first line of executed code and will load the shared memory using the ID inherited by the child process. Code coverage can then be stored in the shared memory where it can be retrieved by the host task runner process at the end of each test run.

My understanding is that ASP.NET Core assemblies need to be built using the either the legacy project.json system or the new MSBuild system released with VS2017. In either case, they cannot be built without special handling by NCrunch (which doesn't yet exist). Because NCrunch can't yet build these projects, it also can't instrument them. Without instrumentation, there is no way to extract code coverage for the projects. So I expect that you'll probably be unable to use this system to get code coverage for ASP.NET Core, but it should be possible to get it for HTTP tests running classic .NET assemblies.
1 user thanked Remco for this useful post.
GreenMoose on 11/30/2016(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.029 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download