NCover 初次使用結果

來源:互聯網
上載者:User
NCover 初次使用結果

參考如下文章,獲知使用方式。
http://blog.csdn.net/haibo1228/article/details/4291890

NCover 版本 NCover-1.5.8

下載地址:http://downloads.ncover.com/NCover-1.5.8.zip

--------------------------------------------------------
測試代碼如下:

C#代碼

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());              }                          }      }  }



--------------------------------------------------------
測試結果如下:

C:\Program Files\NCover>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 Files\NCover>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 *****************

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

這裡運行了兩次,每運行完一次後,開啟 Coverage.Xml 可查看到代碼覆蓋情況。


--------------------------------------------------------
有個問題,如果程式更加複雜,如何測覆蓋率?

--------------------------------------------------------
另,只找到 1.0.1 的源碼
http://nchc.dl.sourceforge.net/project/ncover/ncover/ncover-1.0%20RC2/ncover-1.0.1.zip

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.