Home  >  Article  >  Backend Development  >  NCover first use results

NCover first use results

巴扎黑
巴扎黑Original
2016-12-20 11:36:521677browse

NCover first use results

Refer to the following article to learn how to use it.
http://blog.csdn.net/haibo1228/article/details/4291890

NCover version NCover-1.5.8

Download address: http://downloads.ncover.com/NCover-1.5.8.zip

------------------------------------------------- -------
The test code is as follows:

C# code

using System;  
using System.Collections.Generic;  
using System.Text;  
  
namespace NCover_HelloWorld  
{  
    class Program  
    {  
        public static String getData_a()  
        {  
            return "00001";  
        }  
  
        public static String getData()  
        {  
            return "Hello World !";  
        }  
  
        static void Main(string[] args)  
        {  
            Console.WriteLine(args.Length);  
            if (args.Length > 0 && args[0].ToLower() -- "a")  
            {  
                Console.WriteLine(getData_a());  
            }  
            else  
            {  
                Console.WriteLine(getData());  
            }  
  
              
        }  
    }  
}



------------------------------- ----------------------------
The test results are as follows:

C:Program FilesNCover>NCover.Console "NCover_HelloWorld.exe" a
NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http://ncover.org
Copyright (c) 2004-2006 Peter Waldschmidt


Command: NCover_HelloWorld.exe
Command Args: "a"
Working Directory:
Assemblies:
Coverage Xml: Coverage.Xml
Coverage Log: Coverage.Log

Waiting for profiled application to connect...Connected
Configuring Profiler...
************ ***** Program Output *******************
1
00001
********************** End Program Output *****************

C:Program FilesNCover>NCover.Console "NCover_HelloWorld.exe"
NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http: //ncover.org
Copyright (c) 2004-2006 Peter Waldschmidt


Command: NCover_HelloWorld.exe
Command Args:
Working Directory:
Assemblies:
Coverage Xml: Coverage.Xml
Coverage Log: Coverage.Log

Waiting for profiled application to connect...Connected
Configuring Profiler...
************************ Program Output ************ *******
0
Hello World!
********************** End Program Output ****************** *

-------------------------------------------------- ---------

This is run twice. After each run, open Coverage.Xml to view the code coverage.


-------------------------------------------------- ---------
I have a question, if the program is more complex, how to measure the coverage?

------------------------------------------------ --------
Also, only the source code of 1.0.1 was found
http://nchc.dl.sourceforge.net/project/ncover/ncover/ncover-1.0%20RC2/ncover-1.0.1.zip


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn