testability-driver 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/start_app_perf +6 -6
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +4 -4
- data/lib/tdriver-devtools/doc/xslt/template.xsl +103 -21
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +1 -1
- data/lib/tdriver/base/command_data/loader.rb +6 -2
- data/lib/tdriver/base/loader.rb +21 -14
- data/lib/tdriver/base/state_object.rb +1 -1
- data/lib/tdriver/base/sut/controller.rb +8 -2
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +103 -46
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +2 -2
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/application.rb +18 -278
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
- data/lib/tdriver/base/sut/sut.rb +1 -1
- data/lib/tdriver/base/test_object/abstract.rb +1 -1
- data/lib/tdriver/base/test_object/adapter.rb +4 -1
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +3 -3
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +61 -24
- data/lib/tdriver/base/test_object/cache.rb +6 -4
- data/lib/tdriver/base/test_object/factory.rb +4 -2
- data/lib/tdriver/base/test_object/loader.rb +23 -14
- data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
- data/lib/tdriver/base/test_object/xml/adapter.rb +4 -1
- data/lib/tdriver/report/report_test_run.rb +1 -1
- data/lib/tdriver/report/report_writer.rb +4 -3
- data/lib/tdriver/util/common/boolean.rb +10 -13
- data/lib/tdriver/util/common/environment.rb +8 -7
- data/lib/tdriver/util/common/hash.rb +5 -5
- data/lib/tdriver/util/common/numeric.rb +5 -5
- data/lib/tdriver/util/common/object.rb +3 -3
- data/lib/tdriver/util/common/retryable.rb +65 -2
- data/lib/tdriver/util/common/string.rb +4 -4
- data/lib/tdriver/util/database/access.rb +9 -11
- data/lib/tdriver/util/fixture/service.rb +54 -0
- data/lib/tdriver/util/localisation/localisation.rb +3 -2
- data/lib/tdriver/util/logger/logger.rb +55 -41
- data/lib/tdriver/util/parameter/parameter.rb +38 -7
- data/lib/tdriver/util/xml/abstraction.rb +8 -8
- data/lib/tdriver/util/xml/builder.rb +1 -1
- data/lib/tdriver/util/xml/xml.rb +11 -11
- data/lib/tdriver/verify/verify.rb +33 -36
- data/lib/tdriver/version.rb +1 -1
- data/xml/defaults/sut_generic.xml +1 -29
- data/xml/templates/generic.xml +28 -0
- metadata +48 -17
data/bin/start_app_perf
CHANGED
@@ -72,13 +72,13 @@ def run(iteration)
|
|
72
72
|
#puts events
|
73
73
|
doc = Nokogiri::XML.parse(events)
|
74
74
|
first_time_stamp = nil
|
75
|
-
node_set = doc.xpath('//
|
75
|
+
node_set = doc.xpath('//obj[@name = "QtApplicationEvents"]/obj')
|
76
76
|
timer_counter = 0
|
77
77
|
index = 0
|
78
78
|
target_object = nil
|
79
79
|
while(index < node_set.size)
|
80
80
|
node = node_set.at(index)
|
81
|
-
time_str = node.xpath("#{node.path}/
|
81
|
+
time_str = node.xpath("#{node.path}/attr[@name = \"timeStamp\"]").first.text
|
82
82
|
time_stamp = Time.local(toi(time_str[0..3]), toi(time_str[4..5]), toi(time_str[6..7]), toi(time_str[8..9]), toi(time_str[10..11]), toi(time_str[12..13]), toi(time_str[14..16])*1000)
|
83
83
|
if (first_time_stamp == nil)
|
84
84
|
first_time_stamp = time_stamp
|
@@ -92,7 +92,7 @@ def run(iteration)
|
|
92
92
|
delta_time = delta_time + delta_time_milliseconds
|
93
93
|
|
94
94
|
strOut << (delta_time).to_s << "\t" << event_name
|
95
|
-
target_object = node.xpath("#{node.path}/
|
95
|
+
target_object = node.xpath("#{node.path}/obj").first
|
96
96
|
if(target_object)
|
97
97
|
target_object_name = target_object.attribute("name").text
|
98
98
|
target_object_type = target_object.attribute("type").text
|
@@ -114,16 +114,16 @@ def run(iteration)
|
|
114
114
|
if !@settings[:signals].empty?
|
115
115
|
signals = app.fixture('signal', 'get_signal')
|
116
116
|
app.fixture('signal', 'remove_signals')
|
117
|
-
#puts signals
|
117
|
+
#puts signals
|
118
118
|
doc = Nokogiri::XML.parse(signals)
|
119
119
|
first_time_stamp = nil
|
120
|
-
node_set = doc.xpath('//tasInfo[@name = "QtSignals"]/
|
120
|
+
node_set = doc.xpath('//tasInfo[@name = "QtSignals"]/obj')
|
121
121
|
timer_counter = 0
|
122
122
|
index = 0
|
123
123
|
target_object = nil
|
124
124
|
while(index < node_set.size)
|
125
125
|
node = node_set.at(index)
|
126
|
-
time_str = node.xpath("#{node.path}/
|
126
|
+
time_str = node.xpath("#{node.path}/attr[@name = \"timeStamp\"]").first.text
|
127
127
|
time_stamp = Time.local(toi(time_str[0..3]), toi(time_str[4..5]), toi(time_str[6..7]), toi(time_str[8..9]), toi(time_str[10..11]), toi(time_str[12..13]), toi(time_str[14..16])*1000)
|
128
128
|
if (first_time_stamp == nil)
|
129
129
|
first_time_stamp = time_stamp
|
@@ -1439,7 +1439,7 @@ EXAMPLE
|
|
1439
1439
|
# generate arguments xml
|
1440
1440
|
arguments = ( feature.last[:arguments] || {} ).collect{ | arg |
|
1441
1441
|
|
1442
|
-
|
1442
|
+
#p arg
|
1443
1443
|
|
1444
1444
|
# generate argument types template
|
1445
1445
|
arg.collect{ | argument |
|
@@ -1881,7 +1881,7 @@ EXAMPLE
|
|
1881
1881
|
|
1882
1882
|
warn("Warning! One of the behaviour modules is already using name '#{ module_header[:behaviour] }', saving as #{ xml_file_name }")
|
1883
1883
|
|
1884
|
-
sleep 1
|
1884
|
+
#sleep 1
|
1885
1885
|
|
1886
1886
|
end
|
1887
1887
|
|
@@ -1898,7 +1898,7 @@ EXAMPLE
|
|
1898
1898
|
xml_file_name = ( @module_path[1..-1].join("") ) + '.xml'
|
1899
1899
|
|
1900
1900
|
warn("Warning: #{ @module_path.join("::") } does not have behaviour (module) description defined, saving as %s " % xml_file_name )
|
1901
|
-
sleep 2
|
1901
|
+
#sleep 2
|
1902
1902
|
|
1903
1903
|
if @created_files.has_key?( xml_file_name )
|
1904
1904
|
|
@@ -1906,7 +1906,7 @@ EXAMPLE
|
|
1906
1906
|
|
1907
1907
|
xml_file_name = ( @module_path[1..-1].join("") ) + '_duplicate_name.xml'
|
1908
1908
|
|
1909
|
-
sleep 1
|
1909
|
+
#sleep 1
|
1910
1910
|
|
1911
1911
|
end
|
1912
1912
|
|
@@ -490,7 +490,32 @@
|
|
490
490
|
<!-- method: call example using parameters -->
|
491
491
|
<xsl:if test="@type='method'">
|
492
492
|
|
493
|
-
|
493
|
+
<!-- contains($type/@name,' ') -->
|
494
|
+
|
495
|
+
<!--
|
496
|
+
|
497
|
+
<xsl:choose>
|
498
|
+
<xsl:when test="string-length($tmp_full_tag)=0">
|
499
|
+
<xsl:value-of select="substring-after(substring-before($text, ']'), '[')" />
|
500
|
+
</xsl:when>
|
501
|
+
<xsl:otherwise>
|
502
|
+
<xsl:value-of select="$tmp_full_tag" />
|
503
|
+
</xsl:otherwise>
|
504
|
+
</xsl:choose>
|
505
|
+
|
506
|
+
|
507
|
+
-->
|
508
|
+
|
509
|
+
<!-- determine whether add dot between the object and method; e.g. object.method or object[]-->
|
510
|
+
|
511
|
+
<xsl:choose>
|
512
|
+
<xsl:when test="contains(@name, '[')">
|
513
|
+
<xsl:text>object</xsl:text>
|
514
|
+
</xsl:when>
|
515
|
+
<xsl:otherwise>
|
516
|
+
<xsl:text>object.</xsl:text><xsl:value-of select="@name" />
|
517
|
+
</xsl:otherwise>
|
518
|
+
</xsl:choose>
|
494
519
|
|
495
520
|
<xsl:choose>
|
496
521
|
|
@@ -506,7 +531,17 @@
|
|
506
531
|
|
507
532
|
<!-- do not show parenthesis if first argument is type of block -->
|
508
533
|
<xsl:if test="arguments/argument[1]/@type!='block'">
|
509
|
-
|
534
|
+
|
535
|
+
<xsl:choose>
|
536
|
+
<xsl:when test="contains(@name, '[')">
|
537
|
+
<xsl:text>[ </xsl:text>
|
538
|
+
</xsl:when>
|
539
|
+
<xsl:otherwise>
|
540
|
+
<xsl:text>( </xsl:text>
|
541
|
+
</xsl:otherwise>
|
542
|
+
</xsl:choose>
|
543
|
+
|
544
|
+
<!--<xsl:text>( </xsl:text>-->
|
510
545
|
|
511
546
|
<!-- collect arguments for example -->
|
512
547
|
<xsl:for-each select="arguments/argument">
|
@@ -551,7 +586,18 @@
|
|
551
586
|
</xsl:if>
|
552
587
|
|
553
588
|
</xsl:for-each>
|
554
|
-
|
589
|
+
<!--<xsl:text> ) </xsl:text>-->
|
590
|
+
|
591
|
+
<xsl:choose>
|
592
|
+
<xsl:when test="contains(@name, ']')">
|
593
|
+
<xsl:text> ] </xsl:text>
|
594
|
+
</xsl:when>
|
595
|
+
<xsl:otherwise>
|
596
|
+
<xsl:text> ) </xsl:text>
|
597
|
+
</xsl:otherwise>
|
598
|
+
</xsl:choose>
|
599
|
+
|
600
|
+
|
555
601
|
</xsl:if>
|
556
602
|
|
557
603
|
<!-- collect arguments for example -->
|
@@ -1636,42 +1682,78 @@
|
|
1636
1682
|
|
1637
1683
|
</xsl:template>
|
1638
1684
|
|
1685
|
+
<!-- template#process_tags -->
|
1639
1686
|
<xsl:template name="process_tags">
|
1640
1687
|
|
1641
1688
|
<xsl:param name="text"/>
|
1642
1689
|
|
1643
1690
|
<xsl:variable name="remainingContent" select="$text"/>
|
1644
1691
|
|
1645
|
-
<!-- content before start
|
1692
|
+
<!-- content before tag start character -->
|
1646
1693
|
<xsl:variable name="content_before_tag" select="substring-before($text, '[')"/>
|
1647
1694
|
|
1648
1695
|
<!-- content after start tag -->
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
<xsl:variable name="full_tag" select="substring-after(substring-before($text, ']'), '[')"/>
|
1696
|
+
<!-- content after start tag: content[/example_tag]continues-->
|
1697
|
+
<!--<xsl:variable name="content_after_tag" select="substring-after(substring-after($text, '['), ']')"/>
|
1698
|
+
-->
|
1653
1699
|
|
1654
|
-
|
1700
|
+
<!-- start tag: [example_tag="abcdef"] -->
|
1701
|
+
<xsl:variable name="content_after_tag">
|
1702
|
+
<xsl:variable name="tmp_content_after_tag" select="substring-after(substring-after($text, '['), '"]')"/>
|
1703
|
+
<xsl:choose>
|
1704
|
+
<xsl:when test="string-length($tmp_content_after_tag)=0">
|
1705
|
+
<xsl:value-of select="substring-after(substring-after($text, '['), ']')" />
|
1706
|
+
</xsl:when>
|
1707
|
+
<xsl:otherwise>
|
1708
|
+
<xsl:value-of select="$tmp_content_after_tag" />
|
1709
|
+
</xsl:otherwise>
|
1710
|
+
</xsl:choose>
|
1711
|
+
</xsl:variable>
|
1655
1712
|
|
1656
|
-
<!-- content between tag -->
|
1657
|
-
<xsl:variable name="tag_content" select="substring-before($content_after_tag, concat('[/', $tag, ']'))"/>
|
1658
1713
|
|
1659
|
-
|
1714
|
+
<!-- start tag: [example_tag="abcdef"] -->
|
1715
|
+
<!-- <xsl:variable name="tmp_full_tag" select="substring-after(substring-before($text, '"]'), '[')"/>
|
1716
|
+
-->
|
1660
1717
|
|
1661
|
-
|
1718
|
+
<!-- check if full tag contains string value -->
|
1662
1719
|
|
1663
1720
|
<!--
|
1664
|
-
<br /><b>tag: </b><xsl:value-of select="$tag" />
|
1665
1721
|
|
1666
|
-
|
1722
|
+
|
1723
|
+
<xsl:if test="string-length($tag_content)=0">
|
1667
1724
|
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1725
|
+
<xsl:call-template name="process_tags">
|
1726
|
+
<xsl:with-param name="text" select="$content_after_start_tag" />
|
1727
|
+
</xsl:call-template>
|
1728
|
+
|
1729
|
+
</xsl:if>
|
1672
1730
|
|
1673
|
-
|
1674
|
-
|
1731
|
+
-->
|
1732
|
+
|
1733
|
+
<xsl:variable name="full_tag">
|
1734
|
+
<!-- start tag: [example_tag="abcdef"] -->
|
1735
|
+
<xsl:variable name="tmp_full_tag" select="substring-after(substring-before($text, '"]'), '[')"/>
|
1736
|
+
<xsl:choose>
|
1737
|
+
<xsl:when test="string-length($tmp_full_tag)=0">
|
1738
|
+
<xsl:value-of select="substring-after(substring-before($text, ']'), '[')" />
|
1739
|
+
</xsl:when>
|
1740
|
+
<xsl:otherwise>
|
1741
|
+
<xsl:value-of select="$tmp_full_tag" />
|
1742
|
+
</xsl:otherwise>
|
1743
|
+
</xsl:choose>
|
1744
|
+
</xsl:variable>
|
1745
|
+
|
1746
|
+
<!-- tag: example_tag -->
|
1747
|
+
<xsl:variable name="tag" select="str:split(substring-after(substring-before($text, ']'), '['), '=')[1]"/>
|
1748
|
+
|
1749
|
+
<!-- content between tags: content-->
|
1750
|
+
<xsl:variable name="tag_content" select="substring-before($content_after_tag, concat('[/', $tag, ']'))"/>
|
1751
|
+
|
1752
|
+
<!-- content after start tag: content[/example_tag]continues -->
|
1753
|
+
<xsl:variable name="content_after_start_tag" select="substring-after($text, concat('[',$tag,']'))"/>
|
1754
|
+
|
1755
|
+
<!-- content after end tag: continues-->
|
1756
|
+
<xsl:variable name="content_after_end_tag" select="substring-after($content_after_tag, concat('[/', $tag, ']'))"/>
|
1675
1757
|
|
1676
1758
|
<!-- show leading text before tag... -->
|
1677
1759
|
<xsl:value-of select="$content_before_tag" />
|
@@ -236,7 +236,7 @@ module MobyBehaviour
|
|
236
236
|
|
237
237
|
result_hash = {
|
238
238
|
|
239
|
-
:object => { :type =>
|
239
|
+
:object => { :type => @type, :sut => kind_of?( MobyBase::SUT ) ? id : sut.id },
|
240
240
|
:methods => object_methods,
|
241
241
|
:behaviours => behaviours
|
242
242
|
}
|
@@ -17,9 +17,13 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
+
[
|
20
21
|
|
22
|
+
# command_data abstract class
|
23
|
+
'command_data.rb'
|
21
24
|
|
25
|
+
].each{ | filename |
|
22
26
|
|
23
|
-
|
24
|
-
require File.expand_path( File.join( File.dirname( __FILE__ ), 'command_data' ) )
|
27
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
|
25
28
|
|
29
|
+
}
|
data/lib/tdriver/base/loader.rb
CHANGED
@@ -17,24 +17,31 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
|
-
require File.expand_path( File.join( File.dirname( __FILE__ ), 'behaviour/loader' ) )
|
20
|
+
[
|
22
21
|
|
23
|
-
#
|
24
|
-
|
22
|
+
# behaviour abstraction class, factory and all other related modules etc
|
23
|
+
'behaviour/loader.rb',
|
25
24
|
|
26
|
-
# command_data
|
27
|
-
|
25
|
+
# command_data abstraction class etc.
|
26
|
+
'command_data/loader.rb',
|
28
27
|
|
29
|
-
#
|
30
|
-
|
28
|
+
# command_data controller abstraction class etc.
|
29
|
+
'controller/loader.rb',
|
31
30
|
|
32
|
-
#
|
33
|
-
|
31
|
+
# sut abstract class, generic sut etc
|
32
|
+
'sut/loader.rb',
|
34
33
|
|
35
|
-
#
|
36
|
-
|
34
|
+
# error classes
|
35
|
+
'errors.rb',
|
37
36
|
|
38
|
-
#
|
39
|
-
|
37
|
+
# test object abstraction, factory, identificator behaviours and all other related modules
|
38
|
+
'test_object/loader.rb',
|
40
39
|
|
40
|
+
# state object
|
41
|
+
'state_object.rb'
|
42
|
+
|
43
|
+
].each{ | filename |
|
44
|
+
|
45
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
|
46
|
+
|
47
|
+
}
|
@@ -307,7 +307,7 @@ module MobyBase
|
|
307
307
|
# TODO: document me
|
308
308
|
def inspect
|
309
309
|
|
310
|
-
"#<#{ self.class }:0x#{ ( "%x" % (
|
310
|
+
"#<#{ self.class }:0x#{ ( "%x" % ( object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=#{ @id.inspect } @type=\"#{ @type }\" @name=\"#{ @name }\">"
|
311
311
|
|
312
312
|
end
|
313
313
|
|
@@ -84,20 +84,25 @@ module MobyBase
|
|
84
84
|
|
85
85
|
command_data.check_type MobyCommand::CommandData, 'Wrong argument type $1 for command_data (expected $2)'
|
86
86
|
|
87
|
+
_command_class_suffix = command_data.class.name.gsub(/^MobyCommand::/, '')
|
88
|
+
|
89
|
+
_execution_order_count = @execution_order.count
|
90
|
+
|
87
91
|
# retrieve controller for command; iterate through each sut controller
|
88
92
|
@execution_order.each_with_index do | controller, index |
|
89
93
|
|
90
94
|
begin
|
91
95
|
|
92
96
|
# extend command_data with combinination of corresponding sut specific controller
|
93
|
-
command_data.extend eval("#{ @sut_controllers[ controller ] }::#{
|
97
|
+
command_data.extend eval( "#{ @sut_controllers[ controller ] }::#{ _command_class_suffix }" )
|
94
98
|
|
99
|
+
# controller found
|
95
100
|
break
|
96
101
|
|
97
102
|
rescue NameError
|
98
103
|
|
99
104
|
# raise exception only if none controller found
|
100
|
-
if ( index + 1 ) ==
|
105
|
+
if ( index + 1 ) == _execution_order_count
|
101
106
|
|
102
107
|
raise MobyBase::ControllerNotFoundError, "No controller found for command data object #{ command_data.inspect }"
|
103
108
|
|
@@ -117,6 +122,7 @@ module MobyBase
|
|
117
122
|
# execute the command
|
118
123
|
command_data.execute
|
119
124
|
|
125
|
+
# retry in case of IO/connection error
|
120
126
|
rescue Errno::EPIPE, IOError
|
121
127
|
|
122
128
|
raise if retries == 1
|
@@ -185,7 +185,7 @@ module MobyBehaviour
|
|
185
185
|
def freeze
|
186
186
|
|
187
187
|
=begin
|
188
|
-
if
|
188
|
+
if use_find_objects
|
189
189
|
|
190
190
|
warn("warning: SUT##{ __method__ } is not supported when use_find_objects optimization is enabled")
|
191
191
|
|
@@ -213,7 +213,7 @@ module MobyBehaviour
|
|
213
213
|
def unfreeze
|
214
214
|
|
215
215
|
=begin
|
216
|
-
if
|
216
|
+
if use_find_objects
|
217
217
|
|
218
218
|
warn("warning: SUT##{ __method__ } is not supported when use_find_objects optimization is enabled")
|
219
219
|
|
@@ -260,13 +260,17 @@ module MobyBehaviour
|
|
260
260
|
|
261
261
|
if xml.kind_of?( MobyUtil::XML::Element )
|
262
262
|
|
263
|
+
@test_object_adapter = @test_object_adapter.identify_test_object_adapter_from_data( xml )
|
264
|
+
|
263
265
|
@xml_data = xml
|
264
266
|
@frozen = true
|
265
267
|
@forced_xml = true
|
266
268
|
|
267
269
|
elsif xml.kind_of?( String )
|
268
270
|
|
269
|
-
@
|
271
|
+
@test_object_adapter = @test_object_adapter.identify_test_object_adapter_from_data( xml )
|
272
|
+
|
273
|
+
@xml_data = MobyUtil::XML.parse_string( xml )
|
270
274
|
@frozen = true
|
271
275
|
@forced_xml = true
|
272
276
|
|
@@ -387,42 +391,55 @@ module MobyBehaviour
|
|
387
391
|
# description: If the implementation is missing for the method
|
388
392
|
def setup
|
389
393
|
|
390
|
-
if
|
394
|
+
if sut_parameters[ :sut_setup, nil ] || sut_parameters[ :setup, nil ]
|
391
395
|
|
392
|
-
if
|
393
|
-
|
396
|
+
if sut_parameters[ :sut_setup, nil ]
|
397
|
+
|
398
|
+
require MobyUtil::FileHelper.expand_path( sut_parameters[ :sut_setup ] )
|
394
399
|
|
395
400
|
$logger.behaviour "PASS;sut.setup method found"
|
396
401
|
|
397
|
-
|
402
|
+
setup
|
398
403
|
|
399
404
|
$logger.behaviour "PASS;sut.setup executed"
|
405
|
+
|
400
406
|
end
|
401
407
|
|
402
|
-
if
|
408
|
+
if sut_parameters[ :setup, nil ]
|
409
|
+
|
403
410
|
$logger.behaviour "PASS;sut.setup parameters found"
|
404
|
-
|
405
|
-
methods
|
406
|
-
|
407
|
-
|
411
|
+
|
412
|
+
methods = sut_parameters[ :setup ]
|
413
|
+
|
414
|
+
methods.each do | method |
|
415
|
+
|
416
|
+
m = method[0].to_s
|
417
|
+
|
418
|
+
args = method[1]
|
419
|
+
|
408
420
|
if args.to_s == ""
|
421
|
+
|
409
422
|
eval("self.#{m}")
|
423
|
+
|
410
424
|
else
|
425
|
+
|
411
426
|
eval("self.#{m}(:#{args.to_sym})")
|
427
|
+
|
412
428
|
end
|
429
|
+
|
413
430
|
end
|
431
|
+
|
414
432
|
$logger.behaviour "PASS;sut.setup parameter methods executed"
|
433
|
+
|
415
434
|
end
|
416
435
|
|
417
436
|
else
|
418
|
-
$logger.behaviour "FAIL;No methods or parameters found for sut.setup"
|
419
437
|
|
438
|
+
$logger.behaviour "FAIL;No methods or parameters found for sut.setup"
|
420
439
|
raise MobyBase::BehaviourError.new("Setup", "Failed to load sut.setup method check the :sut_setup parameter")
|
421
440
|
|
422
441
|
end
|
423
442
|
|
424
|
-
|
425
|
-
|
426
443
|
end
|
427
444
|
|
428
445
|
# == description
|
@@ -437,34 +454,50 @@ module MobyBehaviour
|
|
437
454
|
# description: If the implementation is missing for the method
|
438
455
|
def teardown
|
439
456
|
|
440
|
-
if
|
457
|
+
if sut_parameters[ :sut_teardown, nil ] || sut_parameters[ :teardown, nil ]
|
441
458
|
|
442
|
-
if
|
443
|
-
|
459
|
+
if sut_parameters[ :sut_teardown, nil ]
|
460
|
+
|
461
|
+
require MobyUtil::FileHelper.expand_path(sut_parameters[ :sut_teardown ])
|
444
462
|
|
445
463
|
$logger.behaviour "PASS;sut.teardown method found"
|
446
464
|
|
447
|
-
|
465
|
+
teardown
|
448
466
|
|
449
467
|
$logger.behaviour "PASS;sut.teardown executed"
|
468
|
+
|
450
469
|
end
|
451
470
|
|
452
|
-
if
|
471
|
+
if sut_parameters[ :teardown, nil ]
|
472
|
+
|
453
473
|
$logger.behaviour "PASS;sut.teardown parameters found"
|
454
|
-
|
455
|
-
methods
|
456
|
-
|
457
|
-
|
474
|
+
|
475
|
+
methods = sut_parameters[ :teardown ]
|
476
|
+
|
477
|
+
methods.each do | method |
|
478
|
+
|
479
|
+
m = method[0].to_s
|
480
|
+
|
481
|
+
args = method[1]
|
482
|
+
|
458
483
|
if args.to_s == ""
|
484
|
+
|
459
485
|
eval("self.#{m}")
|
486
|
+
|
460
487
|
else
|
488
|
+
|
461
489
|
eval("self.#{m}(:#{args.to_sym})")
|
490
|
+
|
462
491
|
end
|
492
|
+
|
463
493
|
end
|
494
|
+
|
464
495
|
$logger.behaviour "PASS;sut.teardown parameter methods executed"
|
496
|
+
|
465
497
|
end
|
466
498
|
|
467
499
|
else
|
500
|
+
|
468
501
|
$logger.behaviour "FAIL;No method or parameters found for sut.teardown"
|
469
502
|
|
470
503
|
raise MobyBase::BehaviourError.new("Teardown", "Failed to load sut.teardown method check the :sut_teardown parameter")
|
@@ -511,7 +544,7 @@ module MobyBehaviour
|
|
511
544
|
if source_data.nil?
|
512
545
|
|
513
546
|
# refresh if xml data is empty
|
514
|
-
|
547
|
+
refresh if @xml_data.empty?
|
515
548
|
|
516
549
|
raise RuntimeError, "Can not create state object of SUT with id #{ @id.inspect }, no XML content or SUT not initialized properly." if @xml_data.empty?
|
517
550
|
|
@@ -540,10 +573,13 @@ module MobyBehaviour
|
|
540
573
|
# Returns the current foreground application or one which matches with given attributes rules.
|
541
574
|
#
|
542
575
|
# == arguments
|
543
|
-
#
|
576
|
+
# target
|
544
577
|
# Hash
|
545
578
|
# description: Hash defining required expected attributes of the application
|
546
|
-
# example: { :name =>
|
579
|
+
# example: { :name => "testapp" }
|
580
|
+
# String
|
581
|
+
# description: Name of application
|
582
|
+
# example: "testapp"
|
547
583
|
#
|
548
584
|
# == returns
|
549
585
|
# MobyBase::TestObject
|
@@ -554,20 +590,24 @@ module MobyBehaviour
|
|
554
590
|
# TypeError
|
555
591
|
# description: Wrong argument type <class> for attributes (expected Hash)
|
556
592
|
#
|
557
|
-
def application(
|
593
|
+
def application( target = {} )
|
558
594
|
|
559
595
|
begin
|
560
596
|
|
561
|
-
|
597
|
+
# raise exception if argument type other than hash
|
598
|
+
target.check_type( [ String, Hash ], "Wrong argument type $1 for application identification rules (expected $2)" )
|
562
599
|
|
563
|
-
|
600
|
+
# if target application is given as string, interpret it as application name
|
601
|
+
target = { :name => target.to_s } if target.kind_of?( String )
|
602
|
+
|
603
|
+
target[ :type ] = 'application'
|
564
604
|
|
565
|
-
|
605
|
+
target[ :__parent_application ] = nil
|
566
606
|
|
567
|
-
@current_application_id = nil if
|
607
|
+
@current_application_id = nil if target[ :id ].nil?
|
568
608
|
|
569
609
|
# create test object and return it as result
|
570
|
-
test_object = child(
|
610
|
+
test_object = child( target )
|
571
611
|
|
572
612
|
# store parent application to test object
|
573
613
|
test_object.instance_variable_set( :@parent_application, test_object )
|
@@ -577,7 +617,7 @@ module MobyBehaviour
|
|
577
617
|
rescue
|
578
618
|
|
579
619
|
$logger.behaviour(
|
580
|
-
"FAIL;Failed to find application.;#{ id.to_s };sut;{};application;#{
|
620
|
+
"FAIL;Failed to find application.;#{ id.to_s };sut;{};application;#{ target.kind_of?( Hash ) ? target.inspect : target.class.to_s }"
|
581
621
|
)
|
582
622
|
|
583
623
|
# raise same exception
|
@@ -585,7 +625,7 @@ module MobyBehaviour
|
|
585
625
|
|
586
626
|
ensure
|
587
627
|
|
588
|
-
$logger.behaviour "PASS;Application found.;#{ id.to_s };sut;{};application;#{
|
628
|
+
$logger.behaviour "PASS;Application found.;#{ id.to_s };sut;{};application;#{ target.inspect }" if $!.nil?
|
589
629
|
|
590
630
|
end
|
591
631
|
|
@@ -760,7 +800,7 @@ module MobyBehaviour
|
|
760
800
|
|
761
801
|
app_list = MobyBase::StateObject.new(
|
762
802
|
|
763
|
-
:source_data =>
|
803
|
+
:source_data => list_apps,
|
764
804
|
:parent => nil,
|
765
805
|
:test_object_adapter => @test_object_adapter
|
766
806
|
|
@@ -773,7 +813,7 @@ module MobyBehaviour
|
|
773
813
|
app_info = find_app(app_list, {:id => target[ :uid ]}) if target[ :uid ] != nil
|
774
814
|
app_info = find_app(app_list, {:name => target[ :name ]}) unless app_info
|
775
815
|
|
776
|
-
app =
|
816
|
+
app = application(:id => app_info.id) if app_info
|
777
817
|
|
778
818
|
if target[:restart_if_running] && app
|
779
819
|
|
@@ -800,7 +840,7 @@ module MobyBehaviour
|
|
800
840
|
|
801
841
|
if ( target[ :start_command ] != nil )
|
802
842
|
|
803
|
-
raise MobyBase::BehaviourError.new("Run", "Failed to load execute_shell_method") unless
|
843
|
+
raise MobyBase::BehaviourError.new("Run", "Failed to load execute_shell_method") unless respond_to?("execute_shell_command")
|
804
844
|
|
805
845
|
execute_shell_command( target[ :start_command ], :detached => "true" )
|
806
846
|
|
@@ -884,7 +924,7 @@ module MobyBehaviour
|
|
884
924
|
# verify that application is launched and application test object is found from xml
|
885
925
|
expected_attributes.delete( :name )
|
886
926
|
|
887
|
-
|
927
|
+
wait_child(
|
888
928
|
|
889
929
|
# attributes to identify application object
|
890
930
|
expected_attributes,
|
@@ -1178,10 +1218,10 @@ module MobyBehaviour
|
|
1178
1218
|
if ( sut_parameters[ :read_lang_from_app ]=='true')
|
1179
1219
|
|
1180
1220
|
#read localeName app
|
1181
|
-
language=
|
1221
|
+
language = application.attribute("localeName")
|
1182
1222
|
|
1183
1223
|
#determine the language from the locale
|
1184
|
-
language=language.split('_')[0].to_s if (language!=nil && !language.empty?)
|
1224
|
+
language = language.split('_')[0].to_s if (language!=nil && !language.empty?)
|
1185
1225
|
|
1186
1226
|
else
|
1187
1227
|
|
@@ -1491,6 +1531,26 @@ module MobyBehaviour
|
|
1491
1531
|
|
1492
1532
|
end
|
1493
1533
|
|
1534
|
+
# == nodoc
|
1535
|
+
# == description
|
1536
|
+
# == returns
|
1537
|
+
def use_find_objects=( value )
|
1538
|
+
|
1539
|
+
value.check_type [ TrueClass, FalseClass ], 'wrong argument type $1 for use_find_objects (expected $2)'
|
1540
|
+
|
1541
|
+
sut_parameters[ :use_find_object ] = value
|
1542
|
+
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
# == nodoc
|
1546
|
+
# == description
|
1547
|
+
# == returns
|
1548
|
+
def use_find_objects
|
1549
|
+
|
1550
|
+
sut_parameters[ :use_find_object, false ].true? && respond_to?( 'find_object' ).true?
|
1551
|
+
|
1552
|
+
end
|
1553
|
+
|
1494
1554
|
private
|
1495
1555
|
|
1496
1556
|
# TODO: document me
|
@@ -1511,9 +1571,6 @@ module MobyBehaviour
|
|
1511
1571
|
|
1512
1572
|
unless @frozen
|
1513
1573
|
|
1514
|
-
# determine should FindObjects service be used
|
1515
|
-
use_find_objects = sut_parameters[ :use_find_object, 'false' ] == 'true' and self.respond_to?( 'find_object' ) == true
|
1516
|
-
|
1517
1574
|
# duplicate refresh arguments hash
|
1518
1575
|
refresh_arguments = refresh_args.clone
|
1519
1576
|
|
@@ -1526,7 +1583,7 @@ module MobyBehaviour
|
|
1526
1583
|
# store as local variable for less AST lookups
|
1527
1584
|
xml_data_checksum = @xml_data_checksum
|
1528
1585
|
|
1529
|
-
#use find_object if set on and the method exists
|
1586
|
+
# use find_object if set on and the method exists
|
1530
1587
|
if use_find_objects
|
1531
1588
|
|
1532
1589
|
# retrieve new ui dump xml and checksum
|
@@ -1563,7 +1620,7 @@ module MobyBehaviour
|
|
1563
1620
|
xml_data, from_cache = MobyUtil::XML.parse_string( new_xml_data, new_checksum )
|
1564
1621
|
|
1565
1622
|
# store new xml data object
|
1566
|
-
@xml_data = xml_data
|
1623
|
+
@xml_data = xml_data
|
1567
1624
|
|
1568
1625
|
# store xml checksum to be compared while next ui dump request; do not reparse xml if checksum values are equal
|
1569
1626
|
@xml_data_checksum = new_checksum
|