Sha256: f1de5d9e2450c4920c4cdf8f90af5c4c716c448c9fc591f1558ac699783228d3

Contents?: true

Size: 1.77 KB

Versions: 30

Compression:

Stored size: 1.77 KB

Contents

class TestCommand < CmdParse::Command


    def initialize
        super( 'test', true, true )
        @short_desc = _("Manage tests")
#        @description = _("")
        @apps = []

        run_cmd = CmdParse::Command.new( 'run', false )
        run_cmd.short_desc = _("Run tests")
        # run.options = CmdParse::OptionParserWrapper.new do |opt|
        #     opt.on("--app", 
        #            _("Run tests only for an app"),
        #            "-a"){ |app|
        #         @apps << app
        #     }
        # end
        run_cmd.set_execution_block do |apps|
            require 'test/unit/collector/dir'
            require 'test/unit'
            apps = Spider.apps.keys if (!apps || apps.length < 1)
            collector = Test::Unit::Collector::Dir.new()
            apps.each do |name|
                next unless File.exist?(Spider.apps[name].test_path)
                collector.collect(Spider.apps[name].test_path)
            end
        end
        self.add_command(run_cmd)
        
        self_cmd = CmdParse::Command.new('self', false)
        self_cmd.short_desc = _("Run framework tests")
        self_cmd.set_execution_block do
            require 'test/unit/collector/dir'
            require 'test/unit'
            $SPIDER_RUNMODE = 'test'
            require 'spiderfw'
            test_env = "#{$SPIDER_PATH}/test"
#            Dir.cwd(test_env)
            $:.push(test_env)
            apps = Spider.find_apps_in_folder("#{test_env}/apps")
            Spider.apps.clear

            apps.each{ |app| Spider.load_app_at_path app }

            Spider._test_setup
            collector = Test::Unit::Collector::Dir.new()
            collector.collect("#{test_env}/tests")
            Spider._test_teardown
        end
        self.add_command(self_cmd)


    end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
spiderfw-0.6.14 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.13 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.12 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.11 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.10 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.9 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.8 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.7 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.6 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.5 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.4 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.3 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.2 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.1 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.6.0 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.5.19 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.5.18 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.5.17 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.5.16 lib/spiderfw/cmd/commands/test.rb
spiderfw-0.5.15 lib/spiderfw/cmd/commands/test.rb