class NUnit

Attributes

assemblies[RW]

Public Class Methods

new(session) click to toggle source
# File lib/rakeoff/tests.rb, line 8
def initialize(session)
        @session = session
end

Public Instance Methods

execute(pattern) click to toggle source
# File lib/rakeoff/tests.rb, line 12
def execute(pattern)
            print_heading("Tests - #{pattern}")
            
            projects = get_test_projects_for(pattern)

            if(!projects.empty?)
                    project_list = projects.join(' ').strip

                    if(ENV["NUNIT_RUNNER"].nil?)
                            mkdir_p File.join(@session.output_dir, '/test-reports')
                            nunit = Dir.glob(File.join(@session.tools_dir, '/**/nunit-console.exe')).last

                        sh "#{nunit} #{project_list} /xml=#{File.join(@session.output_dir, '/test-reports/nunit.xml')}"
                    else
                        sh "#{ENV["NUNIT_RUNNER"]} v4.0 x86 NUnit-2.5.3 #{project_list}"
                    end  
    end
end

Private Instance Methods

get_test_projects_for(pattern) click to toggle source
# File lib/rakeoff/tests.rb, line 33
def get_test_projects_for(pattern)
    projects = Dir.glob(pattern, File::FNM_CASEFOLD).reject {|f| File.directory?(f) }               
            puts "No test projects found matching pattern #{pattern}".yellow if(projects.length == 0)
            return projects       
end