Customizing the NUnit GUI for data-driven testing -


my test project consists of set of input data files fed piece of legacy third-party software. since input data files software difficult construct (not can done intentionally), not going add new input data files.

each input data file subject set of "test functions". of test functions can invoked independently. other test functions represent stages of sequential operation - if earlier stage fails, subsequent stages not need executed.

i have experimented nunit parametrized test case (testcaseattribute , testcasesourceattribute), passing in list of data files test cases. satisfied the ability select input data testing.

however, see if possible customize gui's tree structure, "test functions" become children of "input data". example:

  • file #1
    • checkfiletypetest
    • getfiletoplevelstructuretest
    • completeprocesstest
      • stageonetest
      • stagetwotest
      • stagethreetest
  • file #2
    • checkfiletypetest
    • getfiletoplevelstructuretest
    • completeprocesstest
      • stageonetest
      • stagetwotest
      • stagethreetest

this useful identifying stage failed during processing of particular input file.

is there tips , tricks enable new tree layout? need customize nunit layout?

edited: see question term unit testing separates test logic test result data introduction concept of separating test data , test code. in situation, separation driven practical concerns, not ideological reasons. sources of test data files "in wild".

other anecdotal use of data-driven tests:

you not going able model structure this. tests can exist in testfixtures (classes) , thing allows nest arbitrary levels in gui namespaces.

what this:

* file001 (namespace)   * tests_file001 (class, text fixture)     * checkfiletypetest (method, test)     * getfiletoplevelstructuretest (method, test)   * completeprocesstest (namespace)     * testscompleteprocesstest (class, text fixture)       * stageonetest (method, test)       * stagetwotest (method, test)       * stagethreetest (method, test) 

i assume have setup more along lines of

[test] [testcasesource("testfiles")] public void stageonetest(string file) { } 

where 1 test method checks specific thing , run test every file. in case you'd have remove attributes , call method new tests.

i feeling want tests execute in specific order , different test runners execute test in different orders. not aware of way , speaking shouldn't. no test should depend on test having succeeded.

assuming tests time intensive , don't want run of "later" tests if "earlier" test failed can consider putting them in appropriate categories like: "preliminary", "stage1", etc. can execute 1 category after other , see first fails.

i hope helps you.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -