testability-driver 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -0
- data/bin/start_app_perf +199 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +39 -0
- data/ext/extconf.rb +67 -0
- data/ext/native_extensions.c +70 -0
- data/lib/matti.rb +30 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
- data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
- data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
- data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/generate.rb +892 -0
- data/lib/tdriver-devtools/doc/update +1 -0
- data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
- data/lib/tdriver-devtools/doc/xslt/update +3 -0
- data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
- data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
- data/lib/tdriver.rb +26 -0
- data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
- data/lib/tdriver/base/behaviour/factory.rb +380 -0
- data/lib/tdriver/base/behaviour/loader.rb +28 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +25 -0
- data/lib/tdriver/base/errors.rb +131 -0
- data/lib/tdriver/base/loader.rb +38 -0
- data/lib/tdriver/base/state_object.rb +270 -0
- data/lib/tdriver/base/sut/adapter.rb +28 -0
- data/lib/tdriver/base/sut/controller.rb +119 -0
- data/lib/tdriver/base/sut/factory.rb +287 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +67 -0
- data/lib/tdriver/base/test_object/abstract.rb +179 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
- data/lib/tdriver/base/test_object/factory.rb +618 -0
- data/lib/tdriver/base/test_object/identificator.rb +511 -0
- data/lib/tdriver/base/test_object/loader.rb +37 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +36 -0
- data/lib/tdriver/matti.rb +35 -0
- data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
- data/lib/tdriver/report/report.rb +47 -0
- data/lib/tdriver/report/report_api.rb +207 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
- data/lib/tdriver/report/report_creator.rb +571 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
- data/lib/tdriver/report/report_data_presentation.rb +152 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +284 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_grouping.rb +539 -0
- data/lib/tdriver/report/report_junit_xml.rb +147 -0
- data/lib/tdriver/report/report_rspec.rb +108 -0
- data/lib/tdriver/report/report_test_case_run.rb +621 -0
- data/lib/tdriver/report/report_test_run.rb +1286 -0
- data/lib/tdriver/report/report_test_unit.rb +175 -0
- data/lib/tdriver/report/report_writer.rb +1405 -0
- data/lib/tdriver/tdriver.rb +158 -0
- data/lib/tdriver/util/common.rb +24 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/crc16.rb +100 -0
- data/lib/tdriver/util/common/environment.rb +153 -0
- data/lib/tdriver/util/common/error.rb +39 -0
- data/lib/tdriver/util/common/file.rb +315 -0
- data/lib/tdriver/util/common/gem.rb +108 -0
- data/lib/tdriver/util/common/kernel.rb +189 -0
- data/lib/tdriver/util/common/loader.rb +39 -0
- data/lib/tdriver/util/common/retryable.rb +98 -0
- data/lib/tdriver/util/common/string.rb +77 -0
- data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
- data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
- data/lib/tdriver/util/dbaccess/error.rb +35 -0
- data/lib/tdriver/util/dbaccess/loader.rb +29 -0
- data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
- data/lib/tdriver/util/hooking.rb +434 -0
- data/lib/tdriver/util/loader.rb +65 -0
- data/lib/tdriver/util/localisation.rb +24 -0
- data/lib/tdriver/util/localisation/error.rb +32 -0
- data/lib/tdriver/util/localisation/loader.rb +28 -0
- data/lib/tdriver/util/localisation/localisation.rb +479 -0
- data/lib/tdriver/util/logger.rb +377 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +26 -0
- data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
- data/lib/tdriver/util/other/config.rb +221 -0
- data/lib/tdriver/util/parameter.rb +24 -0
- data/lib/tdriver/util/parameter/error.rb +45 -0
- data/lib/tdriver/util/parameter/loader.rb +37 -0
- data/lib/tdriver/util/parameter/parameter.rb +285 -0
- data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
- data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
- data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
- data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
- data/lib/tdriver/util/plugin/abstract.rb +60 -0
- data/lib/tdriver/util/plugin/error.rb +25 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +200 -0
- data/lib/tdriver/util/recorder.rb +292 -0
- data/lib/tdriver/util/stats.rb +90 -0
- data/lib/tdriver/util/user_data/error.rb +29 -0
- data/lib/tdriver/util/user_data/loader.rb +26 -0
- data/lib/tdriver/util/user_data/user_data.rb +103 -0
- data/lib/tdriver/util/video_rec.rb +264 -0
- data/lib/tdriver/util/xml/abstraction.rb +47 -0
- data/lib/tdriver/util/xml/builder.rb +54 -0
- data/lib/tdriver/util/xml/document.rb +32 -0
- data/lib/tdriver/util/xml/element.rb +32 -0
- data/lib/tdriver/util/xml/error.rb +46 -0
- data/lib/tdriver/util/xml/loader.rb +46 -0
- data/lib/tdriver/util/xml/nil_element.rb +89 -0
- data/lib/tdriver/util/xml/nodeset.rb +32 -0
- data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
- data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
- data/lib/tdriver/util/xml/xml.rb +170 -0
- data/lib/tdriver/verify/verify.rb +687 -0
- data/lib/tdriver/verify/verify.rb_org +630 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +495 -0
- data/xml/defaults/generic.xml +97 -0
- data/xml/defaults/sut_generic.xml +36 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +227 -0
- metadata +327 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
placeholder
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
############################################################################
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
5
|
+
## All rights reserved.
|
|
6
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
|
7
|
+
##
|
|
8
|
+
## This file is part of Testability Driver.
|
|
9
|
+
##
|
|
10
|
+
## If you have questions regarding the use of this file, please contact
|
|
11
|
+
## Nokia at testabilitydriver@nokia.com .
|
|
12
|
+
##
|
|
13
|
+
## This library is free software; you can redistribute it and/or
|
|
14
|
+
## modify it under the terms of the GNU Lesser General Public
|
|
15
|
+
## License version 2.1 as published by the Free Software Foundation
|
|
16
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
|
17
|
+
## of this file.
|
|
18
|
+
##
|
|
19
|
+
############################################################################
|
|
20
|
+
|
|
21
|
+
$tdriver_devtools_initialized = true
|
|
22
|
+
|
|
23
|
+
def safe_require( *paths )
|
|
24
|
+
|
|
25
|
+
found = false
|
|
26
|
+
|
|
27
|
+
paths.each{ | path |
|
|
28
|
+
|
|
29
|
+
begin
|
|
30
|
+
|
|
31
|
+
require path
|
|
32
|
+
|
|
33
|
+
found = true
|
|
34
|
+
|
|
35
|
+
break
|
|
36
|
+
|
|
37
|
+
rescue LoadError
|
|
38
|
+
|
|
39
|
+
#puts "path #{ path } not found"
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
abort("Unable to load one of files: %s" % paths.inspect ) unless found
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
require 'rubygems'
|
|
50
|
+
require 'rdoc/rdoc'
|
|
51
|
+
require 'optparse'
|
|
52
|
+
require 'nokogiri'
|
|
53
|
+
|
|
54
|
+
safe_require('tdriver/version.rb', File.expand_path( File.join( File.dirname( __FILE__ ), '../tdriver/version.rb' ) ) )
|
|
55
|
+
safe_require('tdriver/util/common/loader.rb', File.expand_path( File.join( File.dirname( __FILE__ ), '../tdriver/util/common/loader.rb' ) ) )
|
|
56
|
+
|
|
57
|
+
require 'tmpdir'
|
|
58
|
+
require 'fileutils'
|
|
59
|
+
|
|
60
|
+
# default options
|
|
61
|
+
@options = {
|
|
62
|
+
|
|
63
|
+
:verbose => false,
|
|
64
|
+
:tests => '.',
|
|
65
|
+
:delete => false
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@optparse = OptionParser.new do | opts |
|
|
70
|
+
|
|
71
|
+
# Set a banner, displayed at the top of the help screen.
|
|
72
|
+
opts.banner = "Usage: #{ $0 } [options] [source] [destination]"
|
|
73
|
+
|
|
74
|
+
opts.separator( "" )
|
|
75
|
+
|
|
76
|
+
opts.separator "Specific options:"
|
|
77
|
+
|
|
78
|
+
opts.on(
|
|
79
|
+
|
|
80
|
+
'-g',
|
|
81
|
+
'--generate TYPE',
|
|
82
|
+
'Available types:',
|
|
83
|
+
' doc : Generate documentation from source files.',
|
|
84
|
+
' Feature test result files and images are optional',
|
|
85
|
+
' ',
|
|
86
|
+
' Default source folder is "behaviours/"',
|
|
87
|
+
' Default destination file is "doc/document.xml"',
|
|
88
|
+
' ',
|
|
89
|
+
' behaviours : Generate behaviour XML files from implementation.',
|
|
90
|
+
' All behaviour implementation files with .rb extension in',
|
|
91
|
+
' source folder and its subfolders will be processed.',
|
|
92
|
+
' ',
|
|
93
|
+
' Default source folder is current folder.',
|
|
94
|
+
' Default destination folder is "behaviours/"',
|
|
95
|
+
' ',
|
|
96
|
+
' both : Generate behaviour XML files and documentation',
|
|
97
|
+
' Behaviour XML files are saved to temp. folder and deleted',
|
|
98
|
+
' after documentation XML is saved. Copies also all XSLT ',
|
|
99
|
+
' templates to destination folder. See -r flag also.',
|
|
100
|
+
' ',
|
|
101
|
+
' Default source folder (implementation) is current folder.',
|
|
102
|
+
' Default destination folder is "doc/document.xml"',
|
|
103
|
+
' '
|
|
104
|
+
|
|
105
|
+
) do | mode |
|
|
106
|
+
|
|
107
|
+
case mode.downcase.to_s
|
|
108
|
+
|
|
109
|
+
when 'doc'
|
|
110
|
+
@options[ :generate ] = mode.to_sym
|
|
111
|
+
@options[ :source ] ||= 'behaviours/'
|
|
112
|
+
@options[ :destination ] ||= 'doc/document.xml'
|
|
113
|
+
|
|
114
|
+
when 'behaviours'
|
|
115
|
+
@options[ :generate ] = mode.to_sym
|
|
116
|
+
@options[ :source ] ||= '.'
|
|
117
|
+
@options[ :destination ] ||= 'behaviours/'
|
|
118
|
+
|
|
119
|
+
when 'both'
|
|
120
|
+
@options[ :generate ] = mode.to_sym
|
|
121
|
+
@options[ :source ] ||= '.'
|
|
122
|
+
@options[ :destination_behaviours ] = File.expand_path( File.join( Dir.tmpdir, "tdriver-devtools-behaviours" ) )
|
|
123
|
+
@options[ :destination ] ||= 'doc/document.xml'
|
|
124
|
+
|
|
125
|
+
else
|
|
126
|
+
|
|
127
|
+
puts "Invalid value for generate option: #{ mode }", ""
|
|
128
|
+
puts opts, ""
|
|
129
|
+
exit
|
|
130
|
+
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
=begin
|
|
136
|
+
opts.on(
|
|
137
|
+
'-b',
|
|
138
|
+
'--behaviours [FOLDER]',
|
|
139
|
+
'Source folder for behaviour XML files (DOC)'
|
|
140
|
+
) do | folder |
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
=end
|
|
144
|
+
|
|
145
|
+
opts.on(
|
|
146
|
+
'-i',
|
|
147
|
+
'--images [FOLDER]',
|
|
148
|
+
'Source folder for all images used in documentation'
|
|
149
|
+
) do | folder |
|
|
150
|
+
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
opts.on(
|
|
154
|
+
'-t',
|
|
155
|
+
'--tests [FOLDER]',
|
|
156
|
+
'Source folder for feature test result files', ' '
|
|
157
|
+
) do | folder |
|
|
158
|
+
|
|
159
|
+
@options[ :tests ] = folder
|
|
160
|
+
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
=begin
|
|
164
|
+
opts.on(
|
|
165
|
+
'-o',
|
|
166
|
+
'--output FOLDER',
|
|
167
|
+
'User defined destionation folder for documentation and',
|
|
168
|
+
'behaviours XML files. Default output folder is either',
|
|
169
|
+
'"doc" or "behaviours"', ' '
|
|
170
|
+
|
|
171
|
+
) do | folder |
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
=end
|
|
175
|
+
|
|
176
|
+
opts.on(
|
|
177
|
+
'-r',
|
|
178
|
+
'--render',
|
|
179
|
+
'Render also HTML output when generating documentation' ) do
|
|
180
|
+
|
|
181
|
+
@options[:render] = true
|
|
182
|
+
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
opts.on(
|
|
186
|
+
'-d',
|
|
187
|
+
'--delete',
|
|
188
|
+
'Delete all existing behaviour XML files from output folder before generating new.',
|
|
189
|
+
'Warning! Please option use this option with caution' ) do
|
|
190
|
+
|
|
191
|
+
@options[:delete] = true
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
opts.separator ""
|
|
196
|
+
opts.separator "Common options:"
|
|
197
|
+
|
|
198
|
+
opts.on( '-v', '--version', 'Testability Driver version information' ) do
|
|
199
|
+
|
|
200
|
+
puts ENV['TDRIVER_VERSION']
|
|
201
|
+
exit
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
opts.on( '-V', '--verbose', 'Output more information' ) do
|
|
206
|
+
|
|
207
|
+
@options[ :verbose ] = true
|
|
208
|
+
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# This displays the help screen, all programs are
|
|
212
|
+
# assumed to have this option.
|
|
213
|
+
opts.on_tail("-h", "--help", "Display this message") do
|
|
214
|
+
|
|
215
|
+
puts '', opts, ''
|
|
216
|
+
exit
|
|
217
|
+
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# show help if no command line arguments given
|
|
221
|
+
if ARGV.empty?
|
|
222
|
+
|
|
223
|
+
puts '', opts, ''
|
|
224
|
+
exit
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def execute_tdriver_devtools
|
|
231
|
+
|
|
232
|
+
@optparse.parse!
|
|
233
|
+
|
|
234
|
+
case @options[ :generate ]
|
|
235
|
+
|
|
236
|
+
when :behaviours
|
|
237
|
+
|
|
238
|
+
$source = File.expand_path( ARGV[ 0 ] || @options[ :source ] )
|
|
239
|
+
$destination = File.expand_path( ARGV[ 1 ] || @options[ :destination ] )
|
|
240
|
+
|
|
241
|
+
destination_folder = File.expand_path( $destination )
|
|
242
|
+
|
|
243
|
+
if MobyUtil::FileHelper.folder_exist?( destination_folder )
|
|
244
|
+
|
|
245
|
+
if @options[ :delete ] == true
|
|
246
|
+
|
|
247
|
+
Dir.glob( File.join( destination_folder, '**', '**', '*.xml' ) ) do |entry|
|
|
248
|
+
|
|
249
|
+
begin
|
|
250
|
+
|
|
251
|
+
File.delete( entry )
|
|
252
|
+
|
|
253
|
+
rescue Exception => exception
|
|
254
|
+
|
|
255
|
+
warn("Unable to delete file %s (%s: %s)" % [ entry, exception.class, exception.message ] )
|
|
256
|
+
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
else
|
|
264
|
+
|
|
265
|
+
begin
|
|
266
|
+
|
|
267
|
+
MobyUtil::FileHelper.mkdir_path( destination_folder )
|
|
268
|
+
|
|
269
|
+
rescue Exception => exception
|
|
270
|
+
|
|
271
|
+
raise RuntimeError.new("Unable to create destination folder %s (%s: %s)" % [ destination_folder, exception.class, exception.message ])
|
|
272
|
+
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# run behaviour xml generator
|
|
278
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'behaviour/xml/generate.rb' ) )
|
|
279
|
+
|
|
280
|
+
puts ''
|
|
281
|
+
|
|
282
|
+
when :doc
|
|
283
|
+
|
|
284
|
+
$source = File.expand_path( ARGV[0] || @options[ :source ] )
|
|
285
|
+
$tests = File.expand_path( @options[ :tests ] )
|
|
286
|
+
$destination = File.expand_path( ARGV[1] || @options[ :destination ] )
|
|
287
|
+
|
|
288
|
+
destination_folder = File.dirname( $destination )
|
|
289
|
+
|
|
290
|
+
begin
|
|
291
|
+
|
|
292
|
+
unless MobyUtil::FileHelper.folder_exist?( destination_folder )
|
|
293
|
+
|
|
294
|
+
MobyUtil::FileHelper.mkdir_path( destination_folder )
|
|
295
|
+
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
rescue Exception => exception
|
|
299
|
+
|
|
300
|
+
raise RuntimeError.new("Unable to create destination folder %s (%s: %s)" % [ destination_folder, exception.class, exception.message ])
|
|
301
|
+
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'doc/generate.rb' ) ) #'lib/tdriver-devtools/behaviour/xml/generate.rb'
|
|
305
|
+
|
|
306
|
+
when :both
|
|
307
|
+
|
|
308
|
+
destination_folder = @options[ :destination_behaviours ]
|
|
309
|
+
|
|
310
|
+
begin
|
|
311
|
+
unless MobyUtil::FileHelper.folder_exist?( destination_folder )
|
|
312
|
+
MobyUtil::FileHelper.mkdir_path( destination_folder )
|
|
313
|
+
else
|
|
314
|
+
if @options[ :delete ] == true
|
|
315
|
+
Dir.glob( File.join( destination_folder, '*.xml' ) ) do |entry|
|
|
316
|
+
begin
|
|
317
|
+
#puts "Delete #{ entry }"
|
|
318
|
+
File.delete( entry )
|
|
319
|
+
rescue Exception => exception
|
|
320
|
+
warn("Unable to delete file %s (%s: %s)" % [ entry, exception.class, exception.message ] )
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
rescue Exception => exception
|
|
326
|
+
raise RuntimeError.new("Unable to create destination folder %s (%s: %s)" % [ destination_folder, exception.class, exception.message ])
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
$source = File.expand_path( ARGV[ 0 ] || @options[ :source ] )
|
|
330
|
+
$destination = destination_folder
|
|
331
|
+
|
|
332
|
+
# run 'implementation to behaviour xml' generator
|
|
333
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'behaviour/xml/generate.rb' ) )
|
|
334
|
+
|
|
335
|
+
# documentation
|
|
336
|
+
$source = destination_folder
|
|
337
|
+
$tests = File.expand_path( @options[ :tests ] )
|
|
338
|
+
$destination = File.expand_path( ARGV[1] || @options[ :destination ] )
|
|
339
|
+
destination_folder = File.dirname( $destination )
|
|
340
|
+
|
|
341
|
+
begin
|
|
342
|
+
unless MobyUtil::FileHelper.folder_exist?( destination_folder )
|
|
343
|
+
MobyUtil::FileHelper.mkdir_path( destination_folder )
|
|
344
|
+
end
|
|
345
|
+
rescue Exception => exception
|
|
346
|
+
raise RuntimeError.new("Unable to create destination folder %s (%s: %s)" % [ destination_folder, exception.class, exception.message ])
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'doc/generate.rb' ) )
|
|
350
|
+
|
|
351
|
+
begin
|
|
352
|
+
|
|
353
|
+
FileUtils.cp( Dir.glob( File.expand_path( File.join( File.dirname( __FILE__ ), 'doc/xslt/*.xsl' ) ) ), destination_folder )
|
|
354
|
+
|
|
355
|
+
puts "Template XSLT file(s) copied to destination folder succesfully\n\n"
|
|
356
|
+
|
|
357
|
+
rescue Exception => exception
|
|
358
|
+
|
|
359
|
+
warn("Error while copying template xslt files to destination due to %s (%s)" % [ exception.message, exception.class ] )
|
|
360
|
+
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
if @options[:render] == true
|
|
364
|
+
|
|
365
|
+
begin
|
|
366
|
+
|
|
367
|
+
doc = Nokogiri::XML( open( $destination , 'r' ).read )
|
|
368
|
+
|
|
369
|
+
puts "Generating HTML output file(s) of documentation"
|
|
370
|
+
|
|
371
|
+
Dir.glob( File.expand_path( File.join( destination_folder, '*.xsl' ) ) ) do | template |
|
|
372
|
+
|
|
373
|
+
File.open(
|
|
374
|
+
File.join(
|
|
375
|
+
destination_folder,
|
|
376
|
+
"#{ File.basename( $destination ).gsub( File.extname( $destination ), '' ) }_#{ File.basename( template ).gsub( File.extname( template ), '' ) }.html"
|
|
377
|
+
),
|
|
378
|
+
'w'
|
|
379
|
+
){ | file |
|
|
380
|
+
|
|
381
|
+
file << Nokogiri::XSLT( open( template, 'r' ).read ).transform( doc )
|
|
382
|
+
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
rescue Exception => exception
|
|
388
|
+
|
|
389
|
+
warn("Error while geneating HTML files from template(s) due to %s (%s)" % [ exception.message, exception.class ] )
|
|
390
|
+
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
else
|
|
396
|
+
|
|
397
|
+
puts '', @optparse, ''
|
|
398
|
+
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
execute_tdriver_devtools
|
|
404
|
+
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
############################################################################
|
|
2
|
+
##
|
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
4
|
+
## All rights reserved.
|
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
|
6
|
+
##
|
|
7
|
+
## This file is part of TDriver.
|
|
8
|
+
##
|
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
|
11
|
+
##
|
|
12
|
+
## This library is free software; you can redistribute it and/or
|
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
|
16
|
+
## of this file.
|
|
17
|
+
##
|
|
18
|
+
############################################################################
|
|
19
|
+
|
|
20
|
+
module MobyBehaviour
|
|
21
|
+
|
|
22
|
+
module QT
|
|
23
|
+
|
|
24
|
+
# == description
|
|
25
|
+
# This module contains demonstration implementation containing tags for documentation generation using gesture as an example
|
|
26
|
+
#
|
|
27
|
+
# == behaviour
|
|
28
|
+
# QtExampleGestureBehaviour
|
|
29
|
+
#
|
|
30
|
+
# == requires
|
|
31
|
+
# testability-driver-sut-qt-plugin
|
|
32
|
+
#
|
|
33
|
+
# == input_type
|
|
34
|
+
# touch
|
|
35
|
+
#
|
|
36
|
+
# == sut_type
|
|
37
|
+
# qt
|
|
38
|
+
#
|
|
39
|
+
# == sut_version
|
|
40
|
+
# *
|
|
41
|
+
#
|
|
42
|
+
# == objects
|
|
43
|
+
# *;sut
|
|
44
|
+
#
|
|
45
|
+
module Gesture
|
|
46
|
+
|
|
47
|
+
#include MobyBehaviour::QT::Behaviour
|
|
48
|
+
|
|
49
|
+
attr_accessor :x
|
|
50
|
+
attr_reader :y
|
|
51
|
+
attr_writer :z
|
|
52
|
+
|
|
53
|
+
def y
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def x=(value)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# == description
|
|
61
|
+
# Cause a flick operation on the screen.
|
|
62
|
+
#
|
|
63
|
+
# == arguments
|
|
64
|
+
# argument1
|
|
65
|
+
# Integer
|
|
66
|
+
# description: Example argument1
|
|
67
|
+
# example: 10
|
|
68
|
+
# default:
|
|
69
|
+
# Hash
|
|
70
|
+
# description: Example argument 1 type 2
|
|
71
|
+
# example: { :optional_1 => "value_1", :optional_2 => "value_2" }
|
|
72
|
+
# default:
|
|
73
|
+
#
|
|
74
|
+
# argument2
|
|
75
|
+
# String
|
|
76
|
+
# description: Example argument2
|
|
77
|
+
# example: "Hello"
|
|
78
|
+
# default:
|
|
79
|
+
#
|
|
80
|
+
# == returns
|
|
81
|
+
# String
|
|
82
|
+
# description: Return value type
|
|
83
|
+
# example: "World"
|
|
84
|
+
#
|
|
85
|
+
# == exceptions
|
|
86
|
+
# RuntimeError
|
|
87
|
+
# description: example exception
|
|
88
|
+
#
|
|
89
|
+
# ArgumentError
|
|
90
|
+
# description: example exception
|
|
91
|
+
#
|
|
92
|
+
# == example
|
|
93
|
+
# flick( :Down, :Left, { :optional_1 => "value_1", :optional_2 => "value_2" } )
|
|
94
|
+
#
|
|
95
|
+
# == info
|
|
96
|
+
# See method X, table at Y
|
|
97
|
+
#
|
|
98
|
+
# == howto
|
|
99
|
+
# Example1
|
|
100
|
+
# description: Basic use
|
|
101
|
+
# code: @sut = TDriver.sut( :Id => "sut_qt" )
|
|
102
|
+
# app = @sut.application
|
|
103
|
+
# app.QPushButton( :text => "Close" ).flick :Left
|
|
104
|
+
#
|
|
105
|
+
def flick( direction, button = :Left, z = ',', optional_params = {}, y = ',' )
|
|
106
|
+
begin
|
|
107
|
+
use_tap_screen = optional_params[:use_tap_screen].nil? ? MobyUtil::Parameter[ @sut.id][ :use_tap_screen, 'false'] :
|
|
108
|
+
optional_params[:use_tap_screen].to_s
|
|
109
|
+
optional_params[:useTapScreen] = use_tap_screen
|
|
110
|
+
|
|
111
|
+
speed = calculate_speed(@sut.parameter(:gesture_flick_distance), @sut.parameter(:gesture_flick_speed))
|
|
112
|
+
distance = @sut.parameter(:gesture_flick_distance).to_i
|
|
113
|
+
params = {:gesture_type => :MouseGesture, :direction => direction, :speed => speed, :distance => distance, :isDrag => false, :button => button, :useTapScreen => use_tap_screen}
|
|
114
|
+
params.merge!(optional_params)
|
|
115
|
+
|
|
116
|
+
do_gesture(params)
|
|
117
|
+
do_sleep(speed)
|
|
118
|
+
|
|
119
|
+
rescue Exception => e
|
|
120
|
+
|
|
121
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed flick with direction \"#{direction}\", button \"#{button.to_s}\".;#{identity};flick;"
|
|
122
|
+
Kernel::raise e
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Operation flick executed successfully with direction \"#{direction}\", button \"#{button.to_s}\".;#{identity};flick;"
|
|
126
|
+
|
|
127
|
+
nil
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
private
|
|
132
|
+
|
|
133
|
+
# Performs the actual gesture operation.
|
|
134
|
+
# Verifies that the parameters are correct and send the command
|
|
135
|
+
# to the sut.
|
|
136
|
+
# gesture_type: :MouseGesture, :MouseGestureTo, :MouseGestureToCoordinates
|
|
137
|
+
# params = {:direction => :Up, duration => 2, :distance =>100, :isDrag =>false, :isMove =>false }
|
|
138
|
+
def do_gesture(params)
|
|
139
|
+
validate_gesture_params!(params)
|
|
140
|
+
|
|
141
|
+
if attribute('objectType') == 'Embedded'
|
|
142
|
+
params['x'] = center_x
|
|
143
|
+
params['y'] = center_y
|
|
144
|
+
params['useCoordinates'] = 'true'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
command = command_params #in qt_behaviour
|
|
148
|
+
command.command_name(params[:gesture_type].to_s)
|
|
149
|
+
command.command_params( params )
|
|
150
|
+
@sut.execute_command( command )
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def validate_gesture_params!(params)
|
|
154
|
+
#direction
|
|
155
|
+
if params[:gesture_type] == :MouseGesture
|
|
156
|
+
if params[:direction].kind_of?(Integer)
|
|
157
|
+
raise ArgumentError.new( "Invalid direction." ) unless 0 <= params[:direction].to_i and params[:direction].to_i <= 360
|
|
158
|
+
else
|
|
159
|
+
raise ArgumentError.new( "Invalid direction." ) unless @@_valid_directions.include?(params[:direction])
|
|
160
|
+
params[:direction] = @@_direction_map[params[:direction]]
|
|
161
|
+
end
|
|
162
|
+
#distance
|
|
163
|
+
params[:distance] = params[:distance].to_i unless params[:distance].kind_of?(Integer)
|
|
164
|
+
raise ArgumentError.new( "Distance must be an integer and greater than zero." ) unless params[:distance] > 0
|
|
165
|
+
elsif params[:gesture_type] == :MouseGestureToCoordinates
|
|
166
|
+
raise ArgumentError.new("X and Y must be integers.") unless params[:x].kind_of?(Integer) and params[:y].kind_of?(Integer)
|
|
167
|
+
elsif params[:gesture_type] == :MouseGestureTo
|
|
168
|
+
raise ArgumentError.new("targetId and targetType must be defined.") unless params[:targetId] and params[:targetType]
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
#duration/speed
|
|
172
|
+
params[:speed] = params[:speed].to_f unless params[:speed].kind_of?(Numeric)
|
|
173
|
+
raise ArgumentError.new( "Duration must be a number and greated than zero, was:" + params[:speed].to_s) unless params[:speed] > 0
|
|
174
|
+
duration_secs = params[:speed].to_f
|
|
175
|
+
duration_secs = duration_secs*1000
|
|
176
|
+
params[:speed] = duration_secs.to_i
|
|
177
|
+
|
|
178
|
+
#mouseMove true always
|
|
179
|
+
params[:mouseMove] = true
|
|
180
|
+
|
|
181
|
+
params[:button] = :Left unless params[:button]
|
|
182
|
+
raise ArgumentError.new( "Invalid button." ) unless @@_valid_buttons.include?(params[:button])
|
|
183
|
+
params[:button] = @@_buttons_map[params[:button]]
|
|
184
|
+
|
|
185
|
+
if params[:isMove] == true
|
|
186
|
+
params[:press] = 'false'
|
|
187
|
+
params[:release] = 'false'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def do_sleep(time)
|
|
194
|
+
|
|
195
|
+
if MobyUtil::Parameter[ @sut.id ][ :sleep_disabled, nil ] != 'true'
|
|
196
|
+
time = time.to_f
|
|
197
|
+
time = time * 1.3
|
|
198
|
+
#for flicks the duration of the gesture is short but animation (scroll etc..) may not
|
|
199
|
+
#so wait at least one second
|
|
200
|
+
time = 1 if time < 1
|
|
201
|
+
sleep time
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def calculate_speed(distance, speed)
|
|
207
|
+
|
|
208
|
+
distance = distance.to_f
|
|
209
|
+
speed = speed.to_f
|
|
210
|
+
duration = distance/speed
|
|
211
|
+
duration
|
|
212
|
+
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def distance_to_point(x, y)
|
|
216
|
+
|
|
217
|
+
x = x.to_i
|
|
218
|
+
y = y.to_i
|
|
219
|
+
dist_x = x - center_x.to_i
|
|
220
|
+
dist_y = y - center_y.to_i
|
|
221
|
+
|
|
222
|
+
return 0 if dist_y == 0 and dist_x == 0
|
|
223
|
+
distance = Math.hypot( dist_x, dist_y )
|
|
224
|
+
distance
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
#MobyUtil::Logger.instance.hook_methods( MobyBehaviour::QT::Gesture )
|