2

I'm using FitSharp to test an application and have a question related to testing contents of lists. Testing that an element is present in a list is simple to do using, for example, a SubsetFixture and could be written as this:

| Check that element is in list |
| 5 |

But is there a way to write a fixture that tests if an element is not in a list?

| Check that element is not in list |
| 5 |

I want the last table to pass only if 5 is not in the processed list.

Jonas
  • 4,107
  • 3
  • 21
  • 25

1 Answers1

3

The closest you can come with any kind of list fixture would be to use a array or set fixture and to list ALL of the items you DO expect. There is no "not one of these" list fixtures.

I would recommend you just do a do fixture in one like like:

|check|that element | 5 |  is in the list | False |

or you could use a column fixture to get the feel for a set fixture

| Check that element is not in list |
| element | exists? |
| 5 | false |
ryber
  • 4,537
  • 2
  • 26
  • 50
  • This is what I would recommend. – Dan Woodward Mar 05 '12 at 23:05
  • We have gone for a solution like this one too since it seems to be the only reasonable. I stated my original question unclearly, because we can have more complex objects than integers in the lists, but I think we can manage that somehow, should the problem arise. – Jonas Mar 07 '12 at 18:29