Class: TC
- Inherits:
-
Object
show all
- Defined in:
- lib/TCLib.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ TC
Returns a new instance of TC.
103
104
105
|
# File 'lib/TCLib.rb', line 103
def initialize
@tc = TC.get_TC
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
129
130
131
|
# File 'lib/TCLib.rb', line 129
def method_missing(meth, *args, &blk)
@tc.send(meth, *args, &blk)
end
|
Class Method Details
.get_OLE(strAutomationEngine) ⇒ Object
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/TCLib.rb', line 113
def self.get_OLE(strAutomationEngine)
begin
tc = WIN32OLE.connect(strAutomationEngine)
rescue WIN32OLERuntimeError
begin
tc = WIN32OLE.new(strAutomationEngine)
rescue WIN32OLERuntimeError
end
end
tc
end
|
.get_TC ⇒ Object
107
108
109
110
111
|
# File 'lib/TCLib.rb', line 107
def self.get_TC
tc = get_OLE("TestComplete.TestCompleteApplication.8")
tc = get_OLE("TestExecute.TestExecuteApplication.8") unless tc
tc
end
|
Instance Method Details
#LaunchIe(url, timeout) ⇒ Object
147
148
149
150
|
# File 'lib/TCLib.rb', line 147
def LaunchIe(url, timeout)
executable = "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"
StartProcess(executable, url, timeout)
end
|
#library(name) ⇒ Object
125
126
127
|
# File 'lib/TCLib.rb', line 125
def library(name)
TCLibrary.new(name, @tc)
end
|
#StartProcess(executable, parameter, timeout) ⇒ Object
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/TCLib.rb', line 133
def StartProcess(executable, parameter, timeout)
shell = WIN32OLE.new('WScript.Shell')
shell.Run("#{executable} \"#{parameter}\"")
processName = executable.split(/[\/\\]/).last.split(/\./).first
sys = @tc.integration.GetObjectByName("Sys")
x = Now + timeout
begin
process = sys.Find("ProcessName", processName)
end while(!process.Exists && Now < x)
return process
end
|