gridinit-jmeter 0.3.2 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -1
- data/README.md +51 -72
- data/examples/basic_assertion.rb +6 -6
- data/examples/basic_auth.rb +5 -5
- data/examples/basic_cache.rb +5 -5
- data/examples/basic_cookies.rb +5 -5
- data/examples/basic_extract.rb +4 -10
- data/examples/basic_gc_results.rb +12 -9
- data/examples/basic_google.rb +3 -3
- data/examples/basic_grid.rb +3 -6
- data/examples/basic_header.rb +12 -10
- data/examples/basic_ldap_ext.rb +11 -12
- data/examples/basic_post.rb +5 -6
- data/examples/basic_query_params.rb +3 -3
- data/examples/basic_think_time.rb +7 -4
- data/examples/basic_throughput_shaping_timer.rb +4 -4
- data/examples/etsy_login_browse.rb +21 -21
- data/lib/gridinit-jmeter/DSL.md +237 -0
- data/lib/gridinit-jmeter/{idl → dsl}/access_log_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/aggregate_graph.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/aggregate_report.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ajp13_sampler.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/assertion_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/compare_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/comparison_assertion_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/constant_throughput_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/constant_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/counter.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/cssjquery_extractor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/csv_data_set_config.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/debug_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/debug_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/distribution_graphalpha.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/duration_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/foreach_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ftp_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ftp_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/gaussian_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/generate_summary_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/graph_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_link_parser.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_parameter_mask.rb +4 -2
- data/lib/gridinit-jmeter/dsl/http_authorization_manager.rb +36 -0
- data/lib/gridinit-jmeter/{idl → dsl}/http_cache_manager.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/http_cookie_manager.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/http_header_manager.rb +10 -3
- data/lib/gridinit-jmeter/{idl → dsl}/http_request.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/http_request_defaults.rb +15 -4
- data/lib/gridinit-jmeter/{idl → dsl}/http_url_rewriting_modifier.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/if_controller.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/include_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/java_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/java_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_connection_configuration.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jms_pointtopoint.rb +6 -4
- data/lib/gridinit-jmeter/{idl → dsl}/jms_publisher.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/jms_subscriber.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/junit_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/keystore_configuration.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_request.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_request_defaults.rb +13 -4
- data/lib/gridinit-jmeter/{idl → dsl}/login_config_element.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/loop_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/mail_reader_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/mailer_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/md5hex_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/module_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/monitor_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/once_only_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/os_process_sampler.rb +6 -4
- data/lib/gridinit-jmeter/{idl → dsl}/poisson_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_order_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_variable.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/recording_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/regex_user_parameters.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/regular_expression_extractor.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/response_assertion.rb +8 -3
- data/lib/gridinit-jmeter/{idl → dsl}/response_time_graph.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/result_status_action_handler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/runtime_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/save_responses_to_a_file.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_config_element.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_data_writer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/smime_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/smtp_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/soapxmlrpc_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/spline_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/summary_report.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/switch_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/synchronizing_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler_config.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/test_action.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/test_plan.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/thread_group.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/throughput_controller.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/transaction_controller.rb +6 -3
- data/lib/gridinit-jmeter/{idl → dsl}/uniform_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/dsl/user_defined_variables.rb +35 -0
- data/lib/gridinit-jmeter/{idl → dsl}/user_parameters.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/view_results_in_table.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/view_results_tree.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/while_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xml_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xml_schema_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xpath_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xpath_extractor.rb +4 -2
- data/lib/gridinit-jmeter/dsl.rb +170 -187
- data/lib/gridinit-jmeter/helpers/helper.rb +43 -0
- data/lib/gridinit-jmeter/helpers/parser.rb +109 -0
- data/lib/gridinit-jmeter/idl.rb +16 -6
- data/lib/gridinit-jmeter/idl.xml +54 -11
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_console_status_logger.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_latencies_over_time.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_codes_per_second.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_distribution.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_over_time.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_percentiles.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_transactions_per_second.rb +0 -0
- data/lib/gridinit-jmeter/{timers/gc_throughput_shaping_timer.rb → plugins/gc_variable_throughput_timer.rb} +1 -1
- data/lib/gridinit-jmeter/version.rb +1 -1
- data/lib/gridinit-jmeter.rb +6 -105
- data/spec/dsl_spec.rb +377 -82
- metadata +131 -174
- data/examples/basic_proxy.rb +0 -8
- data/examples/basic_results.rb +0 -22
- data/examples/basic_run.rb +0 -12
- data/examples/basic_simple_data_writer.rb +0 -14
- data/examples/basic_stdout.rb +0 -8
- data/examples/basic_test_data.rb +0 -15
- data/examples/basic_testplan.jmx +0 -138
- data/examples/basic_testplan.rb +0 -44
- data/examples/jbhifi_now_search.rb +0 -94
- data/lib/gridinit-jmeter/assertions/response_assertion.rb +0 -55
- data/lib/gridinit-jmeter/config/auth_manager.rb +0 -26
- data/lib/gridinit-jmeter/config/cache_manager.rb +0 -20
- data/lib/gridinit-jmeter/config/cookie_manager.rb +0 -21
- data/lib/gridinit-jmeter/config/counter_config.rb +0 -24
- data/lib/gridinit-jmeter/config/header_manager.rb +0 -26
- data/lib/gridinit-jmeter/config/random_variable.rb +0 -24
- data/lib/gridinit-jmeter/config/request_defaults.rb +0 -31
- data/lib/gridinit-jmeter/config/user_defined_variable.rb +0 -25
- data/lib/gridinit-jmeter/controllers/if_controller.rb +0 -20
- data/lib/gridinit-jmeter/controllers/interleave.rb +0 -18
- data/lib/gridinit-jmeter/controllers/loop_controller.rb +0 -19
- data/lib/gridinit-jmeter/controllers/once_only.rb +0 -17
- data/lib/gridinit-jmeter/controllers/random_order.rb +0 -16
- data/lib/gridinit-jmeter/controllers/simple.rb +0 -17
- data/lib/gridinit-jmeter/controllers/switch.rb +0 -20
- data/lib/gridinit-jmeter/controllers/throughput.rb +0 -26
- data/lib/gridinit-jmeter/controllers/transaction.rb +0 -19
- data/lib/gridinit-jmeter/controllers/while_controller.rb +0 -18
- data/lib/gridinit-jmeter/helpers/dsl_helper.rb +0 -21
- data/lib/gridinit-jmeter/idl/http_authorization_manager.rb +0 -26
- data/lib/gridinit-jmeter/idl/user_defined_variables.rb +0 -26
- data/lib/gridinit-jmeter/listeners/aggregate_report.rb +0 -47
- data/lib/gridinit-jmeter/listeners/graph_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/response_time_graph_visualizer.rb +0 -47
- data/lib/gridinit-jmeter/listeners/simple_data_writer.rb +0 -51
- data/lib/gridinit-jmeter/listeners/stat_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/summary_report.rb +0 -46
- data/lib/gridinit-jmeter/listeners/table_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/view_results_full_visualizer.rb +0 -57
- data/lib/gridinit-jmeter/post_processors/regex_extractor.rb +0 -34
- data/lib/gridinit-jmeter/post_processors/xpath_extractor.rb +0 -23
- data/lib/gridinit-jmeter/pre_processors/bean_shell_pre_processor.rb +0 -23
- data/lib/gridinit-jmeter/samplers/http_sampler.rb +0 -99
- data/lib/gridinit-jmeter/samplers/ldap_ext_sampler.rb +0 -36
- data/lib/gridinit-jmeter/samplers/soap_sampler.rb +0 -26
- data/lib/gridinit-jmeter/test_plan/test_plan.rb +0 -23
- data/lib/gridinit-jmeter/threads/thread_group.rb +0 -30
- data/lib/gridinit-jmeter/timers/gaussian_random_timer.rb +0 -18
data/spec/dsl_spec.rb
CHANGED
@@ -1,162 +1,457 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "pry-debugger"
|
2
3
|
|
3
4
|
describe "DSL" do
|
4
5
|
|
5
|
-
|
6
|
-
test
|
6
|
+
describe 'aliased DSL methods' do
|
7
|
+
it "test plan should respond to aliased methods" do
|
8
|
+
test {}.should respond_to :variables
|
9
|
+
test {}.should respond_to :defaults
|
10
|
+
test {}.should respond_to :cookies
|
11
|
+
test {}.should respond_to :cache
|
12
|
+
test {}.should respond_to :header
|
13
|
+
test {}.should respond_to :auth
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
describe 'write to stdout and file' do
|
19
|
+
it "should output a test plan to stdout" do
|
20
|
+
$stdout.should_receive(:puts).with(/jmeterTestPlan/i)
|
21
|
+
test do
|
22
|
+
end.out
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should output a test plan to jmx file" do
|
26
|
+
file = mock('file')
|
27
|
+
File.should_receive(:open).with("jmeter.jmx", "w").and_yield(file)
|
28
|
+
file.should_receive(:write).with(/jmeterTestPlan/i)
|
29
|
+
test do
|
30
|
+
end.jmx
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
describe 'user agent' do
|
36
|
+
let(:doc) do
|
37
|
+
test do
|
38
|
+
with_user_agent :chrome
|
39
|
+
threads
|
40
|
+
end.to_doc
|
41
|
+
end
|
42
|
+
|
43
|
+
let(:fragment) { doc.search("//HeaderManager").first }
|
44
|
+
|
45
|
+
it 'should match on user_agent' do
|
46
|
+
fragment.search(".//stringProp[@name='Header.name']").text.should == 'User-Agent'
|
47
|
+
fragment.search(".//stringProp[@name='Header.value']").text.should ==
|
48
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
describe 'thread groups' do
|
54
|
+
let(:doc) do
|
55
|
+
test do
|
56
|
+
threads count: 101, continue_forever: true, duration: 69
|
57
|
+
end.to_doc
|
58
|
+
end
|
59
|
+
|
60
|
+
let(:fragment) { doc.search("//ThreadGroup").first }
|
61
|
+
|
62
|
+
it 'should match on num_threads' do
|
63
|
+
fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text.should == '101'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should match on continue_forever' do
|
67
|
+
fragment.search(".//boolProp[@name='LoopController.continue_forever']").text.should == 'true'
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should match on loops' do
|
71
|
+
fragment.search(".//stringProp[@name='LoopController.loops']").text.should == '-1'
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should match on duration' do
|
75
|
+
fragment.search(".//stringProp[@name='ThreadGroup.duration']").text.should == '69'
|
76
|
+
end
|
7
77
|
end
|
8
78
|
|
9
|
-
|
10
|
-
|
79
|
+
|
80
|
+
describe 'thread groups old syntax' do
|
81
|
+
let(:doc) do
|
82
|
+
test do
|
83
|
+
threads 101, continue_forever: true, duration: 69
|
84
|
+
end.to_doc
|
85
|
+
end
|
86
|
+
|
87
|
+
let(:fragment) { doc.search("//ThreadGroup").first }
|
88
|
+
|
89
|
+
it 'should match on num_threads' do
|
90
|
+
fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text.should == '101'
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should match on continue_forever' do
|
94
|
+
fragment.search(".//boolProp[@name='LoopController.continue_forever']").text.should == 'true'
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should match on loops' do
|
98
|
+
fragment.search(".//stringProp[@name='LoopController.loops']").text.should == '-1'
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should match on duration' do
|
102
|
+
fragment.search(".//stringProp[@name='ThreadGroup.duration']").text.should == '69'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
describe 'transaction controller' do
|
108
|
+
let(:doc) do
|
109
|
+
test do
|
110
|
+
threads do
|
111
|
+
transaction name: "TC_01", parent: true, include_timers: true
|
112
|
+
end
|
113
|
+
end.to_doc
|
114
|
+
end
|
115
|
+
|
116
|
+
let(:fragment) { doc.search("//TransactionController").first }
|
117
|
+
|
118
|
+
it 'should match on parent' do
|
119
|
+
fragment.search(".//boolProp[@name='TransactionController.parent']").text.should == 'true'
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should match on includeTimers' do
|
123
|
+
fragment.search(".//boolProp[@name='TransactionController.includeTimers']").text.should == 'true'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
describe 'visit' do
|
129
|
+
let(:doc) do
|
130
|
+
test do
|
131
|
+
threads do
|
132
|
+
transaction name: "TC_01", parent: true, include_timers: true do
|
133
|
+
visit url: "/home?location=melbourne", always_encode: true
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end.to_doc
|
137
|
+
end
|
138
|
+
|
139
|
+
let(:fragment) { doc.search("//HTTPSamplerProxy").first }
|
140
|
+
|
141
|
+
it 'should match on path' do
|
142
|
+
fragment.search(".//stringProp[@name='HTTPSampler.path']").text.should == '/home'
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'should match on always_encode' do
|
146
|
+
fragment.search(".//boolProp[@name='HTTPArgument.always_encode']").text.should == 'true'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
describe 'visit old syntax' do
|
152
|
+
let(:doc) do
|
153
|
+
test do
|
154
|
+
threads do
|
155
|
+
visit "/home?location=melbourne", always_encode: true
|
156
|
+
end
|
157
|
+
end.to_doc
|
158
|
+
end
|
159
|
+
|
160
|
+
let(:fragment) { doc.search("//HTTPSamplerProxy").first }
|
161
|
+
|
162
|
+
it 'should match on path' do
|
163
|
+
fragment.search(".//stringProp[@name='HTTPSampler.path']").text.should == '/home'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
describe 'https' do
|
169
|
+
let(:doc) do
|
170
|
+
test do
|
171
|
+
threads do
|
172
|
+
transaction name: "TC_01", parent: true, include_timers: true do
|
173
|
+
visit url: "https://example.com"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end.to_doc
|
177
|
+
end
|
178
|
+
|
179
|
+
let(:fragment) { doc.search("//HTTPSamplerProxy").first }
|
180
|
+
|
181
|
+
it 'should match on protocol' do
|
182
|
+
fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text.should == 'https'
|
183
|
+
end
|
11
184
|
end
|
12
185
|
|
13
|
-
|
14
|
-
|
186
|
+
|
187
|
+
describe 'xhr' do
|
188
|
+
let(:doc) do
|
189
|
+
test do
|
190
|
+
threads do
|
191
|
+
transaction name: "TC_02", parent: true, include_timers: true do
|
192
|
+
visit url: "/" do
|
193
|
+
with_xhr
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end.to_doc
|
198
|
+
end
|
199
|
+
|
200
|
+
let(:fragment) { doc.search("//HeaderManager").first }
|
201
|
+
|
202
|
+
it 'should match on XHR' do
|
203
|
+
fragment.search(".//stringProp[@name='Header.value']").text.should == 'XMLHttpRequest'
|
204
|
+
end
|
15
205
|
end
|
16
206
|
|
17
|
-
|
18
|
-
|
207
|
+
|
208
|
+
describe 'submit' do
|
209
|
+
let(:doc) do
|
210
|
+
test do
|
211
|
+
threads do
|
212
|
+
transaction name: "TC_03", parent: true, include_timers: true do
|
213
|
+
submit url: "/", fill_in: { username: 'tim', password: 'password' }
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end.to_doc
|
217
|
+
end
|
218
|
+
|
219
|
+
let(:fragment) { doc.search("//HTTPSamplerProxy").first }
|
220
|
+
|
221
|
+
it 'should match on POST' do
|
222
|
+
fragment.search(".//stringProp[@name='HTTPSampler.method']").text.should == 'POST'
|
223
|
+
end
|
19
224
|
end
|
20
225
|
|
21
|
-
|
22
|
-
|
226
|
+
|
227
|
+
describe 'If' do
|
228
|
+
let(:doc) do
|
229
|
+
test do
|
230
|
+
threads do
|
231
|
+
If condition: '2>1' do
|
232
|
+
visit url: "/"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end.to_doc
|
236
|
+
end
|
237
|
+
|
238
|
+
let(:fragment) { doc.search("//IfController").first }
|
239
|
+
|
240
|
+
it 'should match on If' do
|
241
|
+
fragment.search(".//stringProp[@name='IfController.condition']").text.should == '2>1'
|
242
|
+
end
|
23
243
|
end
|
24
244
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
245
|
+
|
246
|
+
describe 'exists' do
|
247
|
+
let(:doc) do
|
248
|
+
test do
|
249
|
+
threads do
|
250
|
+
exists 'apple' do
|
251
|
+
visit url: "/"
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end.to_doc
|
255
|
+
end
|
256
|
+
|
257
|
+
let(:fragment) { doc.search("//IfController").first }
|
258
|
+
|
259
|
+
it 'should match on exists' do
|
260
|
+
fragment.search(".//stringProp[@name='IfController.condition']").text.should == "'${apple}'.length > 0"
|
261
|
+
end
|
29
262
|
end
|
30
263
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
264
|
+
|
265
|
+
describe 'While' do
|
266
|
+
let(:doc) do
|
267
|
+
test do
|
268
|
+
threads do
|
269
|
+
While condition: 'true' do
|
270
|
+
visit url: "/"
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end.to_doc
|
274
|
+
end
|
275
|
+
|
276
|
+
let(:fragment) { doc.search("//WhileController").first }
|
277
|
+
|
278
|
+
it 'should match on While' do
|
279
|
+
fragment.search(".//stringProp[@name='WhileController.condition']").text.should == 'true'
|
280
|
+
end
|
37
281
|
end
|
38
282
|
|
39
|
-
|
283
|
+
|
284
|
+
describe 'Loop' do
|
40
285
|
let(:doc) do
|
41
286
|
test do
|
42
|
-
|
43
|
-
|
44
|
-
|
287
|
+
threads do
|
288
|
+
Loop count: 5 do
|
289
|
+
visit url: "/"
|
290
|
+
end
|
291
|
+
end
|
45
292
|
end.to_doc
|
46
293
|
end
|
47
294
|
|
48
|
-
let(:
|
49
|
-
let(:aggregate_report_enabled) { doc.search("//ResultCollector[@testname='Aggregate Report enabled']").first }
|
50
|
-
let(:aggregate_report_default) { doc.search("//ResultCollector[@testname='Aggregate Report default']").first }
|
295
|
+
let(:fragment) { doc.search("//LoopController").first }
|
51
296
|
|
52
|
-
it 'should
|
53
|
-
|
297
|
+
it 'should match on Loops' do
|
298
|
+
fragment.search(".//stringProp[@name='LoopController.loops']").text.should == '5'
|
54
299
|
end
|
300
|
+
end
|
301
|
+
|
55
302
|
|
56
|
-
|
57
|
-
|
303
|
+
describe 'Counter' do
|
304
|
+
let(:doc) do
|
305
|
+
test do
|
306
|
+
threads do
|
307
|
+
visit url: "/" do
|
308
|
+
counter start: 1, per_user: true
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end.to_doc
|
58
312
|
end
|
59
|
-
|
60
|
-
|
313
|
+
|
314
|
+
let(:fragment) { doc.search("//CounterConfig").first }
|
315
|
+
|
316
|
+
it 'should match on 5 Loops' do
|
317
|
+
fragment.search(".//boolProp[@name='CounterConfig.per_user']").text.should == 'true'
|
61
318
|
end
|
62
319
|
end
|
63
320
|
|
64
|
-
describe do
|
65
321
|
|
322
|
+
describe 'Switch' do
|
66
323
|
let(:doc) do
|
67
324
|
test do
|
68
|
-
|
69
|
-
|
70
|
-
|
325
|
+
threads do
|
326
|
+
Switch value: 'cat' do
|
327
|
+
visit url: "/"
|
328
|
+
end
|
329
|
+
end
|
71
330
|
end.to_doc
|
72
331
|
end
|
73
332
|
|
74
|
-
let(:
|
75
|
-
let(:report_not_errors_only) { doc.search("//ResultCollector[@testname='View Results Tree not error_only']").first }
|
76
|
-
let(:report_default) { doc.search("//ResultCollector[@testname='View Results Tree default']").first }
|
333
|
+
let(:fragment) { doc.search("//SwitchController").first }
|
77
334
|
|
78
|
-
it 'should
|
79
|
-
|
80
|
-
error_logging.attributes['name'].value.should == 'ResultCollector.error_logging'
|
81
|
-
error_logging.text.should == 'true'
|
335
|
+
it 'should match on Switch' do
|
336
|
+
fragment.search(".//stringProp[@name='SwitchController.value']").text.should == 'cat'
|
82
337
|
end
|
338
|
+
end
|
83
339
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
340
|
+
describe 'regex extract' do
|
341
|
+
let(:doc) do
|
342
|
+
test do
|
343
|
+
extract regex: 'pattern', name: 'my_regex'
|
344
|
+
end.to_doc
|
88
345
|
end
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
346
|
+
|
347
|
+
let(:fragment) { doc.search("//RegexExtractor").first }
|
348
|
+
|
349
|
+
it 'should match on refname' do
|
350
|
+
fragment.search(".//stringProp[@name='RegexExtractor.refname']").text.should == 'my_regex'
|
93
351
|
end
|
94
352
|
end
|
95
353
|
|
96
|
-
describe 'extract use_headers_type' do
|
97
354
|
|
355
|
+
describe 'xpath extract' do
|
98
356
|
let(:doc) do
|
99
357
|
test do
|
100
|
-
extract :
|
101
|
-
extract :regex, 'match on default', 'blah'
|
358
|
+
extract xpath: '//node', name: 'my_xpath'
|
102
359
|
end.to_doc
|
103
360
|
end
|
104
361
|
|
105
|
-
let(:
|
106
|
-
let(:extract) { doc.search("//RegexExtractor[@testname='match on default']").first }
|
362
|
+
let(:fragment) { doc.search("//XPathExtractor").first }
|
107
363
|
|
108
|
-
it 'should match on
|
109
|
-
|
364
|
+
it 'should match on refname' do
|
365
|
+
fragment.search(".//stringProp[@name='XPathExtractor.refname']").text.should == 'my_xpath'
|
110
366
|
end
|
367
|
+
end
|
368
|
+
|
369
|
+
|
370
|
+
describe 'assertions' do
|
371
|
+
|
372
|
+
describe 'scope all' do
|
373
|
+
let(:doc) do
|
374
|
+
test do
|
375
|
+
visit '/' do
|
376
|
+
assert contains: 'Welcome'
|
377
|
+
end
|
378
|
+
end.to_doc
|
379
|
+
end
|
380
|
+
|
381
|
+
let(:fragment) { doc.search("//ResponseAssertion").first }
|
111
382
|
|
112
|
-
|
113
|
-
|
383
|
+
it 'should match on match' do
|
384
|
+
fragment.search(".//stringProp[@name='match']").text.should == 'Welcome'
|
385
|
+
end
|
386
|
+
|
387
|
+
it 'should match on scope' do
|
388
|
+
fragment.search(".//stringProp[@name='Assertion.scope']").text.should == 'all'
|
389
|
+
end
|
390
|
+
|
391
|
+
it 'should match on test_type' do
|
392
|
+
fragment.search(".//intProp[@name='Assertion.test_type']").text.should == '2'
|
393
|
+
end
|
114
394
|
end
|
115
395
|
|
396
|
+
describe 'scope main' do
|
397
|
+
let(:doc) do
|
398
|
+
test do
|
399
|
+
visit '/' do
|
400
|
+
assert contains: 'Welcome', scope: 'main'
|
401
|
+
end
|
402
|
+
end.to_doc
|
403
|
+
end
|
404
|
+
|
405
|
+
let(:fragment) { doc.search("//ResponseAssertion").first }
|
406
|
+
|
407
|
+
it 'should match on scope' do
|
408
|
+
puts doc.to_xml indent: 2
|
409
|
+
fragment.search(".//stringProp[@name='Assertion.scope']").text.should == ""
|
410
|
+
end
|
411
|
+
end
|
116
412
|
end
|
117
413
|
|
118
|
-
describe 'Nested controllers' do
|
119
414
|
|
415
|
+
describe 'Nested controllers' do
|
120
416
|
let(:doc) do
|
121
417
|
test do
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
418
|
+
Simple name: 'node1.1' do
|
419
|
+
Simple name: 'node2.1'
|
420
|
+
Simple name: 'node2.2' do
|
421
|
+
Simple name: 'node3.1'
|
126
422
|
end
|
127
|
-
|
423
|
+
Simple name: 'node2.3'
|
128
424
|
end
|
129
|
-
|
425
|
+
Simple name: 'node1.2'
|
130
426
|
end.to_doc
|
131
427
|
end
|
132
428
|
|
133
|
-
let(:
|
134
|
-
let(:
|
429
|
+
let(:node1_1) { doc.search("//GenericController[@testname='node1.1']").first }
|
430
|
+
let(:node1_2) { doc.search("//GenericController[@testname='node1.2']").first }
|
135
431
|
|
136
|
-
let(:
|
137
|
-
let(:
|
138
|
-
let(:
|
432
|
+
let(:node2_1) { doc.search("//GenericController[@testname='node2.1']").first }
|
433
|
+
let(:node2_2) { doc.search("//GenericController[@testname='node2.2']").first }
|
434
|
+
let(:node2_3) { doc.search("//GenericController[@testname='node2.3']").first }
|
139
435
|
|
140
|
-
let(:
|
436
|
+
let(:node3_1) { doc.search("//GenericController[@testname='node3.1']").first }
|
141
437
|
|
142
438
|
it 'nodes should have hashTree as its parent' do
|
143
|
-
[
|
439
|
+
[node1_1, node1_2, node2_1, node2_2, node2_3, node3_1].each do |node|
|
144
440
|
node.parent.name.should == 'hashTree'
|
145
441
|
end
|
146
442
|
end
|
147
443
|
|
148
|
-
describe '
|
149
|
-
it 'parent parent should be
|
150
|
-
|
444
|
+
describe 'node3_1' do
|
445
|
+
it 'parent parent should be node2_2' do
|
446
|
+
node3_1.parent.should == node2_2.next
|
151
447
|
end
|
152
448
|
end
|
153
449
|
|
154
|
-
describe '
|
155
|
-
it 'previous non hashTree sibling is
|
156
|
-
|
450
|
+
describe 'node1_2' do
|
451
|
+
it 'previous non hashTree sibling is node1_1' do
|
452
|
+
node1_2.previous.previous.should == node1_1
|
157
453
|
end
|
158
454
|
end
|
159
455
|
|
160
456
|
end
|
161
|
-
|
162
457
|
end
|