restassured_cli 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +3 -0
- data/bin/console +14 -0
- data/bin/restassured_cli +46 -0
- data/bin/setup +7 -0
- data/lib/restassured_cli.rb +77 -0
- data/lib/restassured_cli/createcontroller.rb +81 -0
- data/lib/restassured_cli/filenames.rb +69 -0
- data/lib/restassured_cli/source/maven/pom.xml +14 -0
- data/lib/restassured_cli/source/maven/testing/README.md +26 -0
- data/lib/restassured_cli/source/maven/testing/pom.xml +27 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/LoginTest.java +14 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/pom.xml +14 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/testng-perf-notests.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/testng-perf.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-production-tests/logback.xml +15 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-production-tests/pom.xml +21 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-production-tests/testng-production.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/SampleTest.java +30 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-ci.xml +13 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-e2e.xml +13 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-qa.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/SampleComponentTest.java +312 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/SampleServiceIntegrationTest.java +129 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-ci.xml +13 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-e2e.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-qa.xml +9 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/logback.xml +15 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/pom.xml +22 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/ci/sample.properties +0 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/default/sample.properties +2 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/e2e/sample.properties +1 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/qa/sample.properties +0 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/BaseConstant.java +48 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/InternalConfigManager.java +52 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/ServiceTestBase.java +103 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/sample/base/Constant.java +12 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/sample/base/SampleTestBase.java +15 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/Customer.java +83 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/Phone.java +31 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/SampleServiceHelper.java +8 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/sample/base/Constant.java +12 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/sample/base/SampleTestBase.java +63 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-library/pom.xml +14 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-parent-pom/pom.xml +225 -0
- data/lib/restassured_cli/source/maven/testing/sampleservice-test-runner/pom.xml +84 -0
- data/lib/restassured_cli/userinterface.rb +55 -0
- data/lib/restassured_cli/version.rb +3 -0
- data/spec/restassured_cli_spec.rb +84 -0
- data/spec/spec_helper.rb +14 -0
- metadata +141 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
# Functions to interact with end user
|
2
|
+
module Display
|
3
|
+
|
4
|
+
# Command line parsing without external library and minimal code
|
5
|
+
def Display.help
|
6
|
+
puts "Usage: restassured_cli [-f] [-p projectVersion] [-j jdkVersion] <base package> <service name>"
|
7
|
+
puts "Options"
|
8
|
+
puts " -f,--full : full option, generates sample tests"
|
9
|
+
puts " -j,--jdk : JDK version (default: 1.7)"
|
10
|
+
puts " -p,--projectVersion : project version (default: 1.0.0-SNAPSHOT)"
|
11
|
+
puts " -h,--help : display this screen"
|
12
|
+
puts "Examples"
|
13
|
+
puts " restassured_cli com.intuit.samples smallbusiness"
|
14
|
+
puts " restassured_cli -p 1.0.0 -j 1.8 -f com.intuit.samples smallbusiness"
|
15
|
+
end
|
16
|
+
|
17
|
+
# Display results
|
18
|
+
def Display.results
|
19
|
+
puts "Created project for #{$serviceName} service ..."
|
20
|
+
puts "#{$projectName}"
|
21
|
+
puts " |-- #{$serviceName}-service"
|
22
|
+
puts " | |-- src/main/java/"
|
23
|
+
puts " | |-- src/test/java/"
|
24
|
+
puts " |-- testing"
|
25
|
+
puts " |-- #{$serviceName}-perf-tests"
|
26
|
+
puts " | |-- pom.xml"
|
27
|
+
puts " | |-- jmeter/regression/"
|
28
|
+
puts " | |-- src/main/java/#{$packageName}/tests/perf/"
|
29
|
+
puts " | |-- src/main/resources/"
|
30
|
+
puts " | testng-perf.xml"
|
31
|
+
puts " |-- #{$serviceName}-production-tests"
|
32
|
+
puts " | |-- pom.xml"
|
33
|
+
puts " | |-- src/main/java/#{$packageName}/tests/production/"
|
34
|
+
puts " | |--src/main/resources/"
|
35
|
+
puts " | |-- production/"
|
36
|
+
puts " | |--testng-production.xml"
|
37
|
+
puts " |-- #{$serviceName}-service-tests"
|
38
|
+
puts " | |-- pom.xml"
|
39
|
+
puts " | |-- src/main/java/#{$packageName}/tests/service/"
|
40
|
+
puts " | |-- src/main/java/#{$packageName}/tests/serviceintegration/"
|
41
|
+
puts " | |--src/main/resources/"
|
42
|
+
puts " | |-- ci/"
|
43
|
+
puts " | |-- qa/"
|
44
|
+
puts " | |-- e2e/"
|
45
|
+
puts " | |-- testng-ci.xml"
|
46
|
+
puts " | |-- testng-qa.xml"
|
47
|
+
puts " | |--testng-e2e.xml"
|
48
|
+
puts " |-- #{$serviceName}-test-library"
|
49
|
+
puts " | |-- pom.xml"
|
50
|
+
puts " | |--src/main/java/#{$packageName}/tests/library/"
|
51
|
+
puts " |--pom.xml"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
def negativeTestData
|
4
|
+
[
|
5
|
+
["nil", "nil", {}, "Error: Base package name cannot be null"],
|
6
|
+
["com.intuit", nil, {}, "Error: Service name cannot be null"]
|
7
|
+
]
|
8
|
+
end
|
9
|
+
|
10
|
+
def pkgSvcNamesTestData
|
11
|
+
[
|
12
|
+
["com.intuit", "smallbiz", {}, "Created project for smallbiz service"]
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def pkgSvcNamesWithOptionsTestData
|
17
|
+
[
|
18
|
+
["com.intuit", "smallbusiness", {:jdkVersion => "1.8", :projectVersion => "2.0"}, "Created project for smallbusiness service"]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
describe RestAssuredCLI do
|
23
|
+
|
24
|
+
subject { RestAssuredCLI }
|
25
|
+
|
26
|
+
# Clean up - remove all directories that are successfully created
|
27
|
+
after(:context) do
|
28
|
+
begin
|
29
|
+
Dir.chdir(__dir__ + "/../")
|
30
|
+
FileUtils.rm_rf(pkgSvcNamesTestData[0][1])
|
31
|
+
FileUtils.rm_rf(pkgSvcNamesWithOptionsTestData[0][1])
|
32
|
+
rescue Exception => e
|
33
|
+
puts "Directory cannot be deleted"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#process' do
|
38
|
+
context "with negative input arguments" do
|
39
|
+
negativeTestData.each do | data |
|
40
|
+
# test data setup
|
41
|
+
let(:input) { data[0..2] }
|
42
|
+
let(:expectedOutput) { data[3] }
|
43
|
+
|
44
|
+
it "should pass negative tests" do
|
45
|
+
# test execution
|
46
|
+
result = capture(:stdout) { subject.process(input[0], input[1], input[2]) }
|
47
|
+
# test verification
|
48
|
+
expect(result).to include(expectedOutput)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "with package and service name" do
|
54
|
+
pkgSvcNamesTestData.each do | data |
|
55
|
+
# test data setup
|
56
|
+
let(:input) { data[0..2] }
|
57
|
+
let(:expectedOutput) { data[3] }
|
58
|
+
|
59
|
+
it "should pass arguments with package, service name tests" do
|
60
|
+
# test execution
|
61
|
+
result = capture(:stdout) { subject.process(input[0], input[1], input[2]) }
|
62
|
+
# test verification
|
63
|
+
expect(result).to include(expectedOutput)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "with package, service name and options" do
|
69
|
+
pkgSvcNamesWithOptionsTestData.each do | data |
|
70
|
+
# test data setup
|
71
|
+
let(:input) { data[0..2] }
|
72
|
+
let(:expectedOutput) { data[3] }
|
73
|
+
|
74
|
+
it "should pass arguments with package, service name and options tests" do
|
75
|
+
# test execution
|
76
|
+
result = capture(:stdout) { subject.process(input[0], input[1], input[2]) }
|
77
|
+
# test verification
|
78
|
+
expect(result).to include(expectedOutput)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "restassured_cli"
|
2
|
+
require "stringio"
|
3
|
+
|
4
|
+
def capture(stream)
|
5
|
+
begin
|
6
|
+
stream = stream.to_s
|
7
|
+
eval "$#{stream} = StringIO.new"
|
8
|
+
yield
|
9
|
+
result = eval("$#{stream}").string
|
10
|
+
ensure
|
11
|
+
eval("$#{stream} = #{stream.upcase}")
|
12
|
+
end
|
13
|
+
result
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: restassured_cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eing Ong
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Command line utility (CLI) to generate test projects and sample tests
|
56
|
+
for web services using RESTAssured.
|
57
|
+
email:
|
58
|
+
- EingOng@gmail.com
|
59
|
+
executables:
|
60
|
+
- restassured_cli
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/restassured_cli
|
70
|
+
- bin/setup
|
71
|
+
- lib/restassured_cli.rb
|
72
|
+
- lib/restassured_cli/createcontroller.rb
|
73
|
+
- lib/restassured_cli/filenames.rb
|
74
|
+
- lib/restassured_cli/source/maven/pom.xml
|
75
|
+
- lib/restassured_cli/source/maven/testing/README.md
|
76
|
+
- lib/restassured_cli/source/maven/testing/pom.xml
|
77
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/LoginTest.java
|
78
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/pom.xml
|
79
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/testng-perf-notests.xml
|
80
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-perf-tests/testng-perf.xml
|
81
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-production-tests/logback.xml
|
82
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-production-tests/pom.xml
|
83
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-production-tests/testng-production.xml
|
84
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/SampleTest.java
|
85
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-ci.xml
|
86
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-e2e.xml
|
87
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/default/testng-qa.xml
|
88
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/SampleComponentTest.java
|
89
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/SampleServiceIntegrationTest.java
|
90
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-ci.xml
|
91
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-e2e.xml
|
92
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/full/testng-qa.xml
|
93
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/logback.xml
|
94
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/pom.xml
|
95
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/ci/sample.properties
|
96
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/default/sample.properties
|
97
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/e2e/sample.properties
|
98
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-service-tests/resources/qa/sample.properties
|
99
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/BaseConstant.java
|
100
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/InternalConfigManager.java
|
101
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/ServiceTestBase.java
|
102
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/sample/base/Constant.java
|
103
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/default/sample/base/SampleTestBase.java
|
104
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/Customer.java
|
105
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/Phone.java
|
106
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/SampleServiceHelper.java
|
107
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/sample/base/Constant.java
|
108
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/full/sample/base/SampleTestBase.java
|
109
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-library/pom.xml
|
110
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-parent-pom/pom.xml
|
111
|
+
- lib/restassured_cli/source/maven/testing/sampleservice-test-runner/pom.xml
|
112
|
+
- lib/restassured_cli/userinterface.rb
|
113
|
+
- lib/restassured_cli/version.rb
|
114
|
+
- spec/restassured_cli_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
homepage: http://rubygems.org/gems/restassured_cli
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata:
|
120
|
+
allowed_push_host: https://rubygems.org
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.4.8
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: Command Line Utility that generates test projects using RestAssured
|
141
|
+
test_files: []
|