api-tester 0.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/push.yml +39 -0
- data/.github/workflows/test.yml +31 -0
- data/.rspec +1 -0
- data/.rubocop.yml +61 -0
- data/Gemfile +2 -0
- data/Guardfile +70 -0
- data/README.md +106 -74
- data/Rakefile +8 -3
- data/api-tester.gemspec +31 -23
- data/changelog.txt +35 -0
- data/lib/api-tester.rb +15 -0
- data/lib/api-tester/config.rb +43 -0
- data/lib/api-tester/definition/boundary_case.rb +16 -0
- data/lib/api-tester/definition/contract.rb +20 -0
- data/lib/api-tester/definition/endpoint.rb +84 -0
- data/lib/api-tester/definition/fields/array_field.rb +47 -0
- data/lib/api-tester/definition/fields/boolean_field.rb +23 -0
- data/lib/api-tester/definition/fields/email_field.rb +25 -0
- data/lib/api-tester/definition/fields/enum_field.rb +32 -0
- data/lib/api-tester/definition/fields/field.rb +50 -0
- data/lib/api-tester/definition/fields/number_field.rb +22 -0
- data/lib/api-tester/definition/fields/object_field.rb +47 -0
- data/lib/api-tester/definition/fields/plain_array_field.rb +25 -0
- data/lib/api-tester/definition/method.rb +22 -0
- data/lib/api-tester/definition/request.rb +96 -0
- data/lib/api-tester/definition/response.rb +39 -0
- data/lib/api-tester/method_case_test.rb +83 -0
- data/lib/api-tester/modules/extra_verbs.rb +53 -0
- data/lib/api-tester/modules/format.rb +47 -0
- data/lib/api-tester/modules/good_case.rb +46 -0
- data/lib/api-tester/modules/injection_module.rb +81 -0
- data/lib/api-tester/modules/required_fields.rb +51 -0
- data/lib/api-tester/modules/server_information.rb +42 -0
- data/lib/api-tester/modules/typo.rb +70 -0
- data/lib/api-tester/modules/unexpected_fields.rb +61 -0
- data/lib/api-tester/modules/unused_fields.rb +31 -0
- data/lib/api-tester/reporter/api_report.rb +47 -0
- data/lib/api-tester/reporter/missing_field_report.rb +24 -0
- data/lib/api-tester/reporter/report.rb +30 -0
- data/lib/api-tester/reporter/status_code_report.rb +21 -0
- data/lib/api-tester/test_helper.rb +12 -0
- data/lib/api-tester/util/response_evaluator.rb +88 -0
- data/lib/api-tester/util/supported_verbs.rb +39 -0
- data/lib/api-tester/version.rb +5 -0
- metadata +159 -42
- data/.travis.yml +0 -6
- data/lib/tester.rb +0 -7
- data/lib/tester/api_tester.rb +0 -50
- data/lib/tester/definition/api_contract.rb +0 -13
- data/lib/tester/definition/api_method.rb +0 -11
- data/lib/tester/definition/boundary_case.rb +0 -11
- data/lib/tester/definition/endpoint.rb +0 -57
- data/lib/tester/definition/fields/array_field.rb +0 -44
- data/lib/tester/definition/fields/boolean_field.rb +0 -18
- data/lib/tester/definition/fields/email_field.rb +0 -20
- data/lib/tester/definition/fields/enum_field.rb +0 -27
- data/lib/tester/definition/fields/field.rb +0 -47
- data/lib/tester/definition/fields/number_field.rb +0 -17
- data/lib/tester/definition/fields/object_field.rb +0 -42
- data/lib/tester/definition/request.rb +0 -49
- data/lib/tester/definition/response.rb +0 -34
- data/lib/tester/method_case_test.rb +0 -67
- data/lib/tester/modules/extra_verbs.rb +0 -25
- data/lib/tester/modules/format.rb +0 -26
- data/lib/tester/modules/good_case.rb +0 -29
- data/lib/tester/modules/module.rb +0 -18
- data/lib/tester/modules/typo.rb +0 -41
- data/lib/tester/modules/unused_fields.rb +0 -22
- data/lib/tester/reporter/api_report.rb +0 -33
- data/lib/tester/reporter/missing_field_report.rb +0 -23
- data/lib/tester/reporter/missing_response_field_report.rb +0 -19
- data/lib/tester/reporter/report.rb +0 -25
- data/lib/tester/reporter/status_code_report.rb +0 -12
- data/lib/tester/test_helper.rb +0 -10
- data/lib/tester/util/response_evaluator.rb +0 -73
- data/lib/tester/util/supported_verbs.rb +0 -34
- data/lib/tester/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f8866f2783c0595b22817fbd6fbaaab7a77531bf55358a50f6e0b3a62fec22a
|
4
|
+
data.tar.gz: 7aa5c6d1d261f322a8190781b62b3bc235641a7c0eec625afb1f9a9900cb4abe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52da12901f51389ca9a4fb37d775aa8974e7514571d900fcbcfb660b6174f8251d42f6a0bb7fa9b23b3d61b01d64aa7c116c2128badf7390e2dfe106e8703ec3
|
7
|
+
data.tar.gz: 8ae063b4473b4f1fb75ceb203dc569f0e8cc16b8e9963f434bd85aad1c618daecfff77caf4a93d876b7af24cf037118635351ac98bbf82af1491b012c5c5804f
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Set update schedule for GitHub Actions
|
2
|
+
|
3
|
+
version: 2
|
4
|
+
updates:
|
5
|
+
|
6
|
+
- package-ecosystem: "github-actions"
|
7
|
+
directory: "/"
|
8
|
+
schedule:
|
9
|
+
# Check for updates to GitHub Actions every weekday
|
10
|
+
interval: "daily"
|
11
|
+
|
12
|
+
- package-ecosystem: "bundler"
|
13
|
+
directory: '/'
|
14
|
+
schedule:
|
15
|
+
interval: 'daily'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
name: Build + Publish
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby 2.6
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.6.x
|
17
|
+
|
18
|
+
- name: Publish to RubyGems
|
19
|
+
run: |
|
20
|
+
mkdir -p $HOME/.gem
|
21
|
+
touch $HOME/.gem/credentials
|
22
|
+
chmod 0600 $HOME/.gem/credentials
|
23
|
+
printf -- "---\n:rubygems: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
24
|
+
gem build *.gemspec
|
25
|
+
gem push --KEY rubygems --host https://rubygems.org *.gem
|
26
|
+
env:
|
27
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
28
|
+
|
29
|
+
- name: Publish to GPR
|
30
|
+
run: |
|
31
|
+
mkdir -p $HOME/.gem
|
32
|
+
touch $HOME/.gem/credentials
|
33
|
+
chmod 0600 $HOME/.gem/credentials
|
34
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
35
|
+
gem build *.gemspec
|
36
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
37
|
+
env:
|
38
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
39
|
+
OWNER: ${{ github.repository_owner }}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Test
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
21
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
22
|
+
# uses: ruby/setup-ruby@v1
|
23
|
+
uses: ruby/setup-ruby@a195098f6b1e9074390215a49c1c14e82151a289
|
24
|
+
with:
|
25
|
+
ruby-version: 2.6
|
26
|
+
- name: Install dependencies
|
27
|
+
run: bundle install
|
28
|
+
- name: Run lint
|
29
|
+
run: bundle exec rake rubocop
|
30
|
+
- name: Run tests
|
31
|
+
run: bundle exec rake spec
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'Guardfile'
|
4
|
+
- '*.gemspec'
|
5
|
+
- 'Rakefile'
|
6
|
+
- '**/*.rake'
|
7
|
+
- 'bin/*'
|
8
|
+
|
9
|
+
Metrics/BlockLength:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Metrics/LineLength:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Metrics/ParameterLists:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Naming/PredicateName:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/IfUnlessModifier:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/NilComparison:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/NumericPredicate:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/MultipleComparison:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/PerceivedComplexity:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/CyclomaticComplexity:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/BlockDelimiters:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/EmptyLiteral:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Lint/BooleanSymbol:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/GuardClause:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Naming/FileName:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/FrozenStringLiteralComment:
|
61
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
end
|
70
|
+
end
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Api::Tester
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/api-tester.svg)](https://badge.fury.io/rb/api-tester)
|
3
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/araneforseti/api-tester/workflows/Test/badge.svg)](https://github.com/araneforseti/api-tester/actions?query=workflow%3ATest+branch%3Amaster)
|
4
5
|
|
5
6
|
Work in Progress! Use at own risk, definitely not ready
|
6
7
|
for prime time! To isolate your project from the changes, be sure to specify which gem version you use.
|
@@ -8,114 +9,96 @@ for prime time! To isolate your project from the changes, be sure to specify whi
|
|
8
9
|
This gem is intended to enable easy creation of tests for
|
9
10
|
RESTful API services when given a contract.
|
10
11
|
|
11
|
-
|
12
|
+
When using, be sure to follow the documentation for the version of the gem you use. The documentation below
|
13
|
+
relates to the unpublished gem version actively under development
|
12
14
|
|
13
|
-
|
14
|
-
## Under Development
|
15
|
-
Check out our [Trello Board](https://trello.com/b/R3RtsJ2A/api-tester) to see progress and where we are headed!
|
16
|
-
Feel free to leave feedback through github's issue tracker
|
17
|
-
|
18
|
-
- Format module:
|
19
|
-
- Checks syntax problems with the request and
|
20
|
-
ensuring a consistent response
|
21
|
-
- Typo module:
|
22
|
-
- Tests simulates typos in the url
|
23
|
-
- Extra Verbs module:
|
24
|
-
- Checks all the supported verbs to ensure no vulnerabilities are exposed
|
25
|
-
- Good Case (name pending) module:
|
26
|
-
- Checks expected good requests will work
|
27
|
-
(eg, number field should accept integers
|
28
|
-
between 1 - 100)
|
29
|
-
- Unused Fields module:
|
30
|
-
- A module which runs after all the others and reports on any response fields which were never returned
|
31
|
-
|
32
|
-
## Intended Features Before "Release"
|
15
|
+
Check out [API Tester Example](https://github.com/araneforseti/example_api-tester) for an example in action
|
33
16
|
|
34
|
-
|
35
|
-
- Path params
|
36
|
-
- Query
|
37
|
-
- Headers
|
38
|
-
- Endpoint Testing
|
39
|
-
- Unused Response Fields
|
40
|
-
- Invalid method names
|
41
|
-
- Invalid method types
|
42
|
-
- Documentation
|
43
|
-
- Generate Swagger-compliant documentation
|
44
|
-
- Generate definitions from Swagger documentation
|
17
|
+
## Out of Project Scope
|
45
18
|
|
46
|
-
|
19
|
+
- Logic testing (eg, if X is between A and B, then Y is required)
|
47
20
|
|
48
|
-
|
49
|
-
required)
|
21
|
+
## Usage
|
50
22
|
|
51
|
-
|
52
|
-
## Installation
|
23
|
+
### Installation
|
53
24
|
|
54
25
|
Add this line to your application's Gemfile (Note: specify your version due to gem's currently volatile nature):
|
55
26
|
|
56
27
|
```ruby
|
57
|
-
gem 'api-tester', '0.0
|
28
|
+
gem 'api-tester', '1.0.0'
|
58
29
|
```
|
59
30
|
|
60
31
|
And then execute:
|
61
32
|
|
62
|
-
|
33
|
+
bundle
|
63
34
|
|
64
35
|
Or install it yourself as:
|
65
36
|
|
66
|
-
|
37
|
+
gem install api-tester
|
67
38
|
|
68
|
-
|
39
|
+
### Usage in Code
|
69
40
|
|
70
41
|
Warning: This gem is still in alpha stage. Use at own risk
|
71
42
|
understanding the contract will change until the first
|
72
43
|
stable release
|
73
44
|
|
74
45
|
Define your contract and endpoints using
|
46
|
+
|
75
47
|
```ruby
|
76
|
-
require 'tester/definition/
|
77
|
-
require 'tester/definition/endpoint'
|
78
|
-
contract =
|
79
|
-
endpoint = Endpoint.new "Some name which is currently unused", "
|
48
|
+
require 'api-tester/definition/contract'
|
49
|
+
require 'api-tester/definition/endpoint'
|
50
|
+
contract = ApiTester::Contract.new "API Name", "http://yourbase.com/api"
|
51
|
+
endpoint = ApiTester::Endpoint.new "Some name which is currently unused", "/endpoint"
|
80
52
|
```
|
81
53
|
|
82
54
|
Define methods on endpoints
|
83
55
|
|
84
56
|
```ruby
|
85
|
-
endpoint.add_method SupportedVerbs::GET, expected_response, expected_request
|
57
|
+
endpoint.add_method ApiTester::SupportedVerbs::GET, expected_response, expected_request
|
86
58
|
```
|
87
|
-
|
59
|
+
|
60
|
+
Note: While an extensive list of verbs exists in ApiTester::SupportedVerbs, you can define your own (with the caveat they have to be supported by RestClient)
|
88
61
|
|
89
62
|
Define fields used by the method (both Request and Response)
|
63
|
+
|
90
64
|
```ruby
|
91
|
-
expected_request = Request.new.add_field(Field.new "fieldName")
|
65
|
+
expected_request = Request.new.add_field(ApiTester::Field.new "fieldName")
|
92
66
|
```
|
67
|
+
|
93
68
|
Note: Similar to methods, you can create your own fields.
|
94
|
-
They need to
|
69
|
+
They need to respond to:
|
70
|
+
|
95
71
|
```ruby
|
96
72
|
field.has_subfields?
|
97
73
|
values_array = field.negative_boundary_values
|
98
74
|
```
|
99
75
|
|
76
|
+
Define which modules you want to use through a config
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
config = ApiTester::Config().with_module(Format)
|
80
|
+
```
|
81
|
+
|
100
82
|
Put them together and call go and off you go!
|
83
|
+
|
101
84
|
```ruby
|
102
|
-
request = Request.new.add_field(Field.new "fieldName")
|
103
|
-
expected_response = Response.new(200).add_field(Field.new "fieldName")
|
104
|
-
endpoint = Endpoint.new "Unused Name", "
|
105
|
-
endpoint.add_method SupportedVerbs::GET, expected_response, request
|
106
|
-
contract =
|
85
|
+
request = ApiTester::Request.new.add_field(ApiTester::Field.new "fieldName")
|
86
|
+
expected_response = ApiTester::Response.new(200).add_field(ApiTester::Field.new "fieldName")
|
87
|
+
endpoint = ApiTester::Endpoint.new "Unused Name", "/endpoint"
|
88
|
+
endpoint.add_method ApiTester::SupportedVerbs::GET, expected_response, request
|
89
|
+
contract = Contract.new "API Name", "http://yourbase.com/api"
|
107
90
|
contract.add_endpoint endpoint
|
108
|
-
|
109
|
-
expect(
|
91
|
+
config = ApiTester::Config().with_module(Format)
|
92
|
+
expect(ApiTester.go(contract, config)).to be true
|
110
93
|
|
111
94
|
```
|
112
95
|
|
113
|
-
|
96
|
+
### Dependencies
|
114
97
|
|
115
98
|
If any of your API endpoints have some setup which needs to happen before or after each call (eg, path param represents resource which needs to be created), you can use the TestHelper interface:
|
116
99
|
|
117
100
|
```ruby
|
118
|
-
class InfoCreator < TestHelper
|
101
|
+
class InfoCreator < ApiTester::TestHelper
|
119
102
|
def before
|
120
103
|
puts "This code runs before every call"
|
121
104
|
end
|
@@ -129,48 +112,86 @@ class InfoCreator < TestHelper
|
|
129
112
|
end
|
130
113
|
end
|
131
114
|
|
132
|
-
endpoint = Endpoint.new "Endpoint Name", "www.endpoint-url.com"
|
115
|
+
endpoint = ApiTester::Endpoint.new "Endpoint Name", "www.endpoint-url.com"
|
133
116
|
endpoint.test_helper = InfoCreator.new
|
134
117
|
expect(tester.go).to be true
|
135
118
|
```
|
136
119
|
|
137
|
-
|
138
|
-
|
120
|
+
## Modules
|
121
|
+
|
122
|
+
### Boundary
|
123
|
+
|
139
124
|
This module will test out various edge cases and
|
140
125
|
ensure error handling is consistent
|
141
126
|
|
142
|
-
|
127
|
+
### Good Case
|
128
|
+
|
143
129
|
This module ensures your 'default request' works
|
144
130
|
appropriately
|
145
131
|
|
146
|
-
|
132
|
+
### Typo
|
133
|
+
|
147
134
|
This module checks for common integration issues when an
|
148
135
|
API is first being worked against such as urls which don't
|
149
136
|
exist
|
150
137
|
|
151
|
-
|
138
|
+
### Extra Verbs
|
139
|
+
|
152
140
|
This module checks to ensure consistency in response when
|
153
141
|
the api receives verbs it doesn't explicitly support
|
154
142
|
|
155
|
-
|
143
|
+
### Unused Fields
|
144
|
+
|
156
145
|
If any response fields are not returned during tests run
|
157
146
|
by previous modules, this will fail with a report
|
158
147
|
detailing unreturned response fields. When using this
|
159
148
|
module, it is recommended the good case module is also
|
160
149
|
used.
|
161
150
|
|
162
|
-
|
151
|
+
### Required Fields
|
152
|
+
|
153
|
+
This module tests out all the various invalid combinations of required fields to ensure consistent response
|
154
|
+
|
155
|
+
### Unexpected Fields
|
156
|
+
|
157
|
+
This module calls out if the API returns anything unexpected in its response
|
158
|
+
|
159
|
+
### Custom Modules
|
160
|
+
|
161
|
+
Do you want to do something with the definition which this gem currently does not support?
|
162
|
+
You can create your own test module and add it to the config instance class!
|
163
|
+
Just make sure it adheres to the following interface:
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
module CustomModule
|
167
|
+
def self.go contract
|
168
|
+
# Your test code here
|
169
|
+
# the contract object is the full definition created
|
170
|
+
end
|
171
|
+
|
172
|
+
def self.order
|
173
|
+
# If your module needs to run first, put 0, if last, put 100.
|
174
|
+
# Otherwise this can just be any number
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
config.with_module(CustomModule)
|
179
|
+
```
|
180
|
+
|
181
|
+
## Reporting
|
182
|
+
|
163
183
|
Right now the default reporting mechanism prints out to
|
164
184
|
the console all the issues which were found. You can
|
165
185
|
create your own reporting class (so long as it responds
|
166
186
|
to the same methods) or just extend the current one and
|
167
|
-
override the print method. Then set the
|
168
|
-
tool:
|
187
|
+
override the print method. Then set the report
|
188
|
+
tool in the config:
|
189
|
+
|
169
190
|
```ruby
|
170
|
-
|
191
|
+
config.with_reporter(new_reporter)
|
171
192
|
```
|
172
193
|
|
173
|
-
|
194
|
+
## Development
|
174
195
|
|
175
196
|
After checking out the repo, run `bin/setup` to install
|
176
197
|
dependencies. Then, run `rake spec` to run the tests.
|
@@ -182,11 +203,22 @@ run `bundle exec rake install`.
|
|
182
203
|
|
183
204
|
## Contributing
|
184
205
|
|
185
|
-
Bug reports and pull requests are welcome on GitHub
|
186
|
-
https://github.com/araneforseti/api-tester.
|
206
|
+
Bug reports and pull requests are welcome on [GitHub repo](https://github.com/araneforseti/api-tester).
|
187
207
|
|
208
|
+
## Future Features Under Development
|
209
|
+
|
210
|
+
Check out our [Trello Board](https://trello.com/b/R3RtsJ2A/api-tester) to see progress and where we are headed!
|
211
|
+
Feel free to leave feedback through Github's issue tracker
|
212
|
+
|
213
|
+
- Other Param Testing
|
214
|
+
- Path params
|
215
|
+
- Query
|
216
|
+
- Headers
|
217
|
+
- Documentation
|
218
|
+
- Generate Swagger-compliant documentation
|
219
|
+
- Generate definitions from Swagger documentation
|
188
220
|
|
189
|
-
|
221
|
+
## License
|
190
222
|
|
191
223
|
The gem is available as open source under the terms
|
192
224
|
of the [MIT License](http://opensource.org/licenses/MIT).
|