(Not documented)
# File lib/rwebspec/itest_plugin.rb, line 6
6: def connect_to_itest(message_type, body)
7: begin
8: the_message = message_type + "|" + body
9: if @last_message == the_message then # ignore the message same as preivous one
10: return
11: end
12: itest_port = $ITEST2_TRACE_PORT || 7025
13: itest_socket = Socket.new(Socket::AF_INET,Socket::SOCK_STREAM,0)
14: itest_socket.connect(Socket.pack_sockaddr_in(itest_port, '127.0.0.1'))
15: itest_socket.puts(the_message)
16: @last_message = the_message
17: itest_socket.close
18: rescue => e
19: end
20: end
(Not documented)
# File lib/rwebspec/itest_plugin.rb, line 23
23: def debug(message)
24: connect_to_itest(" DEBUG", message + "\r\n") if $RUN_IN_ITEST
25: end
find out the line (and file) the execution is on, and notify iTest via Socket
# File lib/rwebspec/itest_plugin.rb, line 47
47: def dump_caller_stack
48: return unless $ITEST2_TRACE_EXECUTION
49: begin
50: caller.each_with_index do |position, idx|
51: next unless position =~ /\A(.*?):(\d+)/
52: file = $1
53: # TODO: send multiple trace to be parse with pages.rb
54: # next if file =~ /example\/example_methods\.rb$/ or file =~ /example\/example_group_methods\.rb$/ or file =~ /driver\.rb$/ or file =~ /timeout\.rb$/ # don't include rspec or ruby trace
55:
56: if file.include?("_spec.rb") || file.include?("_test.rb") || file.include?("_cmd.rb")
57: connect_to_itest(" TRACE", position)
58: end
59:
60: break if idx > 4 or file =~ /"_spec\.rb$/
61: end
62: rescue => e
63: puts "failed to capture log: #{e}"
64: end
65: end
Support of iTest to ajust the intervals between keystroke/mouse operations
# File lib/rwebspec/itest_plugin.rb, line 29
29: def operation_delay
30: begin
31: if $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY > 0 &&
32: $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY < 30000 then # max 30 seconds
33: sleep($ITEST2_OPERATION_DELAY / 1000)
34: end
35:
36: while $ITEST2_PAUSE
37: debug("Paused, waiting ...")
38: sleep 1
39: end
40: rescue => e
41: puts "Error on delaying: #{e}"
42: # ignore
43: end
44: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.