diff --git a/.gitignore b/.gitignore
index 8a0e67c..97fac5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,7 @@ Gemfile.lock
.bundle
.ruby-version
=.vendor/*
-.idea/
\ No newline at end of file
+.idea/
+tmp_reports/*
+reports/*
+report.html
diff --git a/.idea/testingGoogleGeocodingAPI.iml b/.idea/testingGoogleGeocodingAPI.iml
index 1eb6083..783c891 100644
--- a/.idea/testingGoogleGeocodingAPI.iml
+++ b/.idea/testingGoogleGeocodingAPI.iml
@@ -121,16 +121,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -248,12 +238,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 5d69127..e09fcb0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,3335 +2,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -3399,6 +38,24 @@
+
+
+ @response
+ get_all_obj_from_json
+ Fail
+ failed
+ move_to_test_directory
+ region
+ I see all results contains an address_component
+ @car
+
+
+
+
+
+ $PROJECT_DIR$/features
+
+
@@ -3407,18 +64,35 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3465,6 +139,11 @@
+
+
+
+
+
@@ -3474,14 +153,19 @@
-
+
+
+
+
+
+
+
-
@@ -3494,15 +178,22 @@
-
+
+
+
+
+
-
+
+
+
+
@@ -3518,7 +209,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3541,6 +250,15 @@
+
+
+
+
+
+
+
+
+
@@ -3567,28 +285,28 @@
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
+
@@ -3606,12 +324,42 @@
- file://$PROJECT_DIR$/features/step_definitions/geolocation-api-steps.rb
- 24
-
+ file://$PROJECT_DIR$/features/step_definitions/helpers/helper_geo.rb
+ 4
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/helpers/helper_geo.rb
+ 60
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/helpers/helper_geo.rb
+ 56
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/geo_api_steps.rb
+ 41
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/geo_api_steps.rb
+ 13
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/geo_api_steps.rb
+ 17
+
+
+
+ file://$PROJECT_DIR$/features/step_definitions/geo_api_steps.rb
+ 15
+
-
+
@@ -3640,7 +388,7 @@
-
+
@@ -3648,7 +396,7 @@
-
+
@@ -3656,7 +404,7 @@
-
+
@@ -3665,7 +413,7 @@
-
+
@@ -3673,7 +421,7 @@
-
+
@@ -3705,7 +453,7 @@
-
+
@@ -3745,7 +493,7 @@
-
+
@@ -3753,7 +501,7 @@
-
+
@@ -3761,7 +509,7 @@
-
+
@@ -3770,47 +518,47 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
@@ -3818,42 +566,186 @@
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..e91989a
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,37 @@
+# This is the configuration used to check the rubocop source code.
+
+AllCops:
+ Exclude:
+ # Currently excluded for future investigation
+ - '**/hooks.rb'
+ - '**/env.rb'
+ - '**/http_util.rb'
+ - 'features/step_definitions/helpers/table_transform.rb'
+
+################## Customized rules ##################
+
+Metrics/LineLength:
+ Max: 150
+ Exclude:
+ - '**/long-text.rb'
+
+Metrics/AbcSize:
+ Max: 30
+
+Metrics/MethodLength:
+ Max: 15
+
+Metrics/BlockLength:
+ Max: 30
+
+Style/RegexpLiteral:
+ EnforcedStyle: slashes
+ AllowInnerSlashes: true
+
+# Waiting for answer regarding snake_case or kebab-case use in FileNames
+Style/FileName:
+ Enabled: false
+
+# Investigate Carriage error
+EndOfLine:
+ Enabled: false
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
index 54f65f3..54b8cf1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,12 +5,6 @@ gem 'httparty'
gem 'rspec', '>=3.4'
gem 'rspec-expectations', '=3.4.0'
gem 'rake', '10.4.0'
-gem 'cukeforker', '=1.1.0'
-gem 'faraday'
-#gem 'typhoeus'
-
-
+gem 'parallel_tests'
gem 'jsonpath'
-
-gem 'report_builder','=0.1.4'
-#gem 'cuke_sniffer', '=0.0.8'
+gem 'report_builder', '=0.1.4'
diff --git a/Gemfile.lock b/Gemfile.lock
index 67e4cde..a03dc73 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -19,8 +19,6 @@ GEM
cucumber (>= 2.0.0)
vnctools (>= 0.0.5)
diff-lcs (1.3)
- faraday (0.13.1)
- multipart-post (>= 1.2, < 3)
ffi (1.9.18)
gherkin (4.1.3)
httparty (0.15.6)
@@ -31,7 +29,9 @@ GEM
multi_json (1.12.2)
multi_test (0.1.2)
multi_xml (0.6.0)
- multipart-post (2.0.0)
+ parallel (1.12.0)
+ parallel_tests (2.17.0)
+ parallel
rake (10.4.0)
report_builder (0.1.4)
builder (~> 3.2, >= 3.2.2)
@@ -58,9 +58,9 @@ PLATFORMS
DEPENDENCIES
cucumber (= 2.4.0)
cukeforker (= 1.1.0)
- faraday
httparty
jsonpath
+ parallel_tests
rake (= 10.4.0)
report_builder (= 0.1.4)
rspec (>= 3.4)
diff --git a/Rakefile b/Rakefile
index 9502310..82f2667 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,55 +1,45 @@
-# encoding: utf-8
-
-#require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'
-
-require 'cukeforker'
-require 'cukeforker/rake_task'
-require 'jsonpath'
-
-#require 'cuke_sniffer'
-
require 'report_builder'
-task "move_to_test_directory" do
- Dir.chdir('features')
-end
+processes = ENV['processes'] || 10
-Cucumber::Rake::Task.new("running_geo_api_tests") do |t|
- # t.cucumber_opts = ["--tags", "@carlos", "--tags", "~@pend", "--format", "html", "--out", "report.html", "--format", "junit", "--out", "testoutput", "--format", "pretty", "--format", "rerun", "--out", "rerun.txt"]
+Cucumber::Rake::Task.new('running_geo_api_tests') do |t|
+ #t.cucumber_opts = ["--tags", "@carlos", "--tags", "~@pend", "--format", "report/report.html", "--out", "report.html", "--format", "junit", "--out", "testoutput", "--format", "pretty", "--format", "rerun", "--out", "rerun.txt"]
t.cucumber_opts = ["--tags", "@carlos"]
end
-# Cucumber::Rake::Task.new("running_parallel_geo_api_tests") do
-# CukeForker::Runner.run CukeForker::Scenarios.all
-# #extra_args: %W[-f CukeForker::Formatters::JunitScenarioFormatter --out results/junit]
-# end
+Cucumber::Rake::Task.new('running_all_tests') do |t|
+ t.cucumber_opts = ["--tags", "~@pend", "--format", "html", "--out", "report.html", "--format", "junit", "--out", "testoutput", "--format", "pretty"]
+end
-task :cleanup_cuke_forker do
- puts " ========Deleting old reports and logs========="
- #FileUtils.rm_rf('reports/test_report')
- Dir.mkdir("features/reports/test_report")
+task 'prepare_parallel_report' do
+ FileUtils.rm_rf('reports')
+ Dir.mkdir('reports')
+
+ puts "configure reportbuilder"
ReportBuilder.configure do |config|
- config.json_path = 'reports/test_report'
- config.report_path = 'reports/test_report'
- config.report_tabs = [:overview, :features, :scenarios, :errors]
+ config.json_path = 'tmp_reports'
+ config.report_path = 'reports/reports'
+ config.report_types = [:json, :html]
+ config.report_tabs = [:overview, :features, :scenarios, :errors]
config.report_title = 'Test Results'
config.report
end
end
-task :all do
- Rake::Task['cleanup_cuke_forker'].invoke
- puts "===== Executing Tests in parallel"
+task 'create_report' do
+ ReportBuilder.build_report
+ FileUtils.rm_rf('tmp_reports')
+end
- Dir.chdir('features/')
+task 'parallel_all_tests' do
+ Rake.application.invoke_task('prepare_parallel_report')
- CukeForker::Runner.run CukeForker::Scenarios.tagged('@carlos'), {:max => 10,
- :log => true, :format => :json, :out => 'reports/test_report'}
- puts "===== End Executing Tests in parallel"
- puts "===== Executing report"
- ReportBuilder.build_report
- puts "===== End Executing report"
+ FileUtils.rm_rf('tmp_reports')
+ Dir.mkdir('tmp_reports')
-end
\ No newline at end of file
+ system "bundle exec parallel_cucumber -n #{processes} features/ -o \'-p parallel -f json -o tmp_reports/feature$TEST_ENV_NUMBER.json \'"
+ #system "bundle exec parallel_cucumber features/ -o \"-r features -p parallel \" -n #{processes} " or exit!($?.exitstatus)
+ Rake.application.invoke_task('create_report')
+end
diff --git a/config/cucumber.yaml b/config/cucumber.yaml
new file mode 100644
index 0000000..3f262b3
--- /dev/null
+++ b/config/cucumber.yaml
@@ -0,0 +1,4 @@
+# cucumber.yml
+##YAML Template
+
+parallel: -f progress -f ParallelTests::Cucumber::FailuresLogger --out tmp_reports/cucumber_failures.log
\ No newline at end of file
diff --git a/features/aditional_parameters.feature b/features/aditional_parameters.feature
deleted file mode 100644
index 3491cb6..0000000
--- a/features/aditional_parameters.feature
+++ /dev/null
@@ -1,20 +0,0 @@
-Feature: Cover the happy path case
-
- Scenario Outline: valid Address
- When I successfully browse to the url
- | parameter | value |
- | address | |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status 'OK'
-
- Examples:
- | address_value |
- | 88+Colin+P+Kelly+Jr+St,+San+Francisco |
-
- #additional parameters
- #bounds
- #language
- #region
-
-
- #codigos
diff --git a/features/geocoding/geocoding_components_params.feature b/features/geocoding/geocoding_components_params.feature
new file mode 100644
index 0000000..1e09bfc
--- /dev/null
+++ b/features/geocoding/geocoding_components_params.feature
@@ -0,0 +1,34 @@
+@ok
+Feature: Cover the happy path case
+
+ Scenario Outline: valid components
+ When I successfully browse to the url
+ | parameter | value |
+ | components | |
+ Then I see response with status 'OK'
+ And I see result in the response
+ And I see first response formatted_address ''
+ And I see first response contains '' geographic coordinates
+
+ Examples:
+ | components_value | formatted_address | location_type | num_results |
+ | route:Annegatan | Annankatu, 00101 Helsinki, Finland | GEOMETRIC_CENTER | 1 |
+ | locality:La Palma | La Palma, CA, USA | APPROXIMATE | 1 |
+ | administrative_area:Huelva | Huelva, Spain | APPROXIMATE | 1 |
+ | postal_code:94107 | San Francisco, CA 94107, USA | APPROXIMATE | 1 |
+ | country:Spain | Spain | APPROXIMATE | 1 |
+ | locality:La Palma \|country:Spain | 30593 La Palma, Murcia, Spain | APPROXIMATE | 2 |
+ | locality:La Palma \|administrative_area:Huelva | 21700 La Palma del Condado, Huelva, Spain | APPROXIMATE | 1 |
+ | locality:La Palma \|administrative_area:Huelva \|country:Spain | 21700 La Palma del Condado, Huelva, Spain | APPROXIMATE | 1 |
+
+ Scenario: valid Address and components
+ When I successfully browse to the url
+ | parameter | value |
+ | address | 6 Mozarabes |
+ | components | administrative_area:Huelva\|postal_code:21002 |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first response contains an address_component
+ | type | attribute | value |
+ | administrative_area_level_2 | short_name | Huelva |
+ And I see first response contains 'ROOFTOP' geographic coordinates
\ No newline at end of file
diff --git a/features/geocoding/geocoding_mandatory_params.feature b/features/geocoding/geocoding_mandatory_params.feature
new file mode 100644
index 0000000..1fb4cdf
--- /dev/null
+++ b/features/geocoding/geocoding_mandatory_params.feature
@@ -0,0 +1,76 @@
+@ok
+Feature: Cover the happy path case
+
+ Scenario Outline: valid Address
+ When I successfully browse to the url
+ | parameter | value |
+ | address | |
+ Then I see response with status 'OK'
+ And I see result in the response
+ And I see first response formatted_address ''
+ And I see first response contains '' geographic coordinates
+
+ Examples:
+ | address_value | formatted_address | location_type | num_results |
+ | 88+Colin+P+Kelly+Jr+St,+San+Francisco | 88 Colin P Kelly Jr St, San Francisco, CA 94107, USA | ROOFTOP | 1 |
+ | 88 Colin P Kelly Jr St,+San Francisco | 88 Colin P Kelly Jr St, San Francisco, CA 94107, USA | ROOFTOP | 1 |
+ | 94107 | San Francisco, CA 94107, USA | APPROXIMATE | 1 |
+ | San Francisco | San Francisco, CA, USA | APPROXIMATE | 1 |
+ | 94107, San Francisco | San Francisco, CA 94107, USA | APPROXIMATE | 1 |
+ | 94107, California | San Francisco, CA 94107, USA | APPROXIMATE | 1 |
+ | Co Road 182 | Co Rd 182, Bennett, CO 80102, USA | GEOMETRIC_CENTER | 9 |
+ | Andalucia | Andalusia, Spain | APPROXIMATE | 1 |
+ | Spain A42 | A-42, Spain | GEOMETRIC_CENTER | 1 |
+ | Interstate 280 | I-280, California, USA | GEOMETRIC_CENTER | 1 |
+
+ Scenario: several responses
+ When I successfully browse to the url
+ | parameter | value |
+ | address | Calle Real |
+ | components | country:Spain |
+ And I see 'GEOMETRIC_CENTER' response contains a formatted_address 'Calle Real, San Sebastián de los Reyes, Madrid, Spain'
+ And I see all results contains an address_component
+ | type | attribute | value |
+ | country | short_name | ES |
+
+ Scenario Outline: several address
+ When I successfully browse to the url
+ | parameter | value |
+ | address | |
+ | components | administrative_area:Huelva\|country:Spain |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first response formatted_address ''
+ And I see first response contains an address_component
+ | type | attribute | value |
+ | administrative_area_level_2 | short_name | Huelva |
+ And I see first response contains 'GEOMETRIC_CENTER' geographic coordinates
+
+ Examples:
+ | address | formatted_address |
+ | calle 6 Mozarabes \| calle puerto | Calle Puerto, Huelva, Spain |
+ | calle puerto \| calle los mozarabes | Calle los Mozárabes, 21002 Huelva, Spain |
+
+ Scenario: several address
+ When I successfully browse to the url
+ | parameter | value |
+ | address | calle 6 Mozarabes |
+ | address | calle puerto |
+ | components | administrative_area:Huelva\|country:Spain |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first response formatted_address 'Huelva, Spain'
+ And I see first response contains an address_component
+ | type | attribute | value |
+ | administrative_area_level_2 | short_name | Huelva |
+ And I see first response contains 'APPROXIMATE' geographic coordinates
+
+ Scenario: region additional parameters
+ When I successfully browse to the url
+ | parameter | value |
+ | address | 1025 Los Mozarabes |
+ | components | administrative_area:Huelva\|country:Spain |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first results is partial_match
+ And I see first response formatted_address 'Calle los Mozárabes, 21002 Huelva, Spain'
diff --git a/features/geocoding/geocoding_optional_params.feature b/features/geocoding/geocoding_optional_params.feature
new file mode 100644
index 0000000..9033a0f
--- /dev/null
+++ b/features/geocoding/geocoding_optional_params.feature
@@ -0,0 +1,39 @@
+Feature: Check aditional params
+
+ Scenario: bounds additional parameters
+ When I successfully browse to the url
+ | parameter | value |
+ | address | Los Mozarabes |
+ | bounds | 37.2605085,-6.9558192\|37.2596631,-6.958557 |
+ Then I see response with status 'OK'
+ And I see 2 result in the response
+ And I see all results contains an address_component
+ | type | attribute | value |
+ | country | short_name | ES |
+
+ Scenario Outline: language additional parameters
+ When I successfully browse to the url
+ | parameter | value |
+ | address | London |
+ | language | |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first response formatted_address ''
+
+ Examples:
+ | language | formatted_address |
+ | EN | London, UK |
+ | ES | Londres, Reino Unido |
+ | IT | Londra, Regno Unito |
+ | PT | Londres, Reino Unido |
+ | FR | Londres, Royaume-Uni |
+
+ Scenario: region additional parameters
+ When I successfully browse to the url
+ | parameter | value |
+ | address | Huelva |
+ | region | es |
+ Then I see response with status 'OK'
+ And I see 1 result in the response
+ And I see first response formatted_address 'Huelva, Spain'
+ And I see first response contains 'APPROXIMATE' geographic coordinates
\ No newline at end of file
diff --git a/features/geocoding/geocoding_status_code.feature b/features/geocoding/geocoding_status_code.feature
new file mode 100644
index 0000000..ef3fade
--- /dev/null
+++ b/features/geocoding/geocoding_status_code.feature
@@ -0,0 +1,38 @@
+@status_code @ok
+Feature: Cover the happy path case
+
+ Scenario Outline: check body code
+ When I successfully browse to the url
+ | parameter | value |
+ | address | |
+ | components | |
+ Then I see response with status ''
+ And I don't see first response contains geographic coordinates
+
+ Examples:
+ | address_value | component_value | status_code |
+ | 0000000 | empty | ZERO_RESULTS |
+ | 6 Los Mozarabes | administrative_area:Lyon\|postal_code:94107 | ZERO_RESULTS |
+ | empty | administrative_area:Lyon\|postal_code:94107 | ZERO_RESULTS |
+
+ Scenario Outline: check body code
+ When I unsuccessfully browse to the url
+ | parameter | value |
+ | | |
+ | | |
+ Then I see response with status ''
+ And I don't see first response contains geographic coordinates
+ And I see response message 'Invalid request. Missing the 'address', 'bounds', 'components', 'latlng' or 'place_id' parameter.'
+
+ Examples:
+ | address_name | address_value | components_name | component_value | status_code |
+ | address | none | components | none | INVALID_REQUEST |
+ | addres | none | none | none | INVALID_REQUEST |
+ | none | none | none | none | INVALID_REQUEST |
+
+ Scenario: check body code
+ When I successfully browse to the url
+ | parameter | value |
+ | address | 6 Los Mozarabes |
+ | key | invalid_key |
+ Then I see response with status 'REQUEST_DENIED'
diff --git a/features/mandatory_parameters.feature b/features/mandatory_parameters.feature
deleted file mode 100644
index b839d09..0000000
--- a/features/mandatory_parameters.feature
+++ /dev/null
@@ -1,54 +0,0 @@
-@valid
-Feature: Cover the happy path case
-
- Scenario Outline: valid Address
- When I successfully browse to the url
- | parameter | value |
- | address | |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status 'OK'
-
- Examples:
- | address_value |
- | 88+Colin+P+Kelly+Jr+St,+San+Francisco |
- | 88 Colin P Kelly Jr St,+San Francisco |
- | 94107 |
- | San Francisco |
- | 94107, San Francisco |
- | 94107, California |
- | Co Road 82 |
- | State 82 |
- | U.S. 101 |
- | Interstate 280 |
-
- Scenario Outline: valid components
- When I successfully browse to the url
- | parameter | value |
- | components | |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status 'OK'
-
- Examples:
- | components_value |
- | route:Annegatan |
- | locality:La Palma |
- | administrative_area:Huelva |
- | postal_code:94107 |
- | country:Spain |
- | locality:La Palma \|country:Spain |
- | locality:La Palma \|administrative_area:Huelva |
- | locality:La Palma \|administrative_area:Huelva \|country:Spain |
-
- @carlos
- Scenario: valid Address and components
- When I successfully browse to the url
- | parameter | value |
- | address | 6 Mozarabes |
- | components | administrative_area:Huelva\|postal_code:21002 |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status 'OK'
- And I see response contains an address_component
- | type | attribute | value |
- | administrative_area_level_2 | short_name | Huelva |
-
-
diff --git a/features/reverse_geocoding/reverse_geocoding_mandatory_params.feature b/features/reverse_geocoding/reverse_geocoding_mandatory_params.feature
new file mode 100644
index 0000000..605b437
--- /dev/null
+++ b/features/reverse_geocoding/reverse_geocoding_mandatory_params.feature
@@ -0,0 +1,43 @@
+@ok
+Feature: reverse geolocation
+
+ Scenario: valid latlng
+ When I successfully browse to the url
+ | parameter | value |
+ | latlng | 37.78226710000001,-122.3912479 |
+ Then I see response with status 'OK'
+ And I see 'ROOFTOP' responses contains a formatted_address '88 Colin P Kelly Jr St, San Francisco, CA 94107, USA'
+ And I see all results contains an address_component
+ | type | attribute | value |
+ | administrative_area_level_1 | short_name | CA |
+ | country | short_name | US |
+
+ Scenario: valid place_id
+ When I successfully browse to the url
+ | parameter | value |
+ | place_id | ChIJd8BlQ2BZwokRAFUEcm_qrcA |
+ Then I see response with status 'OK'
+ And I see 'ROOFTOP' responses contains a formatted_address '277 Bedford Ave, Brooklyn, NY 11211, USA'
+ And I see first response contains 'ROOFTOP' geographic coordinates
+ And I see all results contains an address_component
+ | type | attribute | value |
+ | administrative_area_level_1 | short_name | NY |
+ | country | short_name | US |
+
+ Scenario: valid latlng a location_type=ROOFTOP
+ When I successfully browse to the url
+ | parameter | value |
+ | latlng | 37.78226710000001,-122.3912479 |
+ | location_type | ROOFTOP |
+ Then I see response with status 'OK'
+ And I see all results are location_type 'ROOFTOP'
+ And I see 'ROOFTOP' responses contains a formatted_address '88 Colin P Kelly Jr St, San Francisco, CA 94107, USA'
+
+ Scenario: valid latlng a location_type=ROOFTOP&result_type=street_address
+ When I successfully browse to the url
+ | parameter | value |
+ | latlng | 37.78226710000001,-122.3912479 |
+ | result_type | street_address |
+ Then I see response with status 'OK'
+ And I see all results are result_type 'street_address'
+ And I see 'ROOFTOP' responses contains a formatted_address '88 Colin P Kelly Jr St, San Francisco, CA 94107, USA'
\ No newline at end of file
diff --git a/features/reverse_geocoding/reverse_geocoding_status_code.feature b/features/reverse_geocoding/reverse_geocoding_status_code.feature
new file mode 100644
index 0000000..7b4bffb
--- /dev/null
+++ b/features/reverse_geocoding/reverse_geocoding_status_code.feature
@@ -0,0 +1,33 @@
+@ok
+Feature: reverse geolocation
+
+ Scenario Outline: TBD invalid latlng
+ When I unsuccessfully browse to the url
+ | parameter | value |
+ | latlng | , |
+ | language | EN |
+ Then I see response with status 'INVALID_REQUEST'
+ And I see response message 'Invalid request. Invalid 'latlng' parameter.'
+
+ Examples:
+ | lat | lng |
+ | 37.78226710000001N | -122.3912479N |
+ | 37.78226710000001$ | -122.3912479N$ |
+ | 37.78226710000001& | -122.3912479 |
+ | AAA | -122.3912479 |
+ | 37.78226710000001 | AAB |
+ | N37.78226710000001 | -122.3912479N |
+
+ Scenario Outline: TBD invalid place_id
+ When I unsuccessfully browse to the url
+ | parameter | value |
+ | place_id | |
+ | language | EN |
+ Then I see response with status 'INVALID_REQUEST'
+ And I see response message 'Invalid request. Invalid 'place_id' parameter.'
+
+ Examples:
+ | place_id |
+ | Invalid |
+ | Invalid Placce Id |
+ | AAAChIJd8BlQ2BZwokRAFUEcm_qrcA |
\ No newline at end of file
diff --git a/features/status_code.feature b/features/status_code.feature
deleted file mode 100644
index 6d1f648..0000000
--- a/features/status_code.feature
+++ /dev/null
@@ -1,40 +0,0 @@
-@status_code @carlos2
-Feature: Cover the happy path case
-
- Scenario Outline: check body code
- When I browse to the url
- | parameter | value |
- | address | |
- | components | |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status ''
-
- Examples:
- | answer | address_value | component_value | status_code |
- | successfully | 0000000 | empty | ZERO_RESULTS |
- | successfully | 6 Los Mozarabes | administrative_area:Lyon\|postal_code:94107 | ZERO_RESULTS |
- | successfully | empty | administrative_area:Lyon\|postal_code:94107 | ZERO_RESULTS |
- | unsuccessfully | none | none | INVALID_REQUEST |
-
- Scenario: check body code
- When I successfully browse to the url
- | parameter | value |
- | address | 6 Los Mozarabes |
- | key | invalid_key |
- Then I see response with status 'REQUEST_DENIED'
-
- @performance @pend
- Scenario: check body code
- When I launch 100 requests with
- | parameter | value |
- | address | 6 Los Mozarabes |
- | key | AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4 |
- Then I see response with status 'REQUEST_DENIED'
-
- #codigos
- #OK -> en validos
- #ZERO_RESULTS -> ok
- #OVER_QUERY_LIMITS -> mas de 50 en 1 segundo. Performance!
- #REQUEST_DENIED -> ok
- #INVALID_REQUEST -> ok. with no parameters
- #UNKNOWN_ERROR -??
diff --git a/features/step_definitions/geo_api_steps.rb b/features/step_definitions/geo_api_steps.rb
new file mode 100644
index 0000000..5963c81
--- /dev/null
+++ b/features/step_definitions/geo_api_steps.rb
@@ -0,0 +1,86 @@
+require 'httparty'
+require 'jsonpath'
+
+def pos_to_int(pos)
+ %w[last first second third fourth fifth sixth seventh eigth ninth tenth].index(pos) - 1
+end
+
+CAPTURE_POSITION = Transform(/^(last|first|second|third|fourth|fifth|sixth|seventh|eigth|ninth|tenth)$/) do |v|
+ pos_to_int(v)
+end
+
+
+When(/^I (successfully|unsuccessfully) browse to the url$/) do |status, table|
+ param_options = convertTableToHash(table, 'parameter', 'value')
+ # add key and language into parameters for request
+ param_options.store('key', KEY_PASSED) unless param_options.key?('key')
+ param_options.store('language', 'EN') unless param_options.key?('language')
+ response = HTTParty.get(URL, query: param_options)
+ response_code = response.code
+ @response_body = symb_body_resp(response)
+
+ check_response_code(status, response_code)
+end
+
+Then(/^I see response with status '(.*)'$/) do |status|
+ expect(resp_status).to eq(status)
+end
+
+Then(/^I see response message '(.*)'$/) do |status|
+ expect(resp_error_message).to eq(status)
+end
+
+Then(/^I see (#{CAPTURE_POSITION}) response contains an address_component$/) do |pos, table|
+ table.hashes.each do |row|
+ adr = address_com(pos, row['type'])
+ expect(adr.short_name).to include(row['value'])
+ end
+end
+
+Then(/^I see all results contains an address_component$/) do |table|
+ table.hashes.each do |row|
+ expect(check_in_all_respond(row['type'], row['attribute'], row['value'])).not_to include false
+ end
+end
+
+Then(/^I (see|don't see) (#{CAPTURE_POSITION}) response contains(?: '(\w+)')? geographic coordinates$/) do |option, pos, location_type|
+ if option == 'see'
+ expect(geo_coord(pos).key?(:lat)).to be true
+ expect(geo_coord(pos).key?(:lng)).to be true
+ expect(geo_coord_type(pos)).to eq(location_type)
+ else
+ expect(result_coord(pos).nil?).to be true
+ expect(result_coord(pos).nil?).to be true
+ end
+end
+
+Then(/^I (see|don't see) (#{CAPTURE_POSITION}) response formatted_address '(.*)'$/) do |option, pos, value|
+ if option == 'see'
+ expect(formateed_address(pos)).to eq(value)
+ else
+ pending
+ end
+end
+
+Then(/^I see '(.*)' response(?:s)? contains a formatted_address '(.*)'$/) do |location_type, value|
+ all_formateed_address = check_all_responses_form_addr(location_type)
+ expect(all_formateed_address).to include(value)
+end
+
+Then(/^I see (.*) result in the response$/) do |num_result|
+ expect(num_results).to eq(num_result.to_i)
+end
+
+Then(/^I see all results are result_type '(.*)'$/) do |result|
+ expect(check_all_result_types.uniq.count).to eq(1)
+ expect(check_type(check_all_result_types.uniq[0], result)).to be true
+end
+
+Then(/^I see all results are location_type '(.*)'$/) do |result|
+ expect(check_all_location_types.uniq.count).to eq(1)
+ expect(check_all_location_types.uniq[0]).to eq result
+end
+
+Then(/^I see (#{CAPTURE_POSITION}) results is partial_match$/) do |pos|
+ expect(check_parcial_match[pos]).to be true
+end
\ No newline at end of file
diff --git a/features/step_definitions/geolocation-api-steps.rb b/features/step_definitions/geolocation-api-steps.rb
deleted file mode 100644
index f44dfd1..0000000
--- a/features/step_definitions/geolocation-api-steps.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require 'httparty'
-require 'jsonpath'
-
-When /^I (successfully|unsuccessfully) browse to the url$/ do |http_status, table|
- param_options = convertTableToHash(table, 'parameter', 'value')
-
- @response = HTTParty.get(URL, query: param_options)
- response_code = @response.code
- #response = Faraday.get(URL, param_options)
- #response_code = response.status
- @response_body = symb_body_resp
- #puts @response_body
-
- check_response_code(http_status, response_code)
-end
-
-Then /^I see response with status '(.*)'$/ do |status|
- expect(get_resp_status).to eq(status)
-end
-
-Then /^I see response contains an address_component$/ do |table|
- table.hashes.each do |row|
- adr = address_com(row['type'])
- #expect(adr.row['attribute']).to include(value)
- expect(adr.short_name).to include(row['value'])
- end
-end
\ No newline at end of file
diff --git a/features/step_definitions/helpers/address_component.rb b/features/step_definitions/helpers/address_component.rb
index 8d82cfa..0768447 100644
--- a/features/step_definitions/helpers/address_component.rb
+++ b/features/step_definitions/helpers/address_component.rb
@@ -1,4 +1,5 @@
-class Address_component
+# Tengo q poner algo
+class AddressComponent
attr_accessor :long_name
attr_accessor :short_name
attr_accessor :types
@@ -6,5 +7,4 @@ class Address_component
def initialize(hash)
@long_name, @short_name, @types = hash.values_at(:long_name, :short_name, :types)
end
-
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/helpers/helper-to-be use.rb b/features/step_definitions/helpers/helper-to-be use.rb
deleted file mode 100644
index d40362f..0000000
--- a/features/step_definitions/helpers/helper-to-be use.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-def check_response_code(status, response_code)
- if status == 'successfully'
- expect(response_code).to eq(200)
- get_address_com(symb_body_resp)
- else
- expect(response_code).not_to eq(200)
- end
-end
-
-def symb_body_resp
- JSON.parse(@response.body, {symbolize_names: true})
-end
-
-def get_resp_status
- symb_body_resp[:status]
-end
-
-def get_address_com(resp_syb)
- arry_add_comp = resp_syb[:results][0][:address_components]
- @add_comp = arry_add_comp.map { |h| Address_component.new(h) }
-end
-
-#TBD
-def geometry
- symb_body_resp[:results][0][:geometry]
-end
-
-def address_com(type_value)
- #@add_comp.map {|item| item."#{field}"}
- #@add_comp.map { |item| item if item.types.include?(type_value) }.compact.first
- @add_comp.map { |item| item if check_type(item.types, type_value) }.compact.first
-
- #@add_comp[0].types.select { |str| str.include?('casa') }
- #@add_comp.map { |item| item if item.field.include?(value) }.compact.first
-end
-
-def check_type(type, value)
- type.any? {|e| e.include? value}
-end
\ No newline at end of file
diff --git a/features/step_definitions/helpers/helper_geo.rb b/features/step_definitions/helpers/helper_geo.rb
new file mode 100644
index 0000000..7a68b55
--- /dev/null
+++ b/features/step_definitions/helpers/helper_geo.rb
@@ -0,0 +1,95 @@
+def check_response_code(status, response_code)
+ if status == 'successfully'
+ expect(response_code).to eq(200)
+ else
+ expect(response_code).not_to eq(200)
+ end
+end
+
+def symb_body_resp(response)
+ JSON.parse(response.body, symbolize_names: true)
+end
+
+def resp_status
+ @response_body[:status]
+end
+
+def resp_error_message
+ @response_body[:error_message]
+end
+
+def addr_obj_from_result(result)
+ result[:address_components].map { |h| AddressComponent.new(h) }
+end
+
+def results_json
+ @response_body[:results]
+end
+
+def num_results
+ results_json.count
+end
+
+def all_obj_from_json
+ results_json.map { |result| addr_obj_from_result(result) }
+end
+
+# check if all objets in a response contains an atr:value
+def check_in_result(result, type, atr, value)
+ addr_obj_from_result(result).map { |adr| return (adr.send atr) == value if adr.types.include? type }.include? true
+end
+
+# check if all objets in all responses contains an address objet with type and atr:value
+def check_in_all_respond(type, atr, value)
+ results_json.map { |result| check_in_result(result, type, atr, value) }.uniq
+end
+
+def get_address_obj(pos)
+ arry_add_comp = @response_body[:results][pos][:address_components]
+ arry_add_comp.map { |h| AddressComponent.new(h) }
+end
+
+def geometry
+ @response_body[:results][0][:geometry]
+end
+
+def address_com(pos, type_value)
+ get_address_obj(pos).map { |item| item if check_type(item.types, type_value) }.compact.first
+end
+
+def check_type(type, value)
+ type.any? { |e| e.include? value }
+end
+
+def geo_coord(pos)
+ @response_body[:results][pos][:geometry][:location]
+end
+
+def geo_coord_type(pos)
+ check_all_location_types[pos]
+ #@response_body[:results][pos][:geometry][:location_type]
+end
+
+def result_coord(pos = 0)
+ @response_body[:results][pos]
+end
+
+def formateed_address(pos)
+ @response_body[:results][pos][:formatted_address]
+end
+
+def check_all_responses_form_addr(location_type)
+ @response_body[:results].map { |resp| resp[:formatted_address] if resp[:geometry][:location_type] == location_type }.compact
+end
+
+def check_all_result_types
+ @response_body[:results].map { |resp| resp[:types] }
+end
+
+def check_all_location_types
+ @response_body[:results].map { |resp| resp[:geometry][:location_type] }
+end
+
+def check_parcial_match
+ @response_body[:results].map { |resp| resp[:partial_match] }
+end
diff --git a/features/step_definitions/helpers/table_transform.rb b/features/step_definitions/helpers/table_transform.rb
new file mode 100644
index 0000000..17fae42
--- /dev/null
+++ b/features/step_definitions/helpers/table_transform.rb
@@ -0,0 +1,28 @@
+def convertTableToHash(table, key, value)
+ returnValue = {}
+ table.hashes.each_with_object(returnValue) do |row, result|
+ filterName = row[key.to_sym]
+ filterValue = row[value.to_sym]
+
+ # skip if filter name is nil or empty
+ next if filterName.to_s.strip.length == 0
+
+ unless filterName == 'none'
+ unless filterValue == 'none'
+ if result.key?(filterName)
+ tmp = result[filterName]
+ if tmp.is_a?(Array)
+ tmp.push(filterValue)
+ else
+ tmp = [tmp, filterValue]
+ result[filterName] = tmp
+ end
+ else
+ result[filterName] = filterValue
+ end
+ end
+ end
+ end
+
+ returnValue
+end
diff --git a/features/step_definitions/helpers/transformation.rb b/features/step_definitions/helpers/transformation.rb
deleted file mode 100644
index cb8ac01..0000000
--- a/features/step_definitions/helpers/transformation.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-def convertTableToHash(table, key, value)
- returnValue = {}
- table.hashes.each_with_object(returnValue) do |row, result|
- filterName = row[key.to_sym]
- filterValue = row[value.to_sym]
-
- # skip if filter name is nil or empty
- next if filterName.to_s.strip.length == 0
-
- unless filterValue == 'none'
- if result.has_key?(filterName)
- tmp = result[filterName];
- if (tmp.kind_of?(Array))
- tmp.push(filterValue);
- else
- tmp = [tmp, filterValue];
- result[filterName] = tmp;
- end
- else
- result[filterName] = filterValue;
- end
- end
- end
-
- returnValue
-end
\ No newline at end of file
diff --git a/features/support/env.rb b/features/support/env.rb
index 670bd7d..6cc6557 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,13 +1,6 @@
-# frozen_string_literal: true
-#require 'cucumber'
-#require 'rspec'
-#require 'rspec/core'
-#require 'httparty'
-#require 'cukeforker'
-require 'faraday'
+# store key passed in parameter or use a default one
+KEY_PASSED = ENV['key'] || 'AIzaSyDLy4-E74lM7BHFgzC189ZhAuAGWl5jcl4'
-#require_relative '../step-definitions/helpers/transformations'
-
-#URL = 'http://maps.googleapis.com/maps/api/geocode/json?address=88+Colin+P+Kelly+Jr+St,+San+Francisco,+CA&sensor=false'
+# define url of geolocation service
URL = 'https://maps.googleapis.com/maps/api/geocode/json?'
\ No newline at end of file