Command line arguments to NCover.

44 views
Skip to first unread message

Julio César Carrascal Urquijo

unread,
Aug 27, 2007, 10:10:10 PM8/27/07
to TestDriven.NET Users
Is there a way to pass extra command line arguments to NCover? I'd
like to pass the following command line to exclude designer generated
code for resource files:

/ea System.CodeDom.Compiler.GeneratedCodeAttribute

Or in case there that isn't an option to do that... do you know of
another way to exclude the (.Designer.cs) files generated by Visual
Studio when editing resource files that doesn't involve the
CoverageExclude attribute?

Thanks.

Jamie Cansdale

unread,
Aug 28, 2007, 1:55:19 PM8/28/07
to TestDri...@googlegroups.com, Grant
Hi Julio,

> Is there a way to pass extra command line arguments to NCover?
>

I'm afraid there isn't an option to do this at the moment. I will add
it to my issue tracker as a feature request.

I don't think there is a way to exclude methods based on their source
file in NCoverExplorer. Perhaps this could be added in a future
version. I've CCed Grant Drake with the suggestion.

Regards,
Jamie.

--
http://www.testdriven.net
http://weblogs.asp.net/nunitaddin

Jay Flowers

unread,
Aug 28, 2007, 2:22:46 PM8/28/07
to TestDri...@googlegroups.com
I think there is a way with Attributes to ignore.  I don't remember the source for my memory but it might help you Google your way to a solution...

--
Jay Flowers
----------------------------------------------------------------------
http://jayflowers.com
---------------------------------------------------------------------

Julio César Carrascal Urquijo

unread,
Aug 28, 2007, 3:03:23 PM8/28/07
to TestDriven.NET Users
Hi

On Aug 28, 12:55 pm, "Jamie Cansdale" <jcansd...@gmail.com> wrote:
> Hi Julio,
>
> > Is there a way to pass extra command line arguments to NCover?
>
> I'm afraid there isn't an option to do this at the moment. I will add
> it to my issue tracker as a feature request.

That would help me a lot. Thank you.

If you can please make it a per project configuration setting. I
wouldn't mind if I can add a config file to my subversion repository
so people on my team share those settings.


> I don't think there is a way to exclude methods based on their source
> file in NCoverExplorer. Perhaps this could be added in a future
> version. I've CCed Grant Drake with the suggestion.

This would be another great solution because NCoverExplorer could
automatically exclude files generated by Visual Studio. Those aren't
usually tested either.


> Regards,
> Jamie.
>
> --http://www.testdriven.nethttp://weblogs.asp.net/nunitaddin

Julio César Carrascal Urquijo

unread,
Aug 28, 2007, 3:15:09 PM8/28/07
to TestDriven.NET Users
On Aug 28, 1:22 pm, "Jay Flowers" <jay.flow...@gmail.com> wrote:
> I think there is a way with Attributes to ignore. I don't remember the
> source for my memory but it might help you Google your way to a solution...


Yes but this problem is different. Let me explain it a little bit:

You can create an attribute like this:

sealed class CoverageExcludeAttribute : System.Attribute
{
}

and apply it to classes that don't need testing, but the problem here
is only visible with classes generated by Visual Studio because if you
add the attribute it will get overwritten on the next modification.
When the generated class is partial (Like with Settings classes) you
can add the attribute in other file, but with resources the class is
declared like this:

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder",
"2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

The only solution I found was to use command line arguments to exclude
all classes that have the GeneratedCode attribute above, but it can't
be used from TestDriven.NET.

I'm hopping Jamie will be able to add this feature in a future
version.

Thanks

Reply all
Reply to author
Forward
0 new messages