i have nunit tests uses testcasesource function. unfortunately, testcasesource function need takes long time initialize, because scans folder tree recursively find of test images passed test function. (alternatively load file list xml every time it's run, automatic discovery of new image files still requirement.)
is possible specify nunit attribute testcasesource such nunit not enumerate test cases (does not call testcasesource function) until either user clicks on node, or until test suite being run?
the need test images stored in folder project requirement because other people not have access test project need add new test images folder, without having modify test project's source code. able view test result.
some dogmatic unit-testers may counter using nunit it's not supposed do. have admit have meet requirement, , nunit such great tool great gui satisfies of requirements, such not care whether proper unit testing or not.
additional info (from nunit documentation)
note on object construction
nunit locates test cases @ time tests loaded, creates instances of each class non-static sources , builds list of tests executed. each source object created once @ time , destroyed after tests loaded.
if data source in test fixture itself, object created using appropriate constructor fixture parameters provided on testfixtureattribute or default constructor if no parameters specified. since object destroyed before tests run, no communication possible between these 2 phases - or between different runs - except through parameters themselves.
it seems purpose of loading test cases front avoid having communications (or side-effects) between testcasesource , execution of tests. true? reason require test cases loaded front?
note:
a modification of nunit needed, documented in http://blog.sponholtz.com/2012/02/late-binded-parameterized-tests-in.html
there plans introduce option later versions of nunit.
i don't know of way delay-load test names in gui. recommendation move tests separate assembly. way, can run of other tests, , load slower exhaustive tests when needed.
Comments
Post a Comment