cutedriver-driver 2.0.0.20210120164037
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.
- checksums.yaml +7 -0
- data/README.md +16 -0
- data/bin/start_app_perf +200 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +52 -0
- data/config/sut_setup.rb +32 -0
- data/config/sut_teardown.rb +32 -0
- data/config/tdriver_custom_error_recovery.rb +83 -0
- data/ext/extconf.rb +70 -0
- data/ext/native_extensions.c +315 -0
- data/lib/matti.rb +25 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -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 +1945 -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/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 +917 -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 +2170 -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/behaviour_example.rb +100 -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 +23 -0
- data/lib/tdriver/base/behaviour/abstract.rb +29 -0
- data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
- data/lib/tdriver/base/behaviour/factory.rb +495 -0
- data/lib/tdriver/base/behaviour/loader.rb +46 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +29 -0
- data/lib/tdriver/base/controller/abstraction.rb +56 -0
- data/lib/tdriver/base/controller/loader.rb +21 -0
- data/lib/tdriver/base/errors.rb +134 -0
- data/lib/tdriver/base/loader.rb +47 -0
- data/lib/tdriver/base/state_object.rb +373 -0
- data/lib/tdriver/base/sut/adapter.rb +54 -0
- data/lib/tdriver/base/sut/controller.rb +151 -0
- data/lib/tdriver/base/sut/factory.rb +339 -0
- data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
- data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
- data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +98 -0
- data/lib/tdriver/base/test_object/abstract.rb +208 -0
- data/lib/tdriver/base/test_object/adapter.rb +740 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
- data/lib/tdriver/base/test_object/cache.rb +134 -0
- data/lib/tdriver/base/test_object/factory.rb +684 -0
- data/lib/tdriver/base/test_object/loader.rb +51 -0
- data/lib/tdriver/base/test_object/verification.rb +178 -0
- data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
- data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +57 -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 +168 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
- data/lib/tdriver/report/report.rb +61 -0
- data/lib/tdriver/report/report_api.rb +348 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
- data/lib/tdriver/report/report_creator.rb +665 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
- data/lib/tdriver/report/report_data_presentation.rb +156 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +400 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_graph_generator.rb +59 -0
- data/lib/tdriver/report/report_grouping.rb +541 -0
- data/lib/tdriver/report/report_javascript.rb +199 -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 +725 -0
- data/lib/tdriver/report/report_test_run.rb +1476 -0
- data/lib/tdriver/report/report_test_unit.rb +223 -0
- data/lib/tdriver/report/report_writer.rb +1621 -0
- data/lib/tdriver/tdriver.rb +209 -0
- data/lib/tdriver/util/agent/loader.rb +22 -0
- data/lib/tdriver/util/agent/service.rb +107 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/boolean.rb +48 -0
- data/lib/tdriver/util/common/crc16.rb +149 -0
- data/lib/tdriver/util/common/environment.rb +154 -0
- data/lib/tdriver/util/common/error.rb +40 -0
- data/lib/tdriver/util/common/exception.rb +53 -0
- data/lib/tdriver/util/common/exceptions.rb +12 -0
- data/lib/tdriver/util/common/file.rb +328 -0
- data/lib/tdriver/util/common/gem.rb +109 -0
- data/lib/tdriver/util/common/hash.rb +288 -0
- data/lib/tdriver/util/common/kernel.rb +253 -0
- data/lib/tdriver/util/common/loader.rb +47 -0
- data/lib/tdriver/util/common/numeric.rb +159 -0
- data/lib/tdriver/util/common/object.rb +159 -0
- data/lib/tdriver/util/common/retryable.rb +179 -0
- data/lib/tdriver/util/common/stackable.rb +185 -0
- data/lib/tdriver/util/common/string.rb +174 -0
- data/lib/tdriver/util/database/access.rb +240 -0
- data/lib/tdriver/util/database/connection.rb +44 -0
- data/lib/tdriver/util/database/error.rb +34 -0
- data/lib/tdriver/util/database/loader.rb +28 -0
- data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
- data/lib/tdriver/util/filters/loader.rb +29 -0
- data/lib/tdriver/util/fixture/loader.rb +22 -0
- data/lib/tdriver/util/fixture/service.rb +211 -0
- data/lib/tdriver/util/hooking/hooking.rb +477 -0
- data/lib/tdriver/util/keymap/keymap.rb +81 -0
- data/lib/tdriver/util/loader.rb +80 -0
- data/lib/tdriver/util/localisation/error.rb +31 -0
- data/lib/tdriver/util/localisation/loader.rb +25 -0
- data/lib/tdriver/util/localisation/localisation.rb +762 -0
- data/lib/tdriver/util/logger/loader.rb +22 -0
- data/lib/tdriver/util/logger/logger.rb +591 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +27 -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/error.rb +48 -0
- data/lib/tdriver/util/parameter/loader.rb +25 -0
- data/lib/tdriver/util/parameter/parameter.rb +1161 -0
- data/lib/tdriver/util/plugin/abstract.rb +61 -0
- data/lib/tdriver/util/plugin/error.rb +0 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +319 -0
- data/lib/tdriver/util/recorder/loader.rb +25 -0
- data/lib/tdriver/util/recorder/recorder.rb +72 -0
- data/lib/tdriver/util/recorder/scripter.rb +294 -0
- data/lib/tdriver/util/statistics/statistics.rb +89 -0
- data/lib/tdriver/util/user_data/error.rb +28 -0
- data/lib/tdriver/util/user_data/loader.rb +25 -0
- data/lib/tdriver/util/user_data/user_data.rb +104 -0
- data/lib/tdriver/util/video/camera.rb +67 -0
- data/lib/tdriver/util/video/camera_linux.rb +153 -0
- data/lib/tdriver/util/video/camera_windows.rb +174 -0
- data/lib/tdriver/util/video/loader.rb +31 -0
- data/lib/tdriver/util/video/video_utils.rb +139 -0
- data/lib/tdriver/util/xml/abstraction.rb +117 -0
- data/lib/tdriver/util/xml/attribute.rb +32 -0
- data/lib/tdriver/util/xml/builder.rb +53 -0
- data/lib/tdriver/util/xml/comment.rb +32 -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 +62 -0
- data/lib/tdriver/util/xml/nil_node.rb +95 -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 +21 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
- data/lib/tdriver/util/xml/text.rb +32 -0
- data/lib/tdriver/util/xml/xml.rb +332 -0
- data/lib/tdriver/verify/verify.rb +2398 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +530 -0
- data/xml/defaults/generic.xml +11 -0
- data/xml/defaults/sut_generic.xml +8 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +292 -0
- metadata +324 -0
@@ -0,0 +1,158 @@
|
|
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 Testability Driver.
|
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
|
+
|
21
|
+
|
22
|
+
|
23
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'report' ) )
|
24
|
+
#Report module which contains the Cucumber, Test::Unit and RSpec report formatters
|
25
|
+
begin
|
26
|
+
require 'cucumber/ast/visitor'
|
27
|
+
module TDriverReport
|
28
|
+
#Class for formatting cucumber report
|
29
|
+
class CucumberFormatter < Cucumber::Ast::Visitor
|
30
|
+
include TDriverReportCreator
|
31
|
+
#This method initializes new test run
|
32
|
+
#
|
33
|
+
# === params
|
34
|
+
# === returns
|
35
|
+
# === raises
|
36
|
+
def initialize(step_mother, io, options)
|
37
|
+
file, line = caller.first.split(":")
|
38
|
+
$stderr.puts "Please note that CucumberListener may soon be deprecated. Use TDriverReport::CucumberReporter instead." % [ file, line]
|
39
|
+
super(step_mother)
|
40
|
+
start_run()
|
41
|
+
@options = options
|
42
|
+
@current_feature_element = nil
|
43
|
+
@current_feature = nil
|
44
|
+
@tc_status=nil
|
45
|
+
@current_feature_group=nil
|
46
|
+
at_exit do
|
47
|
+
end_test_case(@current_feature_element,@tc_status)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
#This method visits the executed cucumber step and updates the results in to TDriver report
|
51
|
+
#
|
52
|
+
# === params
|
53
|
+
# === returns
|
54
|
+
# === raises
|
55
|
+
def visit_step_name(keyword, step_match, status, source_indent, background)
|
56
|
+
if status == :passed
|
57
|
+
step_name = step_match.format_args(lambda{|param| "*#{param}*"})
|
58
|
+
update_test_case("#{step_name} PASSED")
|
59
|
+
@tc_status='passed'
|
60
|
+
end
|
61
|
+
if status == :failed
|
62
|
+
step_name = step_match.format_args(lambda{|param| "*#{param}*"})
|
63
|
+
update_test_case("#{step_name} FAILED")
|
64
|
+
@tc_status='failed'
|
65
|
+
end
|
66
|
+
if status == :skipped
|
67
|
+
step_name = step_match.format_args(lambda{|param| "*#{param}*"})
|
68
|
+
update_test_case("#{step_name} SKIPPED")
|
69
|
+
end
|
70
|
+
if status == :undefined
|
71
|
+
step_name = step_match.format_args(lambda{|param| "*#{param}*"})
|
72
|
+
update_test_case("#{step_name} NOT RUN")
|
73
|
+
@tc_status='not run'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
#This method visits the exception caused by a failed step
|
77
|
+
#and updates the result in to TDriver report
|
78
|
+
#
|
79
|
+
# === params
|
80
|
+
# === returns
|
81
|
+
# === raises
|
82
|
+
def visit_exception(exception, status)
|
83
|
+
if status == :failed
|
84
|
+
capture_screen_test_case()
|
85
|
+
update_test_case(exception.message)
|
86
|
+
end
|
87
|
+
update_test_case('-') if status == :passed
|
88
|
+
end
|
89
|
+
#This method visits cucumber scenario name and starts a new test case when
|
90
|
+
#new scenario is executed
|
91
|
+
#and updates the result in to TDriver report
|
92
|
+
#
|
93
|
+
# === params
|
94
|
+
# === returns
|
95
|
+
# === raises
|
96
|
+
def visit_scenario_name(keyword, name, file_colon_line, source_indent)
|
97
|
+
visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
98
|
+
end
|
99
|
+
def visit_feature_name(name)
|
100
|
+
@current_feature_group=name.gsub(/[:]/,'')
|
101
|
+
add_report_group('Features:'+@current_feature_group+'|')
|
102
|
+
end
|
103
|
+
#This method determines when new test case needs to be started
|
104
|
+
#based on the scenario name info if scenario name is different then a new test case
|
105
|
+
#is started
|
106
|
+
#
|
107
|
+
# === params
|
108
|
+
# === returns
|
109
|
+
# === raises
|
110
|
+
def visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
111
|
+
line = %Q("#{name}")
|
112
|
+
@current_feature_element=line if @current_feature_element.nil?
|
113
|
+
unless line == @current_feature_element
|
114
|
+
end_test_case(@current_feature_element,@tc_status)
|
115
|
+
@current_feature_element=line
|
116
|
+
end
|
117
|
+
start_test_case(@current_feature_element)
|
118
|
+
add_test_case_group(@current_feature_group)
|
119
|
+
@tc_status=nil
|
120
|
+
end
|
121
|
+
#This method records the cucumber outline table results in to one test case
|
122
|
+
#
|
123
|
+
# === params
|
124
|
+
# === returns
|
125
|
+
# === raises
|
126
|
+
def visit_outline_table(outline_table)
|
127
|
+
update_test_case("running outline: ")
|
128
|
+
super
|
129
|
+
end
|
130
|
+
#This method records the cucumber outline table results in to one test case
|
131
|
+
#
|
132
|
+
# === params
|
133
|
+
# === returns
|
134
|
+
# === raises
|
135
|
+
def visit_table_row(table_row)
|
136
|
+
super
|
137
|
+
if table_row.exception
|
138
|
+
@tc_status='failed'
|
139
|
+
capture_screen_test_case()
|
140
|
+
update_test_case("#{format_table_row(table_row)} FAILED")
|
141
|
+
update_test_case(table_row.exception)
|
142
|
+
else
|
143
|
+
@tc_status='passed' if @tc_status==nil
|
144
|
+
update_test_case("#{format_table_row(table_row)} PASSED")
|
145
|
+
end
|
146
|
+
end
|
147
|
+
def format_table_row(row)
|
148
|
+
begin
|
149
|
+
[row.name, row.line]
|
150
|
+
rescue Exception => e
|
151
|
+
row
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
rescue LoadError
|
157
|
+
|
158
|
+
end
|
@@ -0,0 +1,184 @@
|
|
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 Testability Driver.
|
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
|
+
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'report' ) )
|
22
|
+
#Report module which contains the Cucumber, Test::Unit and RSpec report formatters
|
23
|
+
begin
|
24
|
+
module TDriverReport
|
25
|
+
#Class for formatting cucumber report
|
26
|
+
class CucumberListener
|
27
|
+
include TDriverReportCreator
|
28
|
+
#This method initializes new test run
|
29
|
+
#
|
30
|
+
# === params
|
31
|
+
# === returns
|
32
|
+
# === raises
|
33
|
+
def initialize(step_mother, io, options)
|
34
|
+
file, line = caller.first.split(":")
|
35
|
+
$stderr.puts "Please note that CucumberListener may soon be deprecated. Use TDriverReport::CucumberReporter instead." % [ file, line]
|
36
|
+
#super(step_mother, io, options)
|
37
|
+
start_run()
|
38
|
+
@options = options
|
39
|
+
@current_feature_element = nil
|
40
|
+
@current_feature = nil
|
41
|
+
@tc_status=nil
|
42
|
+
@current_feature_group=nil
|
43
|
+
@current_feature_element_file=''
|
44
|
+
end
|
45
|
+
def after_features(features)
|
46
|
+
end_test_case(@current_feature_element,@tc_status)
|
47
|
+
end
|
48
|
+
#This method visits the executed cucumber step and updates the results in to TDriver report
|
49
|
+
#
|
50
|
+
# === params
|
51
|
+
# === returns
|
52
|
+
# === raises
|
53
|
+
def step_name(keyword, step_match, status, source_indent, background)
|
54
|
+
if status == :passed
|
55
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
56
|
+
update_test_case("#{step_name} PASSED")
|
57
|
+
@tc_status='passed'
|
58
|
+
end
|
59
|
+
if status == :failed
|
60
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
61
|
+
update_test_case("#{step_name} FAILED")
|
62
|
+
@tc_status='failed'
|
63
|
+
end
|
64
|
+
if status == :skipped
|
65
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
66
|
+
update_test_case("#{step_name} SKIPPED")
|
67
|
+
end
|
68
|
+
if status == :undefined
|
69
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
70
|
+
update_test_case("#{step_name} NOT RUN")
|
71
|
+
@tc_status='not run'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
#This method visits the exception caused by a failed step
|
75
|
+
#and updates the result in to TDriver report
|
76
|
+
#
|
77
|
+
# === params
|
78
|
+
# === returns
|
79
|
+
# === raises
|
80
|
+
def exception(exception, status)
|
81
|
+
if status == :failed
|
82
|
+
capture_screen_test_case()
|
83
|
+
update_test_case(exception.message)
|
84
|
+
update_test_case(exception.backtrace)
|
85
|
+
end
|
86
|
+
update_test_case('-') if status == :passed
|
87
|
+
end
|
88
|
+
#This method visits cucumber scenario name and starts a new test case when
|
89
|
+
#new scenario is executed
|
90
|
+
#and updates the result in to TDriver report
|
91
|
+
#
|
92
|
+
# === params
|
93
|
+
# === returns
|
94
|
+
# === raises
|
95
|
+
def scenario_name(keyword, name, file_colon_line, source_indent)
|
96
|
+
visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
97
|
+
end
|
98
|
+
def feature_name(name)
|
99
|
+
@current_feature_group=name.gsub(/[:]/,'')
|
100
|
+
end
|
101
|
+
#This method determines when new test case needs to be started
|
102
|
+
#based on the scenario name info if scenario name is different then a new test case
|
103
|
+
#is started
|
104
|
+
#
|
105
|
+
# === params
|
106
|
+
# === returns
|
107
|
+
# === raises
|
108
|
+
def visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
109
|
+
add_report_group(File.basename(file_colon_line)+':'+@current_feature_group+'|')
|
110
|
+
@current_feature_element_file=file_colon_line
|
111
|
+
line = %Q("#{name}")
|
112
|
+
@current_feature_element=line if @current_feature_element.nil?
|
113
|
+
unless line == @current_feature_element
|
114
|
+
end_test_case(@current_feature_element,@tc_status)
|
115
|
+
@current_feature_element=line
|
116
|
+
end
|
117
|
+
start_test_case(@current_feature_element)
|
118
|
+
add_test_case_group(@current_feature_group)
|
119
|
+
update_test_case(file_colon_line)
|
120
|
+
@tc_status=nil
|
121
|
+
end
|
122
|
+
#This method records the cucumber outline table results in to one test case
|
123
|
+
#
|
124
|
+
# === params
|
125
|
+
# === returns
|
126
|
+
# === raises
|
127
|
+
def before_outline_table(outline_table)
|
128
|
+
update_test_case("running outline: ")
|
129
|
+
end
|
130
|
+
#This method records the cucumber outline table results in to one test case
|
131
|
+
#
|
132
|
+
# === params
|
133
|
+
# === returns
|
134
|
+
# === raises
|
135
|
+
def after_table_row(table_row)
|
136
|
+
if table_row.exception
|
137
|
+
@tc_status='failed'
|
138
|
+
capture_screen_test_case()
|
139
|
+
update_test_case("#{format_table_row(table_row)} FAILED")
|
140
|
+
update_test_case(table_row.exception)
|
141
|
+
else
|
142
|
+
@tc_status='passed' if @tc_status==nil
|
143
|
+
update_test_case("#{format_table_row(table_row)} PASSED")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
def format_table_row(row)
|
147
|
+
begin
|
148
|
+
[row.name, row.line]
|
149
|
+
rescue Exception => e
|
150
|
+
row
|
151
|
+
end
|
152
|
+
end
|
153
|
+
def tag_name(tag_name)
|
154
|
+
end
|
155
|
+
def comment_line(comment_line)
|
156
|
+
end
|
157
|
+
def after_tags(tags)
|
158
|
+
end
|
159
|
+
def after_feature_element(feature_element)
|
160
|
+
end
|
161
|
+
def after_background(background)
|
162
|
+
end
|
163
|
+
def before_examples_array(examples_array)
|
164
|
+
end
|
165
|
+
def examples_name(keyword, name)
|
166
|
+
end
|
167
|
+
def py_string(string)
|
168
|
+
end
|
169
|
+
def print_feature_element_name(keyword, name, file_colon_line, source_indent)
|
170
|
+
end
|
171
|
+
def before_table_row(table_row)
|
172
|
+
return unless @table
|
173
|
+
@col_index = 0
|
174
|
+
end
|
175
|
+
def table_cell_value(value, status)
|
176
|
+
return unless @table
|
177
|
+
status ||= @status || :passed
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
rescue LoadError
|
183
|
+
|
184
|
+
end
|
@@ -0,0 +1,181 @@
|
|
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 Testability Driver.
|
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
|
+
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'report' ) )
|
22
|
+
#Report module which contains the Cucumber, Test::Unit and RSpec report formatters
|
23
|
+
begin
|
24
|
+
module TDriverReport
|
25
|
+
#Class for formatting cucumber report
|
26
|
+
class CucumberReporter
|
27
|
+
include TDriverReportCreator
|
28
|
+
#This method initializes new test run
|
29
|
+
#
|
30
|
+
# === params
|
31
|
+
# === returns
|
32
|
+
# === raises
|
33
|
+
def initialize(step_mother, io, options)
|
34
|
+
#super(step_mother, io, options)
|
35
|
+
start_run()
|
36
|
+
@options = options
|
37
|
+
@current_feature_element = nil
|
38
|
+
@current_feature = nil
|
39
|
+
@tc_status=nil
|
40
|
+
@current_feature_group=nil
|
41
|
+
@current_feature_element_file=''
|
42
|
+
end
|
43
|
+
def after_features(features)
|
44
|
+
end_test_case(@current_feature_element,@tc_status)
|
45
|
+
end
|
46
|
+
#This method visits the executed cucumber step and updates the results in to TDriver report
|
47
|
+
#
|
48
|
+
# === params
|
49
|
+
# === returns
|
50
|
+
# === raises
|
51
|
+
def step_name(keyword, step_match, status, source_indent, background)
|
52
|
+
if status == :passed
|
53
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
54
|
+
update_test_case("#{step_name} PASSED")
|
55
|
+
@tc_status='passed'
|
56
|
+
end
|
57
|
+
if status == :failed
|
58
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
59
|
+
update_test_case("#{step_name} FAILED")
|
60
|
+
@tc_status='failed'
|
61
|
+
end
|
62
|
+
if status == :skipped
|
63
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
64
|
+
update_test_case("#{step_name} SKIPPED")
|
65
|
+
end
|
66
|
+
if status == :undefined
|
67
|
+
step_name = step_match.format_args(lambda{|param| "#{param}"})
|
68
|
+
update_test_case("#{step_name} NOT RUN")
|
69
|
+
@tc_status='not run'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
#This method visits the exception caused by a failed step
|
73
|
+
#and updates the result in to TDriver report
|
74
|
+
#
|
75
|
+
# === params
|
76
|
+
# === returns
|
77
|
+
# === raises
|
78
|
+
def exception(exception, status)
|
79
|
+
if status == :failed
|
80
|
+
capture_screen_test_case()
|
81
|
+
update_test_case(exception.message)
|
82
|
+
update_test_case(exception.backtrace)
|
83
|
+
end
|
84
|
+
update_test_case('-') if status == :passed
|
85
|
+
end
|
86
|
+
#This method visits cucumber scenario name and starts a new test case when
|
87
|
+
#new scenario is executed
|
88
|
+
#and updates the result in to TDriver report
|
89
|
+
#
|
90
|
+
# === params
|
91
|
+
# === returns
|
92
|
+
# === raises
|
93
|
+
def scenario_name(keyword, name, file_colon_line, source_indent)
|
94
|
+
visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
95
|
+
end
|
96
|
+
def feature_name(keyword,name)
|
97
|
+
@current_feature_group=keyword + " " + name.gsub(/[:]/,' ')
|
98
|
+
end
|
99
|
+
#This method determines when new test case needs to be started
|
100
|
+
#based on the scenario name info if scenario name is different then a new test case
|
101
|
+
#is started
|
102
|
+
#
|
103
|
+
# === params
|
104
|
+
# === returns
|
105
|
+
# === raises
|
106
|
+
def visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
107
|
+
add_report_group(File.basename(file_colon_line)+':'+@current_feature_group+'|')
|
108
|
+
@current_feature_element_file=file_colon_line
|
109
|
+
line = %Q("#{name}")
|
110
|
+
@current_feature_element=line if @current_feature_element.nil?
|
111
|
+
unless line == @current_feature_element
|
112
|
+
end_test_case(@current_feature_element,@tc_status)
|
113
|
+
@current_feature_element=line
|
114
|
+
end
|
115
|
+
start_test_case(@current_feature_element)
|
116
|
+
add_test_case_group(@current_feature_group)
|
117
|
+
update_test_case(file_colon_line)
|
118
|
+
@tc_status=nil
|
119
|
+
end
|
120
|
+
#This method records the cucumber outline table results in to one test case
|
121
|
+
#
|
122
|
+
# === params
|
123
|
+
# === returns
|
124
|
+
# === raises
|
125
|
+
def before_outline_table(outline_table)
|
126
|
+
update_test_case("running outline: ")
|
127
|
+
end
|
128
|
+
#This method records the cucumber outline table results in to one test case
|
129
|
+
#
|
130
|
+
# === params
|
131
|
+
# === returns
|
132
|
+
# === raises
|
133
|
+
def after_table_row(table_row)
|
134
|
+
if table_row.exception
|
135
|
+
@tc_status='failed'
|
136
|
+
capture_screen_test_case()
|
137
|
+
update_test_case("#{format_table_row(table_row)} FAILED")
|
138
|
+
update_test_case(table_row.exception)
|
139
|
+
else
|
140
|
+
@tc_status='passed' if @tc_status==nil
|
141
|
+
update_test_case("#{format_table_row(table_row)} PASSED")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
def format_table_row(row)
|
145
|
+
begin
|
146
|
+
[row.name, row.line]
|
147
|
+
rescue Exception => e
|
148
|
+
row
|
149
|
+
end
|
150
|
+
end
|
151
|
+
def tag_name(tag_name)
|
152
|
+
end
|
153
|
+
def comment_line(comment_line)
|
154
|
+
end
|
155
|
+
def after_tags(tags)
|
156
|
+
end
|
157
|
+
def after_feature_element(feature_element)
|
158
|
+
end
|
159
|
+
def after_background(background)
|
160
|
+
end
|
161
|
+
def before_examples_array(examples_array)
|
162
|
+
end
|
163
|
+
def examples_name(keyword, name)
|
164
|
+
end
|
165
|
+
def py_string(string)
|
166
|
+
end
|
167
|
+
def print_feature_element_name(keyword, name, file_colon_line, source_indent)
|
168
|
+
end
|
169
|
+
def before_table_row(table_row)
|
170
|
+
return unless @table
|
171
|
+
@col_index = 0
|
172
|
+
end
|
173
|
+
def table_cell_value(value, status)
|
174
|
+
return unless @table
|
175
|
+
status ||= @status || :passed
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
rescue LoadError
|
180
|
+
|
181
|
+
end
|