Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Controlling display order of tests in Ncrunch Test window
Phil
#1 Posted : Wednesday, July 18, 2012 8:54:29 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/18/2012(UTC)
Posts: 3

Thanks: 1 times
I'm wanting to be able to allow fellow developers to simply read down the list of unit tests and get a good understanding of what each component does and how it should behave. For example, I'd like to see something like:

UnitTests.Day
  • Initialise_FromUnsavedDay_ThrowsException
  • Initialise_FromDayWithZeroStages_LoadsData
  • Initialise_FromDayWithOneStage_LoadsData
  • Initialise_FromDayWithMultipleStages_LoadsData
  • Commit_UnsavedDay_CreatesDayId
  • Commit_SavedDay_DoesNotChangeDayId
  • AddStage_SavedStage_AssociatesStageWithDay
  • AddStage_UnsavedStage_ThrowsException

However the (seemingly) random default ordering produces something like:

UnitTests.Day
  • Initialise_FromDayWithOneStage_LoadsData
  • AddStage_SavedStage_AssociatesStageWithDay
  • Commit_UnsavedDay_CreatesDayId
  • Commit_SavedDay_DoesNotChangeDayId
  • Initialise_FromDayWithZeroStages_LoadsData
  • AddStage_UnsavedStage_ThrowsException
  • Initialise_FromDayWithMultipleStages_LoadsData
  • Initialise_FromUnsavedDay_ThrowsException

Is there anyway to control the order in which tests are displayed in the NCrunch Test window to produce the order I'm hoping for?
Remco
#2 Posted : Thursday, July 19, 2012 6:15:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Phil,

Thanks for posting!

My observation of the test order is that it is normally alphabetical, although I can't find a mechanism that strictly enforces this (so most likely there are random elements).

It makes sense to me to always have the test order consistent, so I'm thinking I may make an adjustment to ensure that it is always alphabetical. You could then label your tests appropriately (i.e. put letters or numbers at the beginning to define sequence).

Would this work for you?


Cheers,

Remco
Phil
#3 Posted : Thursday, July 19, 2012 7:54:10 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/18/2012(UTC)
Posts: 3

Thanks: 1 times
Thanks for the response Remco (and for building a fantastic tool !!)...

Having a consistent order is key to me and enforcing alphabetical order would be a workable solution.

I'm guessing that because NCrunch / NUnit uses the assemblies rather than the source code this would make it difficult/impossible to simply display and/or execute the tests in the order they appear in the source files? This approach would be preferable because there would be less overhead involved when inserting new tests (no need to re-number / re-index) and would encourage developers to structure their test classes to "tell a story" about the class under test.
Remco
#4 Posted : Friday, July 20, 2012 1:43:58 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Phil,

Thanks for the feedback. You're correct in your assumption that it is difficult for IL-dependent tools such as NCrunch to use data on source file sequence. It's theoretically possible but very hard and likely not worth the investment relative to other higher value features. Though I definitely agree that this would be a better and more readable approach.

I'll include the alphabetical order fix in the next release (1.41b) :)


Cheers,

Remco
1 user thanked Remco for this useful post.
Phil on 7/20/2012(UTC)
Phil
#5 Posted : Friday, July 20, 2012 7:14:24 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/18/2012(UTC)
Posts: 3

Thanks: 1 times
Excellent - looking forward to 1.41b! :D
Remco
#7 Posted : Monday, August 13, 2012 4:21:43 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
For anyone interested, 1.41b has just been released including the above mentioned change (alphabetical order on tests shown in the Tests Window).
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download