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

Notification

Icon
Error

NCrunchEnvironment UserInterActive (or Prioritized)
Atreyu
#1 Posted : Sunday, August 25, 2013 5:37:54 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/11/2013(UTC)
Posts: 11
Location: Netherlands

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
I would like to be able to detect whether a test was started automatically by NCrunch logic, or started manually. (prioritized, as you will)

Sometime when a test was initialized 'by hand' I would like to perform some additional stuff (Let's say: open a generated file or location)

It would be cool if this were to be added to the environment class.
http://www.ncrunch.net/d...ework_environment-class

Nice idea?
(this is partially related to: http://forum.ncrunch.net...Item-inconsistent.aspx, still my tests with resourced that are manually run succeed, while when they run in auto-mode, they often fail)
Remco
#2 Posted : Sunday, August 25, 2013 10:14:04 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Thanks for the suggestion! Something you may wish to consider is implementing alternative tests that perform the opening of the generated file after executing the logic of the original test. You can mark these tests with a special category that you program NCrunch to ignore via a custom engine mode. In this way, you have two tests - one that executes the additional logic manually, and one that doesn't execute this logic and can run automatically. In this way, the execute path of the tests remain consistent, so you won't see strange issues with code coverage shifting around depending upon the manner in which the test is executed. Do you think this would work for you?
1 user thanked Remco for this useful post.
Atreyu on 8/26/2013(UTC)
Atreyu
#3 Posted : Monday, August 26, 2013 5:39:42 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/11/2013(UTC)
Posts: 11
Location: Netherlands

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco,

Thanks for your feedback.

In order to have this work I would:

- Make a category (maybe custom attribute inheriting from categorybaseattribute) which is ignored by NCrunch in auto mode
- Apply the attribute to a test which in itself detects NCrunch, and would perform logic when run in NCrunch.
- Execute the normally ignored test manually in NCrunch

When this issue will be important enough, I might just do that.
For me it is important that my tests can be performed by other runners too. (like built in MSTest, Resharper runner, OpenCover runner)
Remco
#4 Posted : Monday, August 26, 2013 8:58:21 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Understood - thanks for sharing the suggestion. I'll look into it and will see what I can do :)
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.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download