polytrix 0.1.0.pre → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -2
- data/.travis.yml +2 -1
- data/Gemfile +1 -0
- data/README.md +190 -98
- data/Rakefile +8 -6
- data/bin/polytrix +2 -1
- data/docs/samples/code2doc/java/HelloWorld.md +4 -0
- data/docs/samples/code2doc/java/Quine.md +2 -0
- data/docs/samples/code2doc/python/hello_world.md +2 -0
- data/docs/samples/code2doc/python/quine.md +2 -0
- data/docs/samples/code2doc/ruby/hello_world.md +4 -0
- data/features/bootstrapping.feature +36 -0
- data/features/cloning.feature +34 -0
- data/features/execution.feature +2 -16
- data/features/fixtures/configs/empty.yml +12 -1
- data/features/fixtures/configs/hello_world.yml +11 -1
- data/features/fixtures/spec/polytrix_spec.rb +1 -4
- data/features/solo.feature +12 -0
- data/features/states.feature +40 -0
- data/features/step_definitions/sdk_steps.rb +11 -1
- data/features/support/env.rb +2 -1
- data/lib/polytrix/challenge.rb +211 -13
- data/lib/polytrix/challenge_result.rb +9 -0
- data/lib/polytrix/challenge_runner.rb +4 -11
- data/lib/polytrix/challenges.rb +16 -0
- data/lib/polytrix/cli/report.rb +0 -4
- data/lib/polytrix/cli.rb +229 -137
- data/lib/polytrix/color.rb +40 -0
- data/lib/polytrix/command/action.rb +26 -0
- data/lib/polytrix/command/list.rb +53 -0
- data/lib/polytrix/command/rundoc.rb +27 -0
- data/lib/polytrix/command/test.rb +24 -0
- data/lib/polytrix/command.rb +209 -0
- data/lib/polytrix/configuration.rb +30 -40
- data/lib/polytrix/core/file_system_helper.rb +2 -5
- data/lib/polytrix/core/hashie.rb +14 -0
- data/lib/polytrix/core/implementor.rb +52 -12
- data/lib/polytrix/core/manifest_section.rb +4 -0
- data/lib/polytrix/core/string_helpers.rb +15 -0
- data/lib/polytrix/documentation/helpers/code_helper.rb +3 -1
- data/lib/polytrix/error.rb +209 -0
- data/lib/polytrix/logger.rb +365 -8
- data/lib/polytrix/logging.rb +34 -0
- data/lib/polytrix/manifest.rb +40 -26
- data/lib/polytrix/result.rb +1 -0
- data/lib/polytrix/rspec.rb +7 -5
- data/lib/polytrix/runners/buff_shellout_executor.rb +19 -0
- data/lib/polytrix/runners/executor.rb +32 -0
- data/lib/polytrix/runners/mixlib_shellout_executor.rb +83 -0
- data/lib/polytrix/state_file.rb +60 -0
- data/lib/polytrix/util.rb +155 -0
- data/lib/polytrix/validation.rb +1 -1
- data/lib/polytrix/validator.rb +9 -5
- data/lib/polytrix/version.rb +1 -1
- data/lib/polytrix.rb +55 -33
- data/polytrix.gemspec +4 -2
- data/polytrix.rb +0 -5
- data/{polytrix_tests.yml → polytrix.yml} +5 -0
- data/samples/default_bootstrap.rb +0 -7
- data/samples/polytrix.rb +0 -9
- data/samples/{polytrix_tests.yml → polytrix.yml} +11 -0
- data/samples/polytrix_cli.sh +1 -1
- data/spec/fabricators/implementor_fabricator.rb +20 -0
- data/spec/fabricators/manifest_fabricator.rb +4 -1
- data/spec/fixtures/{polytrix_tests.yml → polytrix.yml} +10 -0
- data/spec/polytrix/challenge_runner_spec.rb +3 -2
- data/spec/polytrix/challenge_spec.rb +5 -4
- data/spec/polytrix/cli_spec.rb +23 -26
- data/spec/polytrix/configuration_spec.rb +4 -43
- data/spec/polytrix/documentation/helpers/code_helper_spec.rb +1 -1
- data/spec/polytrix/documentation_generator_spec.rb +2 -0
- data/spec/polytrix/implementor_spec.rb +44 -2
- data/spec/polytrix/manifest_spec.rb +7 -4
- data/spec/polytrix_spec.rb +9 -11
- data/spec/thor_spy.rb +2 -0
- metadata +66 -16
- data/features/fixtures/spec/polytrix_merge.rb +0 -5
- data/features/reporting.feature +0 -140
- data/lib/polytrix/executor.rb +0 -89
- data/samples/sdks/custom/polytrix.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57453fe422a3e27d1aaa87f79689d05c8aa9bcc0
|
4
|
+
data.tar.gz: b3fd502c953d29fba9948eb12053b1341d1ce15b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad963f3478969e5d44cfce5f10e652d94acaa488a9fe5969c377f0ca1133325c022201e211338be5d1b9917664ccdef702b307564cd9258e621d62ca26050c7
|
7
|
+
data.tar.gz: 80e47b9677116fbc2652dc38a54ab0979bc11b10a00cffee865a1026a3bb1609763464a1a67d455714ec3832df1cac33f9676dbae827f309a54d1e4164900d4a
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
before_install:
|
2
|
-
- sudo add-apt-repository ppa:cwchien/gradle
|
2
|
+
- sudo add-apt-repository -y ppa:cwchien/gradle
|
3
3
|
- sudo apt-get update -qq
|
4
4
|
- sudo apt-get install -qq gradle
|
5
5
|
rvm:
|
6
6
|
- 1.9.3
|
7
7
|
- 2.0.0
|
8
8
|
- 2.1.0
|
9
|
+
- jruby
|
9
10
|
allow_failures:
|
10
11
|
rvm:
|
11
12
|
- 1.9.3 # YAML formatting differs
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,139 +1,231 @@
|
|
1
1
|
# Polytrix - the Polyglot Testing Matrix
|
2
2
|
|
3
|
-
Polytrix is a polyglot test runner and documentation generator. It aims to let you run sample code written in any language. It's especially useful if you want to run similar code samples in multiple languages
|
3
|
+
Polytrix is a polyglot test runner and documentation generator. It aims to let you run sample code written in any language. It's especially useful if you want to run similar code samples in multiple languages, a project that has been ported to several languages, or API clients for the same service that are provided in several languages.
|
4
4
|
|
5
|
-
|
5
|
+
Polytrix was influenced by a number of polyglot projects, including [Travis-CI](travis-ci.org), [Docco](https://github.com/jashkenas/docco), [Slate](https://github.com/tripit/slate), and polyglot test-suites like the [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) and the [JSON-LD Test Suite](http://json-ld.org/test-suite/).
|
6
6
|
|
7
|
-
|
8
|
-
- Run sample code in any language and several platforms
|
9
|
-
- Perform compatibility testing checking multiple implementations (in different langauges) against the same set of assertions
|
10
|
-
- Generate documentation from sample code and test results
|
11
|
-
- Generate compatibility or feature matrix reports
|
7
|
+
The user-experience was heavily influenced by [test-kitchen](http://kitchen.ci/). Polytrix aims to do for multi-language development of command-line applications what test-kitchen has done for multi-platform development of infrastructure.
|
12
8
|
|
13
|
-
|
9
|
+
## Installing Polytrix
|
14
10
|
|
15
|
-
|
11
|
+
Polytrix is distributed as a Ruby Gem. It should be installed using Bundler by adding this line to your Gemfile:
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
require 'polytrix/rspec'
|
21
|
-
|
22
|
-
Polytrix.implementors = Dir['sdks/*'].map{ |sdk|
|
23
|
-
name = File.basename(sdk)
|
24
|
-
Polytrix::Implementor.new :name => name
|
25
|
-
}
|
26
|
-
|
27
|
-
Polytrix.load_manifest 'polytrix_tests.yml'
|
28
|
-
Polytrix.bootstrap
|
29
|
-
Polytrix.run_tests
|
13
|
+
```shell
|
14
|
+
gem 'polytrix', '~> 0.1'
|
30
15
|
```
|
31
16
|
|
32
|
-
|
17
|
+
And then running `bundle install`.
|
33
18
|
|
34
|
-
|
19
|
+
It can also be installed without Bundler by running `gem install polytrix`.
|
35
20
|
|
36
|
-
|
37
|
-
$ # Only run tests for the Java implementor
|
38
|
-
$ bundle exec rspec -t java
|
39
|
-
$ # Run the "hello world" tests in each language
|
40
|
-
$ bundle exec rspec -e "hello world"
|
41
|
-
```
|
21
|
+
## Getting Help
|
42
22
|
|
43
|
-
|
23
|
+
Polytrix is primarily intented to be run as a standalone utility, though it does have an API for integrating with RSpec or other Ruby-based test frameworks.
|
44
24
|
|
45
|
-
|
25
|
+
Note: You may need to prefix commands with `bundle exec` if you installed Polytrix using Bundler.
|
46
26
|
|
47
|
-
|
27
|
+
If you need a quick reminder of what the `polytrix` command gives you, then use the **help** subcommand:
|
48
28
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
29
|
+
```
|
30
|
+
$ bundle exec polytrix help
|
31
|
+
Commands:s
|
32
|
+
polytrix bootstrap [(all|<REGEX>)] [opts] # Bootstraps the code samples for one or more tests
|
33
|
+
polytrix code2doc [(all|<REGEX>)] [opts] # Converts annotated code samples to Markdown or reStructuredText
|
34
|
+
polytrix clean [(all|<REGEX>)] [opts] # Removes test results for one or more tests
|
35
|
+
polytrix clone [(all|<REGEX>)] [opts] # Clones the code samples from git for one or more tests
|
36
|
+
polytrix exec [(all|<REGEX>)] [opts] # Executes code samples for one or more tests
|
37
|
+
polytrix help [COMMAND] # Describe available commands or one specific command
|
38
|
+
polytrix list [(all|<REGEX>)] [opts] # List all tests
|
39
|
+
polytrix test [all|<REGEX>)] [opts] # Test one or more tests
|
40
|
+
polytrix verify [(all|<REGEX>)] [opts] # Verify the execution results of one or more tests
|
41
|
+
polytrix version # Print Polytrix's version information
|
55
42
|
```
|
56
43
|
|
57
|
-
|
58
|
-
|
59
|
-
#### Bootstrapping, compiling, wrapper scripts
|
44
|
+
## The polytrix.yml file
|
60
45
|
|
61
|
-
Polytrix
|
46
|
+
The Polytrix test suites and the implementors that should be tested are defined in a polytrix.yml file.
|
47
|
+
A basic file looks like this:
|
62
48
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
49
|
+
```yaml
|
50
|
+
polytrix:
|
51
|
+
implementors:
|
52
|
+
ruby_samples:
|
53
|
+
language: ruby
|
54
|
+
bootstrap_cmd: bundle install
|
55
|
+
exec_cmd: bundle exec ruby
|
56
|
+
git:
|
57
|
+
repo: https://github.com/polytrix/ruby_samples
|
58
|
+
python_samples:
|
59
|
+
language: python
|
60
|
+
bootstrap_script: scripts/pip_install
|
61
|
+
exec_script: scripts/pip_install
|
62
|
+
git:
|
63
|
+
repo: https://github.com/polytrix/python_samples
|
64
|
+
java_samples:
|
65
|
+
language: java
|
66
|
+
# The default is to look for scripts/bootstrap and scripts/exec
|
67
|
+
# or try to use the default bootstrap/exec behavior for the language
|
68
|
+
git:
|
69
|
+
repo: 'https://github.com/polytrix/java_samples'
|
70
|
+
|
71
|
+
suites:
|
72
|
+
katas:
|
73
|
+
code_samples:
|
74
|
+
hello_world:
|
75
|
+
- validate:
|
76
|
+
stdout: Hello, World!
|
77
|
+
quine:
|
78
|
+
- validate:
|
79
|
+
quine_validator: true
|
80
|
+
utilities:
|
81
|
+
code_samples:
|
82
|
+
word_count:
|
83
|
+
- name: short text
|
84
|
+
input: |
|
85
|
+
I am a word count utility
|
86
|
+
validate:
|
87
|
+
stdout: 6 words
|
88
|
+
- name: small file
|
89
|
+
input_file: fixtures/small_file.txt
|
90
|
+
validate:
|
91
|
+
stdout: 10 words
|
92
|
+
- name: large file
|
93
|
+
input_file: fixtures/large_file.txt
|
94
|
+
validate:
|
95
|
+
stdout: 1000 words
|
96
|
+
```
|
67
97
|
|
68
|
-
|
98
|
+
### Defining Implementors
|
99
|
+
|
100
|
+
Polytrix tests scenarios across one or more implementors. The implementors may each be in a different
|
101
|
+
language, but you can also have multiple implementors for the same langauge. The structure used to define implementors within polytrix.yml is described below.
|
102
|
+
|
103
|
+
#### Implementor Object
|
104
|
+
|
105
|
+
Field Name | Type | Description
|
106
|
+
---|:---:|---
|
107
|
+
<a name="implementor_name"/>name | `string` | The name of the implementor. (*If omitted, this attribute’s value defaults to the key name associated with this object.*)
|
108
|
+
<a name="implementor_directory"/>directory | `string` | The location of the implementor project containing code samples.
|
109
|
+
<a name="implementor_language"/>language | `string` | The primary programming language of the code samples in this implementor.
|
110
|
+
<a name="implementor_git"/>git | [Git Object](#git_object) | Defines how to clone the project via Git.
|
111
|
+
<a name="implementor_scripts"/>scripts | [Scripts Object](#scripts_object) | Defines scripts to bootstrap, compile, and execute the samples.
|
112
|
+
|
113
|
+
#### Git Object
|
114
|
+
<a name="git_object"/>Field Name | Type | Description
|
115
|
+
---|:---:|---
|
116
|
+
<a name="git_repo"/>repo | `string` | **Required.** The git repo to clone.
|
117
|
+
<a name="git_branch"/>branch | `string` | The git branch to clone.
|
118
|
+
<a name="git_to"/>to | `string` | The local directory to clone into.
|
119
|
+
|
120
|
+
#### Scripts Object
|
121
|
+
<a name="scripts_object"/>Field Name | Type | Description
|
122
|
+
---|:---:|---
|
123
|
+
<a name="directory"/>directory | `directory` | The directory that contains the script files. **Default**: `scripts/`.
|
124
|
+
<a name="bootstrap_script"/>bootstrap_script | `file` | The file to execute to bootstrap the samples. **Default**: `bootstrap`
|
125
|
+
<a name="compile_script"/>compile_script | `file` | The file to execute to compile the samples. **Default**: `compile`
|
126
|
+
<a name="exec_script"/>exec_script | `file` | The file to use as an execute wrapper script for running samples. **Default**: `exec`
|
127
|
+
<a name="bootstrap_cmd"/>bootstrap_cmd | `string` | An inline script to execute instead of executing *bootstrap_file*.
|
128
|
+
<a name="compile_cmd"/>compile_cmd | `string` | An inline script to execute instead of executing *bootstrap_file*.
|
129
|
+
<a name="exec_cmd"/>exec_cmd | `string` | An inline script to use as an execution wrapper, instead of searching for a `exec` script.
|
130
|
+
|
131
|
+
#### Example Implementor Definition
|
69
132
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
133
|
+
```yaml
|
134
|
+
implementors:
|
135
|
+
ruby_samples:
|
136
|
+
directory: samples/ruby
|
137
|
+
language: ruby
|
138
|
+
git:
|
139
|
+
repo: https://github.com/polytrix/ruby_samples
|
140
|
+
branch: master
|
141
|
+
to: samples/ruby
|
142
|
+
scripts:
|
143
|
+
bootstrap_cmd: bundle install
|
144
|
+
exec_cmd: bundle exec ruby "$@"
|
74
145
|
```
|
75
146
|
|
76
|
-
###
|
147
|
+
### Attaching Code Samples
|
77
148
|
|
78
|
-
|
149
|
+
Polytrix tests are divided into suites, code samples, and scenarios. Each tuple (suite, code sample, scenario) is a test.
|
79
150
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
global_env: # global_env defines input available for all scenarios
|
84
|
-
LOCALE: <%= ENV['LANG'] %> # templating is allowed
|
85
|
-
FAVORITE_NUMBER: 5
|
86
|
-
suites: # suites defines the test suites that can be executed
|
87
|
-
Katas: # "Katas" is the name of the first suite
|
88
|
-
env: # These "env" values are only available within the "Katas" suite
|
89
|
-
NAME: 'Max'
|
90
|
-
samples: # samples defines the individual tests in a suite
|
91
|
-
- hello world
|
92
|
-
- quine
|
93
|
-
Tutorials: # "Tutorials" is the name of the second suite
|
94
|
-
env:
|
95
|
-
samples:
|
96
|
-
- deploying
|
97
|
-
- documenting
|
98
|
-
```
|
151
|
+
The structure used to define tests is:
|
152
|
+
|
153
|
+
#### Suite Object
|
99
154
|
|
100
|
-
|
155
|
+
Field Name | Type | Description
|
156
|
+
---|:---:|---
|
157
|
+
<a name="suite_name"/>name | `string` | The name of the suite. (*If omitted, this attribute’s value defaults to hash key associated with this object.*)
|
158
|
+
<a name="suite_input"/>input | `string` | The content to send to the code sample as standard input.
|
159
|
+
<a name="suite_input_file"/>input_file | `file` | Reads the specified file and sets *input*.
|
160
|
+
<a name="code_samples"/>code_samples | Hash of [Code Samples](#code_samples) | Defines the code samples to test
|
101
161
|
|
102
|
-
|
162
|
+
#### Code Sample Object
|
103
163
|
|
104
|
-
|
164
|
+
The code sample object determines which scenario to runwhich determines which code sample will be run. It can also
|
165
|
+
override the default values set in the Suite Object.
|
105
166
|
|
106
|
-
|
167
|
+
If the Scenario Object is a list, it will be automatically split into distinct but related scenarios. This is useful
|
168
|
+
for testing the same code sample with a variety of different input values.
|
107
169
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
170
|
+
Field Name | Type | Description
|
171
|
+
---|:---:|---
|
172
|
+
<a name="code_sample_name"/>name | `string` | The name of the suite. (*If omitted, this attribute’s value defaults to hash key associated with this object.*)
|
173
|
+
<a name="scenarios"/>scenarios | List of [Scenario Objects](#scenario_object) | Defines the scenarios to test for the code sample. **Default**: An scenario named default with no input.
|
112
174
|
|
113
|
-
### Reports and documentation
|
114
175
|
|
115
|
-
|
176
|
+
#### Scenario Object
|
116
177
|
|
117
|
-
|
118
|
-
|
119
|
-
|
178
|
+
Field Name | Type | Description
|
179
|
+
---|:---:|---
|
180
|
+
<a name="scenario_name"/>name | `string` | **Required.** The scenario name.
|
181
|
+
<a name="scenario_input"/>input | `string` | The content to send to the code sample as standard input.
|
182
|
+
<a name="scenario_input_file"/>input_file | `file` | Reads the specified file and sets *input*.
|
183
|
+
<a name="scenarios"/>language | Hash of [Scenario Objects](#scenario_object) | Defines the scenarios within the suite
|
120
184
|
|
121
|
-
|
185
|
+
#### Example Suite Definition
|
122
186
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
187
|
+
```yaml
|
188
|
+
suites:
|
189
|
+
katas:
|
190
|
+
scenarios:
|
191
|
+
hello_world:
|
192
|
+
validate:
|
193
|
+
stdout: Hello, World!
|
194
|
+
quine:
|
195
|
+
validate:
|
196
|
+
quine_validator: true
|
197
|
+
utilities:
|
198
|
+
scenarios:
|
199
|
+
word_count:
|
200
|
+
- name: short text
|
201
|
+
input: |
|
202
|
+
I am a word count utility
|
203
|
+
validate:
|
204
|
+
stdout: 6 words
|
205
|
+
- name: small file
|
206
|
+
input_file: fixtures/small_file.txt
|
207
|
+
validate:
|
208
|
+
stdout: 10 words
|
209
|
+
- name: large file
|
210
|
+
input_file: fixtures/large_file.txt
|
211
|
+
validate:
|
212
|
+
stdout: 1000 words
|
213
|
+
```
|
128
214
|
|
129
|
-
|
215
|
+
## Plugins
|
130
216
|
|
131
|
-
|
217
|
+
TBD
|
132
218
|
|
133
|
-
|
219
|
+
## Custom Validators
|
134
220
|
|
135
|
-
|
221
|
+
TBD
|
136
222
|
|
137
|
-
|
223
|
+
## Usage
|
138
224
|
|
139
|
-
|
225
|
+
### Cloning implementors
|
226
|
+
### Bootstrapping implementors
|
227
|
+
### Executing scenarios
|
228
|
+
### Verifying scenario results
|
229
|
+
### Full test
|
230
|
+
|
231
|
+
```
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ RSpec::Core::RakeTask.new('spec') do |t|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
Cucumber::Rake::Task.new(:features) do |t|
|
16
|
-
t.cucumber_opts = "features --require features/support --require features/step_definitions"
|
16
|
+
t.cucumber_opts = "features --require features/support --require features/step_definitions -t ~@wip"
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'Remove reports and other generated artifacts'
|
@@ -25,11 +25,13 @@ end
|
|
25
25
|
desc 'Self-test and self-document'
|
26
26
|
task :self do
|
27
27
|
sh 'bundle exec polytrix bootstrap'
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
Dir.chdir 'samples' do
|
29
|
+
# sh 'bundle exec polytrix test'
|
30
|
+
sh 'bundle exec polytrix code2doc java --target-dir=docs/samples/code2doc/java'
|
31
|
+
sh 'bundle exec polytrix code2doc python --target-dir=docs/samples/code2doc/python'
|
32
|
+
sh 'bundle exec polytrix code2doc ruby --target-dir=docs/samples/code2doc/ruby'
|
33
|
+
# sh 'bundle exec polytrix code2doc samples/*.rb'
|
34
|
+
end
|
33
35
|
end
|
34
36
|
|
35
37
|
Rubocop::RakeTask.new(:rubocop) do |task|
|
data/bin/polytrix
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
This is an example of the standard [Hello World](http://en.wikipedia.org/wiki/Hello_world_program)
|
2
2
|
program written in [Java][java].
|
3
|
+
|
3
4
|
```java
|
4
5
|
public class HelloWorld {
|
5
6
|
```
|
7
|
+
|
6
8
|
A Java CLI application is defined by creating a main method with this signature:
|
9
|
+
|
7
10
|
```java
|
8
11
|
public static void main(String[] args) {
|
9
12
|
System.out.println("Hello, world!");
|
10
13
|
}
|
11
14
|
}
|
12
15
|
```
|
16
|
+
|
13
17
|
[java]: http://en.wikipedia.org/wiki/Java_(programming_language)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Feature: Boostrapping
|
2
|
+
|
3
|
+
Polytrix uses the [script/bootstrap](http://wynnnetherland.com/linked/2013012801/bootstrapping-consistency) pattern to prepare SDKs for testing. You can hook into any package manager, compiler, build tool, or any other toolchain to prepare to build and run samples.
|
4
|
+
|
5
|
+
Scenario: Bootstrapping all SDKs
|
6
|
+
Given the ruby SDK
|
7
|
+
And the java SDK
|
8
|
+
And the python SDK
|
9
|
+
And the hello_world polytrix config
|
10
|
+
And the standard rspec setup
|
11
|
+
When I run `bundle exec polytrix bootstrap`
|
12
|
+
Then the output should contain "-----> Bootstrapping java"
|
13
|
+
Then the output should contain "-----> Bootstrapping python"
|
14
|
+
Then the output should contain "-----> Bootstrapping ruby"
|
15
|
+
|
16
|
+
Scenario: Bootstrapping selected SDKs
|
17
|
+
Given the ruby SDK
|
18
|
+
And the java SDK
|
19
|
+
And the python SDK
|
20
|
+
And the hello_world polytrix config
|
21
|
+
And the standard rspec setup
|
22
|
+
When I run `bundle exec polytrix bootstrap "(java|ruby)"`
|
23
|
+
Then the output should contain "-----> Bootstrapping java"
|
24
|
+
Then the output should not contain "-----> Bootstrapping python"
|
25
|
+
Then the output should contain "-----> Bootstrapping ruby"
|
26
|
+
|
27
|
+
Scenario: Bootstrapping by scenario
|
28
|
+
Given the ruby SDK
|
29
|
+
And the java SDK
|
30
|
+
And the python SDK
|
31
|
+
And the hello_world polytrix config
|
32
|
+
And the standard rspec setup
|
33
|
+
When I run `bundle exec polytrix bootstrap hello`
|
34
|
+
Then the output should contain "-----> Bootstrapping java"
|
35
|
+
Then the output should contain "-----> Bootstrapping python"
|
36
|
+
Then the output should contain "-----> Bootstrapping ruby"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
@wip
|
2
|
+
Feature: Cloning
|
3
|
+
|
4
|
+
Polytrix can clone projects from git.
|
5
|
+
|
6
|
+
Scenario: Cloning all SDKs
|
7
|
+
Given the hello_world polytrix config
|
8
|
+
And the standard rspec setup
|
9
|
+
When I run `bundle exec polytrix clone`
|
10
|
+
Then the output should contain "-----> Cloning java"
|
11
|
+
Then the output should contain "-----> Cloning python"
|
12
|
+
Then the output should contain "-----> Cloning ruby"
|
13
|
+
|
14
|
+
Scenario: Cloning selected SDKs
|
15
|
+
Given the ruby SDK
|
16
|
+
And the java SDK
|
17
|
+
And the python SDK
|
18
|
+
And the hello_world polytrix config
|
19
|
+
And the standard rspec setup
|
20
|
+
When I run `bundle exec polytrix clone "(java|ruby)"`
|
21
|
+
Then the output should contain "-----> Cloning java"
|
22
|
+
Then the output should not contain "-----> Cloning python"
|
23
|
+
Then the output should contain "-----> Cloning ruby"
|
24
|
+
|
25
|
+
Scenario: Cloning by scenario
|
26
|
+
Given the ruby SDK
|
27
|
+
And the java SDK
|
28
|
+
And the python SDK
|
29
|
+
And the hello_world polytrix config
|
30
|
+
And the standard rspec setup
|
31
|
+
When I run `bundle exec polytrix clone hello`
|
32
|
+
Then the output should contain "-----> Cloning java"
|
33
|
+
Then the output should contain "-----> Cloning python"
|
34
|
+
Then the output should contain "-----> Cloning ruby"
|
data/features/execution.feature
CHANGED
@@ -4,15 +4,7 @@ Feature: Running SDKs
|
|
4
4
|
|
5
5
|
Polytrix also sets up tags for the SDKs so you can use the normal rspec `-t` option to select which SDK to run.
|
6
6
|
|
7
|
-
Scenario:
|
8
|
-
Given the java SDK
|
9
|
-
And the empty polytrix config
|
10
|
-
And the standard rspec setup
|
11
|
-
When I run `bundle exec rspec`
|
12
|
-
Then the output should contain ":compileJava"
|
13
|
-
And the output should contain "BUILD SUCCESSFUL"
|
14
|
-
|
15
|
-
Scenario: Running all SDKs
|
7
|
+
Scenario: Running all SDKs
|
16
8
|
Given the ruby SDK
|
17
9
|
And the java SDK
|
18
10
|
And the python SDK
|
@@ -41,13 +33,6 @@ Scenario: Running all SDKs
|
|
41
33
|
"""
|
42
34
|
require 'polytrix/rspec'
|
43
35
|
|
44
|
-
Polytrix.configure do |polytrix|
|
45
|
-
Dir['sdks/*'].each do |sdk|
|
46
|
-
polytrix.implementor sdk
|
47
|
-
end
|
48
|
-
polytrix.test_manifest = 'polytrix_tests.yml'
|
49
|
-
end
|
50
|
-
|
51
36
|
# This is more of an integration test, but makes sure the rspec API is working.
|
52
37
|
# Expect results to all be pending, because there's no implementors in this proj.
|
53
38
|
|
@@ -62,6 +47,7 @@ Scenario: Running all SDKs
|
|
62
47
|
expect(challenge[:result].execution_result.stdout).to eq File.read(challenge[:result].source)
|
63
48
|
end
|
64
49
|
Polytrix.load_tests
|
50
|
+
|
65
51
|
"""
|
66
52
|
When I run `bundle exec rspec spec/custom_spec.rb`
|
67
53
|
And the output should match /expected: 1\s+got: 0/
|
@@ -1,4 +1,15 @@
|
|
1
1
|
---
|
2
|
+
implementors:
|
3
|
+
ruby:
|
4
|
+
language: 'ruby'
|
5
|
+
basedir: 'sdks/ruby'
|
6
|
+
java:
|
7
|
+
language: 'java'
|
8
|
+
basedir: 'sdks/java'
|
9
|
+
python:
|
10
|
+
language: 'python'
|
11
|
+
basedir: 'sdks/python'
|
12
|
+
|
2
13
|
global_env:
|
3
14
|
LOCALE: <%= ENV['LANG'] %>
|
4
15
|
FAVORITE_NUMBER: 5
|
@@ -9,4 +20,4 @@
|
|
9
20
|
samples:
|
10
21
|
Tutorials:
|
11
22
|
env:
|
12
|
-
samples:
|
23
|
+
samples:
|
@@ -1,4 +1,14 @@
|
|
1
1
|
---
|
2
|
+
implementors:
|
3
|
+
ruby:
|
4
|
+
language: 'ruby'
|
5
|
+
basedir: 'sdks/ruby'
|
6
|
+
java:
|
7
|
+
language: 'java'
|
8
|
+
basedir: 'sdks/java'
|
9
|
+
python:
|
10
|
+
language: 'python'
|
11
|
+
basedir: 'sdks/python'
|
2
12
|
global_env:
|
3
13
|
LOCALE: <%= ENV['LANG'] %>
|
4
14
|
FAVORITE_NUMBER: 5
|
@@ -7,4 +17,4 @@
|
|
7
17
|
env:
|
8
18
|
NAME: 'Max'
|
9
19
|
samples:
|
10
|
-
- hello world
|
20
|
+
- hello world
|