Customizing the NUnit GUI for data-driven testing

Posted by rwong on Programmers See other posts from Programmers or by rwong
Published on 2011-02-09T05:55:04Z Indexed on 2011/02/09 7:33 UTC
Read the original article Hit count: 331

My test project consists of a set of input data files which is fed into a piece of legacy third-party software. Since the input data files for this software are difficult to construct (not something that can be done intentionally), I am not going to add new input data files.

Each input data file will be subject to a set of "test functions". Some of the test functions can be invoked independently. Other test functions represent the stages of a sequential operation - if an earlier stage fails, the subsequent stages do not need to be executed.

I have experimented with the NUnit parametrized test case (TestCaseAttribute and TestCaseSourceAttribute), passing in the list of data files as test cases. I am generally satisfied with the the ability to select the input data for testing.

However, I would like to see if it is possible to customize its GUI's tree structure, so that the "test functions" become the children of the "input data". For example:

  • File #1
    • CheckFileTypeTest
    • GetFileTopLevelStructureTest
    • CompleteProcessTest
      • StageOneTest
      • StageTwoTest
      • StageThreeTest
  • File #2
    • CheckFileTypeTest
    • GetFileTopLevelStructureTest
    • CompleteProcessTest
      • StageOneTest
      • StageTwoTest
      • StageThreeTest

This will be useful for identifying the stage that failed during the processing of a particular input file.

Is there any tips and tricks that will enable the new tree layout? Do I need to customize NUnit to get this layout?

© Programmers or respective owner

Related posts about nunit

Related posts about data-driven-testing