Nunit GUI not recognizing my folder structure in VS 2010???

42 views
Skip to first unread message

Ashok Tulachan

unread,
Oct 4, 2012, 9:55:12 AM10/4/12
to nunit-...@googlegroups.com

Hello everyone,

I am not sure why Nunit doesn't recognize my folder structure that I have created for maintaining my scripts.

I've attached the snapshot below with Visual studio tree structure and how the Nunit organizes it when i open it in NUnit GUI.

Also, when I create my test script, it's coming in alphabetical order by default which I don't want. In order to run the script the way I want,
I had to use numbering but it might be hectic when it gets too big.


Does new version of Nunit helps to run the script without sorting in alphabetical order?

Thanks for help.

--
- "If you haven't suffered, you haven't lived your life."
 
Sirus
NUnit.jpg
VStudioTreeStructure.jpg

David Schmitt

unread,
Oct 4, 2012, 10:57:23 AM10/4/12
to nunit-...@googlegroups.com
Hi Ashok,

NUnit only looks at the namespace of the TestFixtures. It doesn't have
access to the folder structure.

If you want further subdivisions visible in NUnit (and all downstream
result reports) you'll have to add your "functional"/"regression"
directories into the namespace of the underlying classes. That is for
example "Tests.Chrome_Tests.Functional.Test_01_...."



Best Regards, David

On 04.10.2012 15:55, Ashok Tulachan wrote:
> Hello everyone,
>
> I am not sure why Nunit doesn't recognize my folder structure that I
> have created for maintaining my scripts.
>
> I've attached the snapshot below with Visual studio tree structure and
> how the Nunit organizes it when i open it in NUnit GUI.
>
> Also, when I create my test script, it's coming in alphabetical order by
> default which I don't want. In order to run the script the way I want,
> I had to use numbering but it might be hectic when it gets too big.
>
>
> Does new version of Nunit helps to run the script without sorting in
> alphabetical order?
>
> Thanks for help.
>
> --
> /- "If you haven't suffered, you haven't lived your life."/
> Sirus
>
> --
> 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.

Charlie Poole

unread,
Oct 4, 2012, 11:05:22 AM10/4/12
to nunit-...@googlegroups.com
Hi,

See inline...

On Thu, Oct 4, 2012 at 6:55 AM, Ashok Tulachan <tulach...@gmail.com> wrote:
> Hello everyone,
>
> I am not sure why Nunit doesn't recognize my folder structure that I have
> created for maintaining my scripts.
>
> I've attached the snapshot below with Visual studio tree structure and how
> the Nunit organizes it when i open it in NUnit GUI.
>
Visual Studio creates folders for you to assist in organizing your tests.
Depending on how you do it, they can map to folders in the directory
structure or simply exist as virtual folders in Visual Studio.

NUnit is not displaying the VS folder structure - it doesn't even know
anything about that structure - or the file structure on disk. The Gui
display shows tests organized by the namespace in which you have
placed each test fixture. Since VS automatically assigns namespaces
to new files according to the folder structure, this may look similar
to what's in VS - or it may not, since you can edit your code to
use any namespace you like. In the case of test fixtures, assign
namespaces in accordance to how you would like NUnit to display
the structure o fthe tests.

> Also, when I create my test script, it's coming in alphabetical order by
> default which I don't want. In order to run the script the way I want,
> I had to use numbering but it might be hectic when it gets too big.

NUnit provides no way to order tests because it was designed for use
in low-level unit testing, where it's most desirable that tests be
completely independent. In theory, the order in which NUnit will
run your tests is not predictable.

Of course, in practice, they happen to run in alphabetical order. :-)
That's due to an unfortunate past decision (by me) to implement
a user request so it would be easier to find tests. Frankly, for pure
micro- or unit-testing, we would be better off to randomize test
order. Additionally, the display order should not be tightly coupled
to the order of execution.

Over the years, more and more people have begun to use NUnit
for functional tests, as I imagine you are doing. In that kind of
testing, order of execution often needs to be fixed. Currently,
the only workaround available is to name your tests in a way that
forces them to be run in the proper order. This is an _ugly_
workaround and I hate to suggest it, but it will work - at least
until a new release of NUnit breaks it.

The alternative is to make all your unit tests completely independent.
This will lead to a great deal of duplication, both in the code and
in the reporting of errors. You can minimize the latter by using
Assume rather than Assert for the setup steps in each test.

>
> Does new version of Nunit helps to run the script without sorting in
> alphabetical order?

The next (3.0) version of NUnit will
* Randomize test order - not sure if it will be an option or the default
* Separate the display of tests from the execution order, allowing you
to reorder the display at will.
* Provide a separate type of fixture for functional tests that must run
in a particular order, which you will be able to specify on the tests
themselves.

Charlie

> Thanks for help.
>
> --
> - "If you haven't suffered, you haven't lived your life."
>
> Sirus
>

Ashok Tulachan

unread,
Oct 4, 2012, 12:08:30 PM10/4/12
to nunit-...@googlegroups.com
Thank You Charlie and David for your answers.
 
Defintely can't wait for NUnit 3.0. Also it would be awesome if we could debug our script from NUnit GUI. Currently i have installed TestRunner to debug my script from Visual Studio 2010 as it doesn't work on Visual C# Express but VS2010 is a trial version so it kinda sucks.
 
Any ETA for NUnit 3.0, Charlie :).
 
Thank you again.

Regards,
Sirus 

Charlie Poole

unread,
Oct 4, 2012, 2:25:03 PM10/4/12
to nunit-...@googlegroups.com
Nothing prevents you from debugging your tests while using NUnit Gui.
Simply run the gui from Visual Studio in debug mode, so it loads your
tests. Set any breakpoints you like and the test will stop there.

Of course, the devil is in the details, so check the docs and this group
for more detailled instructions. :-)

We don't have an announced date for a 3.0 release yet, but you'll
hear about it on this list when we do.

Charlie
Reply all
Reply to author
Forward
0 new messages