NUnit tries to test disabled projects?

7 views
Skip to first unread message

fromax

unread,
Jan 4, 2011, 8:38:54 AM1/4/11
to NUnit-Discuss
Hi,

I use the following command to run all unit tests in Visual Studio
solutions:

nunit-console-x86 foo.sln /config=Release

That works great! Except:

Since some projects should not be built in the release configuration,
they have been disabled in the release configuration (using Visual
Studio's "Configuration Manager" - the "Build" checkbox is unchecked).

The problem is that nunit still tries to test the disabled projects,
which results in the following "File not found"-error:

C:\buildsystem\bin\CruiseControl.NET-1.4.3.4023-patched\WorkingDirs
\Foo-v2.8>nunit-console-x86 foo.sln /config=Release

NUnit version 2.5.9.10348
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A.
Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7600.0
CLR Version: 2.0.50727.4927 ( Net 2.0 )

ProcessModel: Default DomainUsage: Default
Execution Runtime: Default
Could not find file 'C:\buildsystem\bin\CruiseControl.NET-1.4.3.4023-
patched\WorkingDirs\Foo-v2.8\SomeDisabledProject\bin\Release
\SomeDisabledProject.dll'.

Is this a bug? What can I do about it? Since specifying the sln-file
is very convenient, I'd prefer not having to specify single csproj-
files or single dlls...

Thanks,
Max

Charlie Poole

unread,
Jan 4, 2011, 11:57:43 AM1/4/11
to nunit-...@googlegroups.com
Hi Max,

That seems like a bug to me. Would you please file a bug report
at http://bugs.launchpad.net/nunitv2?

That said, I would not normally use a solution file at the command line,
but would open it in the gui and save it as a .nunit project file. If you
do that, you can remove the projects that should not be in release
as well as the non-test projects.

Charlie

> --
> You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
> To post to this group, send email to nunit-...@googlegroups.com.
> To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
>
>

fromax

unread,
Jan 4, 2011, 2:11:34 PM1/4/11
to NUnit-Discuss
Hi Charlie,

Bug report filed & thanks for the hint of opening the .sln file in the
nunit-gui. I didn't know this was possible! (File -> Open Project...
only lists *.nunit,*.dll,*.exe by default)

Concerning the .nunit file - actually a custom .nunit file was the
first thing I tried. But then I became a bit worried that people will
forget to add new test projects to the .nunit file (which would cause
the tests to not be seen by the build server). It seems like a bit of
a redundancy since the projects that shouldn't be built are already
listed in the .sln file.

Using the .nunit file might have a performance advantage. One of my
solutions contains 65 projects. Running the tests using the .sln file
takes about 15 seconds longer than running them with a .nunit file
that only contains the test projects. I'm still wondering if I should
trade 15 seconds per build (on a build server) for the convenience of
not being able to forget to add new test projects... :)

Max

On 4 Jan., 17:57, Charlie Poole <nunit...@gmail.com> wrote:
> Hi Max,
>
> That seems like a bug to me. Would you please file a bug report
> athttp://bugs.launchpad.net/nunitv2?

Charlie Poole

unread,
Jan 4, 2011, 3:16:26 PM1/4/11
to nunit-...@googlegroups.com
Hi max,

> Bug report filed & thanks for the hint of opening the .sln file in the
> nunit-gui. I didn't know this was possible! (File -> Open Project...
> only lists *.nunit,*.dll,*.exe by default)

Great! We'll consider this for NUnit 2.6.

Regarding listing .sln, .csproj, etc. ... that's part of NUnit's support
for Visual Studio, which is not enabled by default. See the
Tools | Settings menu item.

> Concerning the .nunit file - actually a custom .nunit file was the
> first thing I tried. But then I became a bit worried that people will
> forget to add new test projects to the .nunit file (which would cause
> the tests to not be seen by the build server). It seems like a bit of
> a redundancy since the projects that shouldn't be built are already
> listed in the .sln file.

It seems really unlikely that you could forget an entire test assembly
for very long. If your test results are visible to the team - as they
should be - somebody is bound to notice. Of course, the .nunit
file should be checked in, just like the solution file.

> Using the .nunit file might have a performance advantage. One of my
> solutions contains 65 projects. Running the tests using the .sln file
> takes about 15 seconds longer than running them with a .nunit file
> that only contains the test projects. I'm still wondering if I should
> trade 15 seconds per build (on a build server) for the convenience of
> not being able to forget to add new test projects... :)

Most likely, you have lots more product assemblies than test assemblies.
NUnit has to load all those assemblies and go through all the declared
Types to figure out if there are any tests...

Charlie

Reply all
Reply to author
Forward
0 new messages