Changing mbunit helper to a task

Posted by – January 25, 2009

The mbunit function in rubicant has been changed from just a function to a complete task.

MbUnitTask

Behind the scenes, what MBUnitTask does is copies over the minimal necessary support files from an MBUnit directory and then runs the tests. It uses the MBUnit Console Runner and is only tested with MBUnit 2.4. It is used as follows:

   1: MbUnitTask.new(:task_name => :dependencies) do |mbunit|
   2:   mbunit.mbunit_dir = "/path/to/mbunit" 
   3:   mbunit.test_dir = "/path/to/testing/dir" 
   4:   mbunit.test_files = ["tests.dll"]
   5:   mbunit.assembly_path => FileList["/assemblies/to/include/*.dll"],
   6:   mbunit.report_folder => "sets /rf:",
   7:   mbunit.report_name_format => "sets /rnf:",
   8:   mbunit.report_type => "sets /rt:",
   9:   mbunit.show_reports => "sets /sr:",
  10:   mbunit.transform => "sets /tr:",
  11:   mbunit.filter_category => "sets /fc:",
  12:   mbunit.exclude_category => "sets /ec:",
  13:   mbunit.filter_author => "sets /fa:",
  14:   mbunit.filter_type => "sets /ft:",
  15:   mbunit.filter_namespace => "sets /fn:",
  16:   mbunit.verbose => "sets /v{optionvalue}",
  17:   mbunit.shadow_copy => "sets /sc:" }
  18: end

 

Mbunit helper

   1: mbunit(name, dependencies, mbunit_dir, test_dir, test_files, opts={}) 

Usage is:

   1: mbunit(:run_tests, [:compile_tests], "/path/to/mbunit/dlls",
   2:         FileList["/test/dlls/test.dll"],
   3:         {:working_dir => "/dir/to/run/tests/in",
   4:          :assembly_path => FileList["/assemblies/to/include/*.dll"],
   5:          :report_folder => "sets /rf:",
   6:          :report_name_format => "sets /rnf:",
   7:          :report_type => "sets /rt:",
   8:          :show_reports => "sets /sr:",
   9:          :transform => "sets /tr:",
  10:          :filter_category => "sets /fc:",
  11:          :exclude_category => "sets /ec:",
  12:          :filter_author => "sets /fa:",
  13:          :filter_type => "sets /ft:",
  14:          :filter_namespace => "sets /fn:",
  15:          :verbose => "sets /v{optionvalue}",
  16:          :shadow_copy => "sets /sc:" } 

Runs the tests in test_files in the test_dir with the dlls from mbunit_dir using the options in opts.

For more information on the command line arguments for the mbunit console runner, please visit: http://docs.mbunit.com/help/html/gettingstarted/MbUnitConsoleRunner.htm

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>