|
1 |
|
2 |
|
3 class ApplicationControl |
|
4 # Run when the class is intialized. Takes logging file and MATTI sut in. |
|
5 def initialize(log, my_sut) |
|
6 @log = log |
|
7 @my_sut = my_sut |
|
8 end |
|
9 |
|
10 # Starts Logs application |
|
11 def startApplication() |
|
12 puts "starting application" |
|
13 @log.debug("Starting logs.exe application") |
|
14 @my_app = @my_sut.run(:name=>'logs.exe') |
|
15 sleep 4 |
|
16 # @my_sut.capture_screen(:Filename => 'c:/temp/live.png') |
|
17 # puts @my_sut.application.attribute("FullName") |
|
18 # f = File.new('c:\temp\decorator.xml', "w") |
|
19 # xml = @my_sut.get_ui_dump() |
|
20 # f.puts xml |
|
21 |
|
22 return @my_app |
|
23 end |
|
24 |
|
25 # Closes Logs application |
|
26 def closeApplication() |
|
27 puts "closing application" |
|
28 @log.debug("Closing logs.exe application") |
|
29 @my_app.close() |
|
30 end |
|
31 |
|
32 # Clears the database. |
|
33 # An external test application is called that clears the database used by Logs application |
|
34 def clearList |
|
35 begin |
|
36 @my_sut.run(:name=>'clearlisttest.exe') |
|
37 rescue |
|
38 # Expected, as the exe does not stay running |
|
39 end |
|
40 end |
|
41 |
|
42 # Adds events to database. |
|
43 # An external test application is called that adds events to database used by Logs application. |
|
44 # The test application takes in an argument that specifies which events should be added, e.g. case1. |
|
45 def addEvents(caseName) |
|
46 begin |
|
47 puts caseName |
|
48 @my_sut.run(:name=>"logclienttest.exe #{caseName}") |
|
49 rescue |
|
50 # Expected, as the exe does not stay running |
|
51 end |
|
52 end |
|
53 |
|
54 # Starts the call service monitor test application |
|
55 def startCallService() |
|
56 begin |
|
57 puts caseName |
|
58 @serviceApp = @my_sut.run(:name=>"servicepp2.exe") |
|
59 rescue |
|
60 # Some crashes my occure during startup |
|
61 end |
|
62 end |
|
63 |
|
64 |
|
65 # Start application by pressing Send key. Currently a test application is used as the Send key does not work |
|
66 def pressSendKey() |
|
67 @log.debug("running logsservicestester.exe 2") |
|
68 ## matti does not support pressing keys in QT side at the moment. IT will be added in maybe 0.6 version. |
|
69 #MATTI.disconnect_sut(:Id => 'sut_s60_qt') |
|
70 #sut = MATTI.sut(:Id => 's60') |
|
71 #sut.press_key(:kEnd) |
|
72 #sleep 4 |
|
73 sut.press_key(:kSend) |
|
74 #MATTI.disconnect_sut(:Id => 's60') |
|
75 #@my_sut = MATTI.sut(:Id => 'sut_s60_qt') |
|
76 #begin |
|
77 #@my_sut.run(:name=>'logsservicestester.exe 2') |
|
78 #rescue |
|
79 # Expected, as the exe does not stay running |
|
80 #end |
|
81 end |
|
82 |
|
83 |
|
84 end |
|
85 |