title: Delay-loading TestCaseSource in NUnit
body: <p>I have some NUnit tests which uses a TestCaseSource function. Unfortunately, the TestCaseSource function that I need takes a long time to initialize, because it scans a folder tree recursively to find all of the test images that would be passed into the test function. (Alternatively it could load from a file list XML every time it's run, but automatic discovery of new image files is still a requirement.)</p>
  
  <p>Is it possible to specify an NUnit attribute together with TestCaseSource such that NUnit does not enumerate the test cases (does not call the TestCaseSource function) until either the user clicks on the node, or until the test suite is being run?</p>
  
  <p>The need to get all test images stored in a folder is a project requirement because other people who do not have access to the test project will need to add new test images to the folder, without having to modify the test project's source code. They would then be able to view the test result.</p>
  
  <p>Some dogmatic unit-testers may counter that I am using NUnit to do something it's not supposed to do. I have to admit that I have to meet a requirement, and NUnit is such a great tool with a great GUI that satisfies most of my requirements, such that I do not care about whether it is proper unit testing or not.</p>
  
  <p><strong>Additional info</strong> (from NUnit documentation)</p>
  
  <blockquote>
    <p>Note on Object Construction</p>
    
    <p>NUnit locates the test cases at the
    time the tests are loaded, creates
    instances of each class with
    non-static sources and builds a list
    of tests to be executed. Each source
    object is only created once at this
    time and is destroyed after all tests
    are loaded.</p>
    
    <p>If the data source is in the test
    fixture itself, the object is created
    using the appropriate constructor for
    the fixture parameters provided on the
    TestFixtureAttribute or the default
    constructor if no parameters were
    specified. Since this object is
    destroyed before the tests are run, no
    communication is possible between
    these two phases - or between
    different runs - except through the
    parameters themselves.</p>
  </blockquote>
  
  <p>It seems the purpose of loading the test cases up front is to avoid having communications (or side-effects) between TestCaseSource and the execution of the tests. Is this true? Is this the only reason to require test cases to be loaded up front?</p>
  
  <p><strong>Note:</strong></p>
  
  <p>A modification of NUnit was needed, as documented in <a href="http://blog.sponholtz.com/2012/02/late-binded-parameterized-tests-in.html" rel="nofollow">http://blog.sponholtz.com/2012/02/late-binded-parameterized-tests-in.html</a></p>
  
  <p>There are plans to introduce this option to later versions of NUnit.</p>