浏览 3837 次
锁定老帖子 主题:NConvert 初次使用结果
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (4)
|
|
---|---|
作者 | 正文 |
发表时间:2011-07-06
参考如下文章,获知使用方式。 http://blog.csdn.net/haibo1228/article/details/4291890 NCover 版本 NCover-1.5.8 下载地址:http://downloads.ncover.com/NCover-1.5.8.zip -------------------------------------------------------- 测试代码如下: 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 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-11-08
可惜不是免费的
|
|
返回顶楼 | |