Is dotCover coverage accurate even if some tests fail?
I have some nUnit tests that are currently failing. For some corporate reasons, I don't want to spend any time trying to fix those tests right now. But I am running a dotCover coverage report on these tests, and I want to know whether the "Uncovered" line count is inclusive or exclusive of these failing tests. To put it another way, if all the tests were to pass, would the coverage percentage increase?
These are new projects, so I have no baseline to understand whether the figure has dropped.
Yes, the tests will be fixed in due course, but not today / now.
1 answer
-
answered 2022-05-04 10:02
Ermiya Eskandary
dotCover's 'Uncovered' line count is inclusive of the failing tests, meaning that if you fixed the tests it should decrease as more 'lines' are now covered by successful tests.
Yes, the coverage percentage would also increase in proportion to the number of lines covered increasing.
Failing tests -> less lines covered -> lower test coverage %
Passing tests -> more lines covered -> higher test coverage %
do you know?
how many words do you know
See also questions close to this topic
-
site only opens in CefSharp
zaakr.net is a site can be opened only in zaakr.exe application or through android(.apk), when opened in browser u been redirected to https://browser.zaakr.net so u download there application, (.exe) file is using cefsharp as a browser so it can access website, from 2 month i could open it from chromium as cefsharp uses chromium, now i can't access website through chromium for some reason idk, i even made a cefsharp browser myself using visual studio nothing worked all the time i been redirected to browser.zaakr.com, i want to access through any browser that have devtools available for a project, note that application zaakr.exe is still using cefsharp even the older version still can access site. i would appreciate any help, sry for any spelling mistakes, thanks.
-
C# MariaDB Update Function working in DataStore but not updating in .NET Application
My initial issue is that my database does not update when I call on this specific code. I am not sure if it is C# itself or the update query that I am calling.
string _connectionString = "validConnectionstring"; using (MySqlConnection _mySqlConnection = new MySqlConnection(_connectionString) { _mySqlConnection.Open(); using (MySqlCommand command = new MySqlCommand("UpdateProfileStatus", _mySqlConnection)) { command.Transaction = _mySqlConnection.BeginTransaction(); command.CommandTimeout = TimeSpan.FromSeconds(60).Seconds; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@_username", "test"); command.Parameters.AddWithValue("@_status", true); command.ExecuteNonQuery(); } _mySqlConnection.Close(); }
I get no updates in my database but my console logs that the query is executed returning the value of 1 but there is no update that actually happens in my DB. Is there something in my code to reason why it is failing?
Here is the stored procedure that I have for the update command
CREATE PROCEDURE UpdateProfileStatus(_username VARCHAR(25), _status BOOL) UPDATE Profile SET status = _status WHERE username = _username;
I know the Stored Procedure works but am not sure why my .NET application is not responding to my procedure call. Is it something to do with my implementation of the parameters or is it my procedure itself?
-
How to add a new Model visually in Mac OS visual Studio
I do not see any choice to create a model in Mac visual studio? I In the windows version the Class created with its imports
using Linq
using Threading.Tasks
using Collection.Generic
-
NUnit Test case
using System; using System.Collections.Generic ; using System.Linq; using System. Text; using System. Threading. Tasks; namespace DemoAppCore{ public class Program { public static Enployee e1 = null; public static Employee EnrollEmployee() { return new Employee(){Name="Tom", Id="A1234" }; } } public class Employee { public string Name { get; set; } public string Id { get; set; } }
Please anyone help me to write a C# NUnit Test case for this program.I tried many different way to solve this program but none of the test cases work. Class Program This class contains a method, 'EnrollEmployee' In this method, an object for "Employee" is created and returned.
Class Employee This is a model class containing Name and Id property.
Write respective test methods for the following : a) Variable "e1" is null b) On invoking method 'EnrollEmployee', the object returned is not null. c) The "Name" property is equal to "Tom" by invoking method 'EnrollEmployee' d) The "Id" property is equal to "A1234" by invoking method 'EnrollEmployee'
Implement:
- Add the required test attribute for the class FunctionalTest
- Add the required test attribute for each test methods
- Wherever applicable, Assert whether the actual is equal to the expected
-
Running Playwright dotnet tests on Azure DevOps
I'm trying to execute Playwright dotnet tests with Nunit framework on Azure DevOps. I'm unable to execute testcases as and when I try to install playwright as a part of pipeline, there is an error thrown and build gets failed with the following message
Couldn't find project using Playwright. Ensure a project or a solution exists in D:\a\1\s, or provide another path using -p. Below is my azure pipeline steps, Can someone please help me where exactly the issue is and I have tried both Windows and latest Ubuntu agents
# ASP.NET Core (.NET Framework) # Build and test ASP.NET Core projects targeting the full .NET Framework. # Add steps that publish symbols, save build artifacts, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core trigger: - master pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: UseDotNet@2 displayName: 'Install .NET' inputs: packageType: 'sdk' version: '6.0.x' installationPath: $(Agent.ToolsDirectory)/dotnet includePreviewVersions: true - task: DotNetCoreCLI@2 inputs: command: 'build' projects: '**/*.csproj' - task: DotNetCoreCLI@2 inputs: command: 'custom' custom: 'new' arguments: 'tool-manifest' - task: DotNetCoreCLI@2 displayName: 'Installing Playwright Cli' inputs: command: 'custom' custom: 'tool' arguments: 'install Microsoft.Playwright.CLI' - task: DotNetCoreCLI@2 displayName: 'Building tests project' inputs: command: 'build' projects: '**/*Tests*.csproj' - task: DotNetCoreCLI@2 displayName: Run Playwright Install inputs: command: custom custom: 'tool ' arguments: run playwright install - task: DotNetCoreCLI@2 displayName: 'Run tests' inputs: command: 'test' projects: '**/*Tests*.csproj' testRunTitle: 'new pipeline'
-
How to run NUnit 2 tests in visual studio 2022
I am trying to execute NUnit tests on a legacy project in Visual Studio 2022 professional. Migrating from NUnit 2 to NUnit 3 is not yet an option, and part of the team works with Visual Studio 2019. The problem I am facing is that the tests are not executed by VS 2022, without any error message on the attempt.
The test explorer displays the following after executing the test (and the console output finishes with a successful build):
The NuGet Package manager had NUnit 2.6.1 already installed. I additionally installed the packets
NUnit.Extension.NUnitV2Driver
andNUnit.Extension.NUnitV2ResultWriter
. A test adapter seems only available for NUnit3 (NUnit3TestAdapter
, which I also installed). I enabled all the packages for the individual project as was commented in this question. Is there anything else to install/configure that I could be missing to make this work? -
.Net Core or .Net Framework applications - Find code coverage for external tests / functional tests
I am looking for a tool that would help in finding code coverage when functional or end to end (white box) tests are executed, that calls the API or UI application, that has been deployed in QA environment (separate servers ).
The end to end tests code is written in C# and selenium using NUnit framework and are executed via Jenkins using dotnet test command, that calls the .Net applications deployed in separate servers.
Could you please recommend on how to get a good code coverage for functional or end to end tests.
-
Exception: Cannot Advance beyond TotalWorkUnits while running dotcover command line for code coverage on linux environment
I am getting the above error while running dotcover command line tool for getting code coverage of a .NetCore Application on linux environment. Below are the commands for analysis
dotCover.sh cover-dotnet --TargetArguments="Dummyapi.dll" --Output=Report.html --ReportType="HTML" --StartInstance=100 dotCover.sh send --Command=Cover --Instance=100 dotCover.sh send --Command=GetSnapshotAndKillChildren --Instance=100
and exceptions in logfile are
--- EXCEPTION #1/2 [InvalidOperationException] Message = “Cannot Advance beyond TotalWorkUnits.†ExceptionPath = Root.InnerException ClassName = System.InvalidOperationException Data.Units = 1 Data.CurrentUnits = 0 Data.TotalWorkUnits = 0 HResult = COR_E_INVALIDOPERATION=80131509 --- Outer --- --- EXCEPTION #2/2 [LoggerException] Message = “Cannot Advance beyond TotalWorkUnits.†ExceptionPath = Root ClassName = JetBrains.Util.LoggerException InnerException = “Exception #1 at Root.InnerException†HResult = COR_E_APPLICATION=80131600 StackTraceString = “ at JetBrains.Util.LoggerBase.Log(LoggingLevel level, String message, Exception ex) at JetBrains.Diagnostics.LogEx.Error(ILog this, Exception ex, String message) at JetBrains.Util.Logging.Logger.LogException(Exception ex) at JetBrains.Application.Progress.ProgressIndicatorBase.Advance(Double units) at JetBrains.dotCover.Workspace.Impl.Reporting.Model.Json.JsonReportBuilder.WriteNodeRec(CoverageNodeId nodeId, Boolean isRoot, ReportBuilderContext context, ICoverageNodeChildrenEnumerator`1 recursiveChildrenEnumerator) at JetBrains.dotCover.Workspace.Impl.Reporting.Model.Json.JsonReportBuilder.<>c__DisplayClass9_0.<BuildReport>b__0() at JetBrains.Application.Threading.Tasks.TaskHost.AccessViolationCatcher(Action action) at JetBrains.Application.Threading.Tasks.TaskHost.<>c__DisplayClass36_0.<Create>b__1(Object state) at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) at System.Threading.Tasks.Task.ExecuteEntry() at System.Threading.Tasks.TaskScheduler.TryExecuteTask(Task task) at JetBrains.Application.Threading.Tasks.Scheduler.JetScheduler.ExecuteTask(Task task) at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.EnqueueNextTask() at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.ThreadPoolProc() at JetBrains.Util.Reflection.CallStackAnnotation.CatchAnnotatedInvocation[TClassOfNewFrame](String methodNameOfNewFrame, Action actionToAnnotate) at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.<>c__DisplayClass6_0.<.ctor>b__0() at System.Threading.Thread.StartCallback()