### Home Classes Methods

### In Files

- lib/stella/engine.rb

### Methods

- #run

### Included Modules

- Stella::Engine::Base

### Files

- LICENSE.txt
- TODO

### Class/Module Index

Quicksearch

- Stella
- Stella::API
- Stella::API::Unauthorized
- Stella::Asserts
- Stella::CLI
- Stella::Client
- Stella::Common
- Stella::Common::PrivacyMethods
- Stella::ET
- Stella::Engine
- Stella::Engine::Base
- Stella::Engine::Base::ClassMethods
- Stella::Engine::Checkup
- Stella::EventTemplate
- Stella::ForcedRedirect
- Stella::HTTPError
- Stella::Log
- Stella::Log::HTTP
- Stella::PageError
- Stella::RT
- Stella::RepeatRequest
- Stella::Report
- Stella::Report::Content
- Stella::Report::Content::ReportMethods
- Stella::Report::Errors
- Stella::Report::Errors::ReportMethods
- Stella::Report::Headers
- Stella::Report::Metrics
- Stella::Report::Metrics::ReportMethods
- Stella::Report::Plugin
- Stella::Report::Plugin::ClassMethods
- Stella::Report::Statuses
- Stella::Report::Statuses::ReportMethods
- Stella::RequestError
- Stella::RequestTemplate
- Stella::Session
- Stella::StringTemplate
- Stella::TP
- Stella::Testplan
- Stella::Testplan::ClassMethods
- Stella::TestplanQuit
- Stella::Testrun
- Stella::TimeoutError
- Stella::UC
- Stella::Usecase
- Stella::Usecase::ClassMethods
- Stella::UsecaseError
- Stella::UsecaseFail
- Stella::Utils
- Stella::VERSION
- Addressable
- Addressable::URI
- Time
- Time::Units
- Array
- DefaultTestplan
- Float
- Hash
- MatchData
- MetricsPack
- Numeric
- Object
- OpenStruct
- StellaBehavior
- StellaError
- String
- Symbol
- Thread

No matching classes.

# Stella::Engine::Checkup

### Public Instance Methods

run(testrun, opts={}) click to toggle source

    # File lib/stella/engine.rb, line 40
    def run testrun, opts={}
      opts = parse_opts testrun.options, opts
      Stella.ld "testrun opts: #{opts.inspect}"
      threads = []
      testrun.stime = Stella.now
      testrun.running!
      opts[:concurrency].times do
        threads << Thread.new do
          client = Stella::Client.new opts
          Benelux.current_track "client_#{client.clientid.shorten}"
          begin
            opts[:repetitions].times do |idx|
              Stella.li '%-61s %s' % [testrun.plan.desc, testrun.plan.planid.shorten(12)] if Stella.noise >= 2 && !Stella.quiet?
              testrun.plan.usecases.each_with_index do |uc,i|
                if opts[:usecases].nil? || opts[:usecases].member?(uc.class)
                  Benelux.current_track.add_tags :usecase => uc.id
                  Stella.rescue {
                    Stella.li ' %-60s %s' % [uc.desc, uc.ucid.shorten(12)] if Stella.noise >= 1 && !Stella.quiet?
                    client.execute uc do |session|
                      Stella.li '  %3d %-4s %-76s' % [session.status, session.http_method.upcase, session.uri] if Stella.noise >= 1 && !Stella.quiet?
                      if Stella.noise >= 2 && !Stella.quiet?
                        Stella.li '   %s' % [session.req.header.dump.split(/\n/).join("\n   ")]
                        Stella.li
                        Stella.li '   %s' % [session.res.header.dump.split(/\n/).join("\n   ")]
                        Stella.li ''
                      end
                    end
                  }
                  if client.exception
                    if Stella.noise >= 1
                      Stella.li '  %4s %s (%s)' % ['', client.exception.message, client.exception.class]
                    end
                    # TODO: use a throw. This won't stop the next repetition.
                    break if Stella::TestplanQuit === client.exception
                  end
                else
                  #Stella.li ' %-60s %s' % ["#{uc.desc} (skipped)", uc.ucid.shorten(12)] if Stella.noise >= 2
                end
                Benelux.current_track.remove_tags :usecase
              end
            end
          rescue Interrupt
            Stella.li "Skipping..."
            testrun.etime = Stella.now
            testrun.fubar!
            exit 1
          rescue => ex
            Stella.li ex.message
            Stella.li ex.backtrace if Stella.debug?
          end
        end
      end

      begin
        threads.each { |thread| thread.join }
        timeline = Benelux.merge_tracks
      rescue Interrupt
        Stella.li "Skipping..."
        testrun.etime = Stella.now
        testrun.fubar!
        exit 1
      end

      begin
        testrun.etime = Stella.now
        testrun.report = Stella::Report.new timeline, testrun.runid
        testrun.report.process
        testrun.report.fubars? ? testrun.fubar! : testrun.done!
      rescue Interrupt
        Stella.li "Exiting..."
        testrun.etime = Stella.now
        testrun.fubar!
        exit 1
      rescue => ex
        Stella.li ex.message
        Stella.li ex.backtrace if Stella.debug?
        testrun.etime = Stella.now
        testrun.fubar!
      end
      Benelux.reset # If we run again, the old stats still remain
      testrun
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.