explicit and ignore

Bug #777810 reported by Rechenelf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Triaged
Wishlist
Unassigned

Bug Description

[Issue now tracked at https://github.com/nunit/nunit-framework/issues/50]

First the problem:
We make a test, that could not be satisfied up to now, because the implementation of the functionality is not ready. We give him the attribute explicit, so the developer can run the test while he implements the functionality. But for the person who looks at the tests, he didn't see the test. So we make a empty copy of the test and give hin the attribute ignore.
If we give the test both attributes, explicit and ignore, the test is not runable under the gui.

A possibility would be that ignored tests can be run if a special option is set (perhaps on the tab for categories or command line).
This would be a very nice feature!

Revision history for this message
Rechenelf (matklaus) wrote :

I have worked on a solution, here it is. Would it be possible to integrate this in NUnit itself?

[AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
public class UnderDevelopmentAttribute : PropertyAttribute
{
  public UnderDevelopmentAttribute()
    : base("UnderDevelopment")
  { }
}

[DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool IsDebuggerPresent();

public static bool IsDebuggerAttached
{
    get
    {
 return System.Diagnostics.Debugger.IsAttached /* managed */
   || IsDebuggerPresent() /* unmanged */;
    }
}

[SetUp]
public void Setup()
{
    if (TestContext.Properties.Contains("UnderDevelopment"))
    {
 if (!IsDebuggerAttached)
     Assert.Ignore("under development");
    }
}

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 777810] Re: explicit and ignore

This is one possible option. I'll look at it in more detail after the XP2011
conference is over. Perhaps you could clarify what you would like to see
on the user side. From your bug description, it seems you want the tests
to be "yellow" until the NYI feature is complete. Is that so?

(Sometimes people assume that we understand the problem and jump
right away to a solution. But it's hard to understand exactly what problem
is being solved at times.)

Charlie

On Thu, May 5, 2011 at 8:59 AM, Rechenelf <email address hidden> wrote:
> I have worked on a solution, here it is. Would it be possible to
> integrate this in NUnit itself?
>
>
> [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
> public class UnderDevelopmentAttribute : PropertyAttribute
> {
>  public UnderDevelopmentAttribute()
>    : base("UnderDevelopment")
>  { }
> }
>
>
> [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
> public static extern bool IsDebuggerPresent();
>
> public static bool IsDebuggerAttached
> {
>    get
>    {
>        return System.Diagnostics.Debugger.IsAttached /* managed */
>          || IsDebuggerPresent() /* unmanged */;
>    }
> }
>
>
> [SetUp]
> public void Setup()
> {
>    if (TestContext.Properties.Contains("UnderDevelopment"))
>    {
>        if (!IsDebuggerAttached)
>            Assert.Ignore("under development");
>    }
> }
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/777810
>
> Title:
>  explicit and ignore
>

Revision history for this message
Rechenelf (matklaus) wrote :

Yes, that is right.
The person who is responsible for the test shall see that there must be something done in future but not as error. The tests shall not run.
The person who implements the feature shall be able to run the test without any code changes in the test itself.

Perhaps an own color would clearyfy.

By the way, it should be possible to run all explicit tests of a class or a assembly with one click. Perhaps an own entry in the context menu.

Revision history for this message
Rechenelf (matklaus) wrote :

I forgot something to say: The person who is responsible for the test must have a documentation feature, why the tests have not run. So a own color and a own summary-result would be very nice.
My solution only the reason is the documentation, not shown in a summary.

Revision history for this message
Charlie Poole (charlie.poole) wrote :

OK, that clarifies it. I'll look more closely after my conference.

Charlie

On Thu, May 5, 2011 at 9:57 AM, Rechenelf <email address hidden> wrote:
> I forgot something to say: The person who is responsible for the test must have a documentation feature, why the tests have not run. So a own color and a own summary-result would be very nice.
> My solution only the reason is the documentation, not shown in a summary.
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/777810
>
> Title:
>  explicit and ignore
>

Revision history for this message
Rechenelf (matklaus) wrote :

UnderDevelopment should also be an option of TestFixture and TestCaseData, like Ignore/IgnoreReason.

Changed in nunit-3.0:
milestone: none → 2.9.6
importance: Undecided → Low
status: New → Triaged
Changed in nunit-3.0:
milestone: 2.9.6 → none
Revision history for this message
Rechenelf (matklaus) wrote :

Hi Charlie,

can you please give me a reason, why you don't want to build the code I have delievered in?

Thanks.

Revision history for this message
Charlie Poole (charlie.poole) wrote :

1. Bugs are scheduled in milestones according to the purpose of the milestone. The 2.9.6 milestone will primarily consist of fixes that bring NUnit 3.0 up to the same level as NUnit 2.6.

2. This change is major because it potentially introduces another result type into NUnit. We will need to discuss it on the list and decide whether this is an instance of an existing ResultState/TestStatus or requires a new one. We will need to discuss whether it should be built-in to NUnit or if there should instead be a general way to create such extensions. I'll start all that discussion when some other things are complete that have a higher priority - or you could start it yourself if you like.

3. To be clear, you didn't deliver code to implement this feature but only code showing how it could be used in a test. That's OK, of course, and we'll figure out how to implement it after we decide about #2.

Charlie

Changed in nunit-3.0:
importance: Low → Wishlist
tags: added: framework
description: updated
tags: added: github
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.