question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenCover tool only intercepts the last test assembly

See original GitHub issue

Internally OpenCover intercepts the test alias and runs it. The problem however is that the test alias only executes once, for the last test-dll even if there are multiple assemblies found by the globber.

So when running a test runner separately all matching test assemblies are processed…

Task("Run-Unit-Tests")
    .IsDependentOn("Build")
    .Does(() =>
{
    XUnit("./src/**/bin/" + configuration + "/*.Tests.dll");
});

But when running the same test runner within OpenCover, the same test assemblies are found but only the last one is intercepted and processed.

Task("Run-Code-Coverage")
    .IsDependentOn("Build")
    .Does(tool =>
    {
        tool.XUnit("./src/**/bin/" + configuration + "/*.Tests.dll");
    },
    new FilePath("./result.xml"),
    new OpenCoverSettings()
);

The same behavior is observed both with MSTest and XUnit. Perhaps because both of them iterates over the collection and executes the test assemblies one by one?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:18 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
jenshorncommented, Mar 11, 2016

@patriksvensson Well I’ll be damn… It worked! 😃 @devlead As the XUnit2 tool seem to run fine we can leave XUnit1 as is. At least until someone else stumbles over an issue with it 😃

Thanks!

1reaction
devleadcommented, Mar 11, 2016

@patriksvensson yeah that would work, could be an issue if tests depend on xunit pre 1.9.2 it could potentially be some breaking changes, but worth a shot 😉 @phrusher One way would be to make the XUnit 1 alias smarter, but that would likely be served best as a separate issue non related to OpenCover.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Open Cover filters how to avoid test assembly files from ...
2 Answers. First run OpenCover without any filters. Now you can look at the XML report produced (or you can use ReportGenerator to...
Read more >
Fine Code Coverage
Fine Code Coverage provides code coverage using one of 3 different coverage tools. In previous releases there were two coverage tools being utilised,...
Read more >
How to Use OpenCover Tool for Measuring the Code ...
Learn the importance of evaluating code coverage and explore an example of measuring code coverage with the OpenCover tool.
Read more >
Track your Test Coverage with OpenCover - Niche Software
Tests ]* -[*.IntegrationTests]* limits the results to only the assemblies that make up my application (which all start with Document ) and ...
Read more >
Instructions for Authors | JAMA Network Open
Include a cover letter and complete contact information for the corresponding author (affiliation, postal/mail address, email address, and telephone number) and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found