Class: MobyUtil::Recorder

Inherits:
Object show all
Defined in:
lib/tdriver/util/recorder/recorder.rb

Class Method Summary collapse

Class Method Details

Prints the recorded events as an tdriver script fragment.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/tdriver/util/recorder/recorder.rb', line 40

def self.print_script( sut, app, object_identificators = ['text','icontext','label'] )

  # verify that sut type is type of MobyBase::SUT
  #raise ArgumentError.new("Sut must be defined.") unless sut
  sut.check_type( MobyBase::SUT, "Wrong argument type $1 for SUT (expected $2)" )

  #raise ArgumentError.new("Application must be defined.") unless app
  app.check_type( MobyBase::TestObject, "Wrong argument type $1 for application object (expected $2)" )

  #raise ArgumentError.new("Object identificators must be set, use defaults if not sure what the use.") unless object_identificators
  object_identificators.check_type( Array, "Wrong argument type $1 for object identificators (expected $2)" )
  
  xml_source = app.print_recordings

  app.stop_recording
  
  MobyUtil::Scripter.new( sut.id, object_identificators ).write_fragment( 

    #MobyBase::StateObject.new( :source_data => xml_source ), 
    sut.state_object( xml_source ), 
    app.name 

  )

end

.start_rec(app) ⇒ Object

TODO detect app start for later versions…



30
31
32
33
34
35
36
37
# File 'lib/tdriver/util/recorder/recorder.rb', line 30

def self.start_rec( app )

  #raise ArgumentError.new("Application must be defined.") unless app
  app.check_type( MobyBase::TestObject, "Wrong argument type $1 for application object (expected $2)" )

  app.start_recording

end