← Back to team overview

nunit-core team mailing list archive

[Bug 1094245] [NEW] Means to include/exclude categories from test code

 

Public bug reported:

Hi NUnit,

Use of categories is a great way to include/exclude tests depending on the physical properties of the test machine. In combination with configuration settings this feature becomes even more powerful because it allows to configure the required physical test infrastructure, and the same tests can be executed on different physical machines. In my case for example, settings are:
  'SerialPortA' and 'SerialPortAIsAvailable' (e.g. COM1 and true)
  'SerialPortB' and 'SerialPortBIsAvailable' (e.g. COM2 and false)
  'SerialPortsAreInterconnected' (e.g. false)

When running tests, I can now manually exclude those categories which cannot be executed on the current machine. However, tests should automatically be excluded/ignored if the test machine doesn't provide the required infrastructure. Currently I achive this by:
  if (SerialPortAIsAvailable)
      <Run test case on SerialPortA>
  else
      Assert.Ignore("'SerialPortA' is not available, therefore this test is ignored. Ensure that...

This implementation requires that every test case does perform this
check. It would be much more convenient if a whole category was
automatically excluded/ignored by the NUnit test runner. I'd prefer
'ignore' because I'd prefer to clearly see that tests were skipped and a
yellow instead of a green bar.

Currently using:
> NUnit 2.5.10 (not yet upgraded to 2.6.2 due to the fact that the upgrade lead to issues with .NET 3.5)
> Gui Runner

Best regards
Matthias

YAT - Yet Another Terminal.
Visit YAT at http://sourceforge.net/projects/y-a-terminal/.
Contact YAT by mailto:y-a-terminal@xxxxxxxxxxxxxxxxxxxxx.

** Affects: nunitv2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1094245

Title:
  Means to include/exclude categories from test code

Status in NUnit V2 Test Framework:
  New

Bug description:
  Hi NUnit,

  Use of categories is a great way to include/exclude tests depending on the physical properties of the test machine. In combination with configuration settings this feature becomes even more powerful because it allows to configure the required physical test infrastructure, and the same tests can be executed on different physical machines. In my case for example, settings are:
    'SerialPortA' and 'SerialPortAIsAvailable' (e.g. COM1 and true)
    'SerialPortB' and 'SerialPortBIsAvailable' (e.g. COM2 and false)
    'SerialPortsAreInterconnected' (e.g. false)

  When running tests, I can now manually exclude those categories which cannot be executed on the current machine. However, tests should automatically be excluded/ignored if the test machine doesn't provide the required infrastructure. Currently I achive this by:
    if (SerialPortAIsAvailable)
        <Run test case on SerialPortA>
    else
        Assert.Ignore("'SerialPortA' is not available, therefore this test is ignored. Ensure that...

  This implementation requires that every test case does perform this
  check. It would be much more convenient if a whole category was
  automatically excluded/ignored by the NUnit test runner. I'd prefer
  'ignore' because I'd prefer to clearly see that tests were skipped and
  a yellow instead of a green bar.

  Currently using:
  > NUnit 2.5.10 (not yet upgraded to 2.6.2 due to the fact that the upgrade lead to issues with .NET 3.5)
  > Gui Runner

  Best regards
  Matthias

  YAT - Yet Another Terminal.
  Visit YAT at http://sourceforge.net/projects/y-a-terminal/.
  Contact YAT by mailto:y-a-terminal@xxxxxxxxxxxxxxxxxxxxx.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1094245/+subscriptions


Follow ups

References