ruby-jmeter 2.13.10 → 3.0.0
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 +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +2 -2
- data/LICENSE.txt +2 -2
- data/README.md +4 -5
- data/Rakefile +3 -3
- data/examples/{basic_os_process_sampler.rb → OS_process_sampler.rb} +1 -1
- data/examples/{basic_assertion_results.rb → assertion_results.rb} +1 -3
- data/examples/basic_auth.rb +1 -1
- data/examples/{basic_browser_headers.rb → browser_headers.rb} +1 -1
- data/examples/{basic_composite_graph.rb → composite_graph.rb} +1 -1
- data/examples/{basic_gc_dummy_sampler.rb → dummy_sampler.rb} +1 -3
- data/examples/{basic_duration_assertion.rb → duration_assertion.rb} +1 -1
- data/examples/etsy_login_browse.rb +1 -4
- data/examples/{basic_extract.rb → extract.rb} +1 -1
- data/examples/{basic_foreach.rb → foreach_controller.rb} +1 -4
- data/examples/{basic_header.rb → header_manager.rb} +2 -3
- data/examples/{basic_cache.rb → http_cache_manager.rb} +1 -1
- data/examples/{basic_cookies.rb → http_cookie_manager.rb} +1 -1
- data/examples/{basic_http_request_defaults.rb → http_request_defaults.rb} +3 -2
- data/examples/{basic_post.rb → http_request_post.rb} +1 -5
- data/examples/{basic_http_request_with_files.rb → http_request_with_files.rb} +1 -1
- data/examples/{basic_query_params.rb → http_request_with_query_params.rb} +1 -1
- data/examples/{basic_gc_results.rb → jmeter_plugins_graphs.rb} +1 -2
- data/examples/{basic_json_path_assertion.rb → json_path_assertions.rb} +1 -1
- data/examples/{basic_json_path_extractor.rb → json_path_extractor.rb} +1 -3
- data/examples/{basic_ldap_ext.rb → ldap_sampler.rb} +1 -1
- data/examples/{basic_loadosophia.rb → loadosophia.rb} +1 -1
- data/examples/{basic_loops.rb → loop_controller.rb} +2 -2
- data/examples/{basic_counter.rb → loops_with_counter.rb} +2 -2
- data/examples/{basic_perfmon.rb → perfmon.rb} +1 -1
- data/examples/real_page_objects.rb +1 -1
- data/examples/real_user_objects_github.rb +1 -1
- data/examples/regular_expression_extractor.rb +11 -0
- data/examples/{basic_assertion.rb → response_assertion.rb} +2 -1
- data/examples/{basic_response_time_percentiles_graph.rb → response_time_percentiles_graph.rb} +1 -2
- data/examples/{basic_simple_data_writer.rb → simple_data_writer_listener.rb} +1 -1
- data/examples/{basic_stepping_thread_group.rb → stepping_thread_group.rb} +1 -3
- data/examples/{basic_test_fragment.rb → test_fragment.rb} +1 -1
- data/examples/{basic_think_time.rb → think_time.rb} +2 -2
- data/examples/{basic_thread_groups.rb → thread_groups.rb} +1 -1
- data/examples/{basic_throughput_controller.rb → throughput_controller.rb} +1 -1
- data/examples/{basic_throughput_shaping_timer.rb → throughput_shaping_timer.rb} +1 -2
- data/examples/{basic_ultimate_thread_group.rb → ultimate_thread_group.rb} +1 -2
- data/examples/{basic_user_defined_variables.rb → user_defined_variables.rb} +1 -1
- data/examples/{basic_preprocessor_user_parameters.rb → user_parameters.rb} +7 -7
- data/lib/ruby-jmeter.rb +13 -8
- data/lib/ruby-jmeter/DSL.md +3 -1
- data/lib/ruby-jmeter/dsl.rb +11 -615
- data/lib/ruby-jmeter/dsl/foreach_controller.rb +0 -2
- data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_request.rb +0 -2
- data/lib/ruby-jmeter/dsl/http_request_defaults.rb +0 -1
- data/lib/ruby-jmeter/dsl/jms_publisher.rb +2 -0
- data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +1 -3
- data/lib/ruby-jmeter/dsl/response_assertion.rb +0 -1
- data/lib/ruby-jmeter/dsl/test_fragment.rb +1 -1
- data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -1
- data/lib/ruby-jmeter/extend/assertions/response_assertion.rb +36 -0
- data/lib/ruby-jmeter/extend/config_elements/header_manager.rb +13 -0
- data/lib/ruby-jmeter/extend/config_elements/http_cache_manager.rb +11 -0
- data/lib/ruby-jmeter/extend/config_elements/http_cookie_manager.rb +11 -0
- data/lib/ruby-jmeter/extend/config_elements/http_request_defaults.rb +28 -0
- data/lib/ruby-jmeter/extend/config_elements/user_defined_variables.rb +13 -0
- data/lib/ruby-jmeter/extend/config_elements/user_parameters.rb +31 -0
- data/lib/ruby-jmeter/extend/controllers/foreach_controller.rb +25 -0
- data/lib/ruby-jmeter/extend/controllers/loop_controller.rb +11 -0
- data/lib/ruby-jmeter/extend/controllers/module_controller.rb +23 -0
- data/lib/ruby-jmeter/extend/controllers/throughput_controller.rb +15 -0
- data/lib/ruby-jmeter/extend/controllers/transaction_controller.rb +14 -0
- data/lib/ruby-jmeter/extend/misc/aliases.rb +21 -0
- data/lib/ruby-jmeter/extend/misc/exists.rb +13 -0
- data/lib/ruby-jmeter/extend/misc/flood.rb +48 -0
- data/lib/ruby-jmeter/extend/misc/with_helpers.rb +27 -0
- data/lib/ruby-jmeter/extend/plugins/jmeter_plugins.rb +115 -0
- data/lib/ruby-jmeter/extend/processors/extract.rb +28 -0
- data/lib/ruby-jmeter/extend/processors/regular_expression_extractor.rb +25 -0
- data/lib/ruby-jmeter/extend/samplers/http_request.rb +47 -0
- data/lib/ruby-jmeter/extend/samplers/soapxmlrpc_request.rb +9 -0
- data/lib/ruby-jmeter/extend/threads/setup_thread_group.rb +18 -0
- data/lib/ruby-jmeter/extend/threads/thread_group.rb +19 -0
- data/lib/ruby-jmeter/extend/timers/constant_throughput_timer.rb +12 -0
- data/lib/ruby-jmeter/extend/timers/random_timer.rb +14 -0
- data/lib/ruby-jmeter/helpers/helper.rb +1 -2
- data/lib/ruby-jmeter/idl.xml +6 -4
- data/lib/ruby-jmeter/version.rb +1 -1
- data/ruby-jmeter.gemspec +7 -7
- data/spec/constant_throughput_timer_spec.rb +22 -0
- data/spec/header_manager_spec.rb +37 -0
- data/spec/http_cache_manager_spec.rb +17 -0
- data/spec/http_cookie_manager_spec.rb +17 -0
- data/spec/http_request_defaults_spec.rb +47 -0
- data/spec/http_request_spec.rb +305 -0
- data/spec/jmeter_plugins_spec.rb +155 -0
- data/spec/json_extractor_spec.rb +19 -0
- data/spec/json_path_assertion_spec.rb +28 -0
- data/spec/logic_controller_spec.rb +148 -0
- data/spec/loop_controller_spec.rb +19 -0
- data/spec/module_controller_spec.rb +56 -0
- data/spec/regular_expression_extractor_spec.rb +63 -0
- data/spec/response_assertion_spec.rb +69 -0
- data/spec/setup_thread_group_spec.rb +31 -0
- data/spec/thread_group_spec.rb +57 -0
- data/spec/throughput_controller_spec.rb +24 -0
- data/spec/transaction_controller_spec.rb +30 -0
- data/spec/user_defined_variables_spec.rb +22 -0
- data/spec/user_parameters_spec.rb +45 -0
- data/spec/with_helpers_spec.rb +57 -0
- data/spec/xpath_extractor_spec.rb +15 -0
- metadata +87 -59
- data/examples/basic_flood.rb +0 -12
- data/examples/basic_flood_real.rb +0 -7
- data/examples/basic_flood_with_csv.rb +0 -16
- data/examples/basic_google.rb +0 -8
- data/examples/basic_har.json +0 -4252
- data/examples/basic_har.rb +0 -34
- data/examples/basic_meta_fu.rb +0 -63
- data/examples/basic_response_assertion.rb +0 -13
- data/examples/basic_run.rb +0 -12
- data/examples/basic_testdata.rb +0 -60
- data/examples/demo.csv +0 -3
- data/examples/real_flood_test.rb +0 -14
- data/examples/real_flood_test_data.rb +0 -15
- data/examples/real_immi.gov.au_visa.rb +0 -78
- data/lib/ruby-jmeter/helpers/jmeter.properties +0 -28
- data/spec/dsl_spec.rb +0 -1157
- data/spec/stub.rb +0 -31
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'json extract' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
extract json: '.test.path', name: 'my_json'
|
7
|
+
end.to_doc
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:fragment) { doc.search("//com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor").first }
|
11
|
+
|
12
|
+
it 'should match on json path' do
|
13
|
+
expect(fragment.search(".//stringProp[@name='JSONPATH']").text).to eq '.test.path'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should match on json var' do
|
17
|
+
expect(fragment.search(".//stringProp[@name='VAR']").text).to eq 'my_json'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'assertions' do
|
4
|
+
describe 'json assertion' do
|
5
|
+
let(:doc) do
|
6
|
+
test do
|
7
|
+
visit '/' do
|
8
|
+
assert json: '.key', value: 'value'
|
9
|
+
end
|
10
|
+
end.to_doc
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:fragment) { doc.search('//com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion.JSONPathAssertion').first }
|
14
|
+
|
15
|
+
it 'should match on expected value' do
|
16
|
+
expect(fragment.search(".//stringProp[@name='EXPECTED_VALUE']").text).to eq "value"
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should match on json path' do
|
20
|
+
expect(fragment.search(".//stringProp[@name='JSON_PATH']").text).to eq ".key"
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have json validation by default' do
|
24
|
+
expect(fragment.search(".//boolProp[@name='JSONVALIDATION']").text).to eq "true"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'disabled elements' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
header name: 'Accept', value: '*', enabled: false
|
7
|
+
end.to_doc
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:fragment) { doc.search('//HeaderManager') }
|
11
|
+
|
12
|
+
it 'should be disabled' do
|
13
|
+
expect(fragment.first.attributes['enabled'].value).to eq 'false'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'If' do
|
18
|
+
let(:doc) do
|
19
|
+
test do
|
20
|
+
threads do
|
21
|
+
If condition: '2>1' do
|
22
|
+
visit url: "/"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end.to_doc
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:fragment) { doc.search("//IfController").first }
|
29
|
+
|
30
|
+
it 'should match on If' do
|
31
|
+
expect(fragment.search(".//stringProp[@name='IfController.condition']").text).to eq '2>1'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'exists' do
|
36
|
+
let(:doc) do
|
37
|
+
test do
|
38
|
+
threads do
|
39
|
+
exists 'apple' do
|
40
|
+
visit url: "/"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end.to_doc
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:fragment) { doc.search("//IfController").first }
|
47
|
+
|
48
|
+
it 'should match on exists' do
|
49
|
+
expect(fragment.search(".//stringProp[@name='IfController.condition']").text).to eq '"${apple}" != "\${apple}"'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'While' do
|
54
|
+
let(:doc) do
|
55
|
+
test do
|
56
|
+
threads do
|
57
|
+
While condition: 'true' do
|
58
|
+
visit url: "/"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end.to_doc
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:fragment) { doc.search('//WhileController').first }
|
65
|
+
|
66
|
+
it 'should match on While' do
|
67
|
+
expect(fragment.search(".//stringProp[@name='WhileController.condition']").text).to eq 'true'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'Counter' do
|
72
|
+
let(:doc) do
|
73
|
+
test do
|
74
|
+
threads do
|
75
|
+
visit url: "/" do
|
76
|
+
counter start: 1, per_user: true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end.to_doc
|
80
|
+
end
|
81
|
+
|
82
|
+
let(:fragment) { doc.search('//CounterConfig').first }
|
83
|
+
|
84
|
+
it 'should match on 5 Loops' do
|
85
|
+
expect(fragment.search(".//boolProp[@name='CounterConfig.per_user']").text).to eq 'true'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'Switch' do
|
90
|
+
let(:doc) do
|
91
|
+
test do
|
92
|
+
threads do
|
93
|
+
Switch value: 'cat' do
|
94
|
+
visit url: "/"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end.to_doc
|
98
|
+
end
|
99
|
+
|
100
|
+
let(:fragment) { doc.search('//SwitchController').first }
|
101
|
+
|
102
|
+
it 'should match on Switch' do
|
103
|
+
expect(fragment.search(".//stringProp[@name='SwitchController.value']").text).to eq 'cat'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe 'Nested controllers' do
|
108
|
+
let(:doc) do
|
109
|
+
test do
|
110
|
+
Simple name: 'node1.1' do
|
111
|
+
Simple name: 'node2.1'
|
112
|
+
Simple name: 'node2.2' do
|
113
|
+
Simple name: 'node3.1'
|
114
|
+
end
|
115
|
+
Simple name: 'node2.3'
|
116
|
+
end
|
117
|
+
Simple name: 'node1.2'
|
118
|
+
end.to_doc
|
119
|
+
end
|
120
|
+
|
121
|
+
let(:node1_1) { doc.search("//GenericController[@testname='node1.1']").first }
|
122
|
+
let(:node1_2) { doc.search("//GenericController[@testname='node1.2']").first }
|
123
|
+
|
124
|
+
let(:node2_1) { doc.search("//GenericController[@testname='node2.1']").first }
|
125
|
+
let(:node2_2) { doc.search("//GenericController[@testname='node2.2']").first }
|
126
|
+
let(:node2_3) { doc.search("//GenericController[@testname='node2.3']").first }
|
127
|
+
|
128
|
+
let(:node3_1) { doc.search("//GenericController[@testname='node3.1']").first }
|
129
|
+
|
130
|
+
it 'nodes should have hashTree as its parent' do
|
131
|
+
[node1_1, node1_2, node2_1, node2_2, node2_3, node3_1].each do |node|
|
132
|
+
expect(node.parent.name).to eq 'hashTree'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe 'node3_1' do
|
137
|
+
it 'parent parent should be node2_2' do
|
138
|
+
expect(node3_1.parent).to eq node2_2.next
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe 'node1_2' do
|
143
|
+
it 'previous non hashTree sibling is node1_1' do
|
144
|
+
expect(node1_2.previous.previous).to eq node1_1
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'loop' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
threads do
|
7
|
+
loops count: 5 do
|
8
|
+
visit url: "/"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end.to_doc
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:fragment) { doc.search('//LoopController').first }
|
15
|
+
|
16
|
+
it 'should match on Loops' do
|
17
|
+
expect(fragment.search(".//stringProp[@name='LoopController.loops']").text).to eq '5'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'module controllers' do
|
4
|
+
let(:doc) do
|
5
|
+
test name: 'tests' do
|
6
|
+
threads 1, name: 'threads' do
|
7
|
+
Simple name: 'controller_to_call'
|
8
|
+
end
|
9
|
+
threads 1 do
|
10
|
+
module_controller name: 'modules', node_path: [
|
11
|
+
'WorkBench',
|
12
|
+
'tests',
|
13
|
+
'threads',
|
14
|
+
'controller_to_call'
|
15
|
+
]
|
16
|
+
end
|
17
|
+
end.to_doc
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:simple_controller) { doc.search("//GenericController").first }
|
21
|
+
let(:test_module) { doc.search("//ModuleController").first }
|
22
|
+
let(:nodes) { test_module.search(".//stringProp") }
|
23
|
+
|
24
|
+
it 'should have a node path' do
|
25
|
+
expect(nodes.length).to eq 4
|
26
|
+
expect(nodes[0].text).to eq 'WorkBench'
|
27
|
+
expect(nodes[1].text).to eq 'tests'
|
28
|
+
expect(nodes[2].text).to eq 'threads'
|
29
|
+
expect(nodes[3].text).to eq 'controller_to_call'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'module controllers with test fragment' do
|
34
|
+
let(:doc) do
|
35
|
+
test do
|
36
|
+
test_fragment name: 'some_test_fragment', enabled: 'false' do
|
37
|
+
get name: 'Home Page', url: 'http://google.com'
|
38
|
+
end
|
39
|
+
|
40
|
+
threads count: 1 do
|
41
|
+
module_controller test_fragment: 'WorkBench/TestPlan/some_test_fragment'
|
42
|
+
end
|
43
|
+
end.to_doc
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:simple_controller) { doc.search("//GenericController").first }
|
47
|
+
let(:test_module) { doc.search("//ModuleController").first }
|
48
|
+
let(:nodes) { test_module.search(".//stringProp") }
|
49
|
+
|
50
|
+
it 'should have a node path specified by test fragment' do
|
51
|
+
expect(nodes.length).to eq 3
|
52
|
+
expect(nodes[0].text).to eq 'WorkBench'
|
53
|
+
expect(nodes[1].text).to eq 'TestPlan'
|
54
|
+
expect(nodes[2].text).to eq 'some_test_fragment'
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'regular_expression_extractor' do
|
4
|
+
describe 'standard scope' do
|
5
|
+
let(:doc) do
|
6
|
+
test do
|
7
|
+
regex pattern: 'pattern', name: 'my_variable', match_number: 1, default: '424242'
|
8
|
+
end.to_doc
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:fragment) { doc.search('//RegexExtractor').first }
|
12
|
+
|
13
|
+
it 'matches on refname' do
|
14
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.refname']").text).to eq 'my_variable'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'matches on regex' do
|
18
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.regex']").text).to eq 'pattern'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'matches on template' do
|
22
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.template']").text).to eq '$1$'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'matches on match_number' do
|
26
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.match_number']").text).to eq '1'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'matches on default' do
|
30
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.default']").text).to eq '424242'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'matches on scope' do
|
34
|
+
expect(fragment.search(".//stringProp[@name='Sample.scope']").text).to eq 'all'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'variable scope' do
|
39
|
+
let(:doc) do
|
40
|
+
test do
|
41
|
+
regex pattern: 'pattern', name: 'my_variable', variable: 'test_variable'
|
42
|
+
end.to_doc
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:fragment) { doc.search('//RegexExtractor').first }
|
46
|
+
|
47
|
+
it 'matches on refname' do
|
48
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.refname']").text).to eq 'my_variable'
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'matches on regex' do
|
52
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.regex']").text).to eq 'pattern'
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'matches on template' do
|
56
|
+
expect(fragment.search(".//stringProp[@name='RegexExtractor.template']").text).to eq '$1$'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'matches on scope' do
|
60
|
+
expect(fragment.search(".//stringProp[@name='Sample.scope']").text).to eq 'variable'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'response assertion' do
|
4
|
+
describe 'standard scope' do
|
5
|
+
let(:doc) do
|
6
|
+
test do
|
7
|
+
assert contains: 'We test, tune and secure your site'
|
8
|
+
end.to_doc
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:fragment) { doc.search('//ResponseAssertion').first }
|
12
|
+
|
13
|
+
it 'matches on refname' do
|
14
|
+
expect(fragment.search(".//stringProp[@name='0']").text).to eq 'We test, tune and secure your site'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'matches on test_type' do
|
18
|
+
expect(fragment.search(".//intProp[@name='Assertion.test_type']").text).to eq '2'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'matches on scope' do
|
22
|
+
expect(fragment.search(".//stringProp[@name='Assertion.scope']").text).to eq 'all'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'custom scope' do
|
27
|
+
let(:doc) do
|
28
|
+
test do
|
29
|
+
assert 'not-contains' => 'Something in frames', scope: 'children'
|
30
|
+
end.to_doc
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:fragment) { doc.search('//ResponseAssertion').first }
|
34
|
+
|
35
|
+
it 'matches on refname' do
|
36
|
+
expect(fragment.search(".//stringProp[@name='0']").text).to eq 'Something in frames'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'matches on test_type' do
|
40
|
+
expect(fragment.search(".//intProp[@name='Assertion.test_type']").text).to eq '6'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'matches on scope' do
|
44
|
+
expect(fragment.search(".//stringProp[@name='Assertion.scope']").text).to eq 'children'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'variable scope' do
|
49
|
+
let(:doc) do
|
50
|
+
test do
|
51
|
+
assert 'substring' => 'Something in frames', scope: 'children', variable: 'test'
|
52
|
+
end.to_doc
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:fragment) { doc.search('//ResponseAssertion').first }
|
56
|
+
|
57
|
+
it 'matches on refname' do
|
58
|
+
expect(fragment.search(".//stringProp[@name='0']").text).to eq 'Something in frames'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'matches on test_type' do
|
62
|
+
expect(fragment.search(".//intProp[@name='Assertion.test_type']").text).to eq '16'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'matches on scope' do
|
66
|
+
expect(fragment.search(".//stringProp[@name='Assertion.scope']").text).to eq 'variable'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'setup thread groups' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
setup_thread_group count: 101, continue_forever: true, duration: 69
|
7
|
+
end.to_doc
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:fragment) { doc.search("//SetupThreadGroup").first }
|
11
|
+
|
12
|
+
it 'should match on num_threads' do
|
13
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text).to eq '101'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should match on scheduler' do
|
17
|
+
expect(fragment.search(".//boolProp[@name='ThreadGroup.scheduler']").text).to eq 'true'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should match on continue_forever' do
|
21
|
+
expect(fragment.search(".//boolProp[@name='LoopController.continue_forever']").text).to eq 'true'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should match on loops' do
|
25
|
+
expect(fragment.search(".//stringProp[@name='LoopController.loops']").text).to eq '-1'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should match on duration' do
|
29
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.duration']").text).to eq '69'
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'thread groups' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
threads count: 101, continue_forever: true, duration: 69
|
7
|
+
end.to_doc
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:fragment) { doc.search("//ThreadGroup").first }
|
11
|
+
|
12
|
+
it 'should match on num_threads' do
|
13
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text).to eq '101'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should match on scheduler' do
|
17
|
+
expect(fragment.search(".//boolProp[@name='ThreadGroup.scheduler']").text).to eq 'true'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should match on continue_forever' do
|
21
|
+
expect(fragment.search(".//boolProp[@name='LoopController.continue_forever']").text).to eq 'true'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should match on loops' do
|
25
|
+
expect(fragment.search(".//intProp[@name='LoopController.loops']").text).to eq '-1'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should match on duration' do
|
29
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.duration']").text).to eq '69'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'thread groups old syntax' do
|
34
|
+
let(:doc) do
|
35
|
+
test do
|
36
|
+
threads 101, continue_forever: true, duration: 69
|
37
|
+
end.to_doc
|
38
|
+
end
|
39
|
+
|
40
|
+
let(:fragment) { doc.search("//ThreadGroup").first }
|
41
|
+
|
42
|
+
it 'should match on num_threads' do
|
43
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text).to eq '101'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should match on continue_forever' do
|
47
|
+
expect(fragment.search(".//boolProp[@name='LoopController.continue_forever']").text).to eq 'true'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should match on loops' do
|
51
|
+
expect(fragment.search(".//intProp[@name='LoopController.loops']").text).to eq '-1'
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should match on duration' do
|
55
|
+
expect(fragment.search(".//stringProp[@name='ThreadGroup.duration']").text).to eq '69'
|
56
|
+
end
|
57
|
+
end
|