omnitest 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.gitmodules +0 -0
- data/.groc.json +7 -0
- data/.rspec +6 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +47 -0
- data/.travis.yml +12 -0
- data/.yardopts +3 -0
- data/Gemfile +26 -0
- data/README.md +341 -0
- data/Rakefile +33 -0
- data/appveyor.yml +9 -0
- data/bin/omnidoc +5 -0
- data/bin/omnitask +5 -0
- data/bin/omnitest +5 -0
- data/bower.json +21 -0
- data/doc-src/index.md.tt +341 -0
- data/doc-src/project_sets.md.tt +31 -0
- data/doc-src/usage/crosstask.md.tt +86 -0
- data/doc-src/usage/omnitest.md.tt +87 -0
- data/features/bootstrapping.feature +25 -0
- data/features/cloning.feature +32 -0
- data/features/fixtures/configs/omnitest_sample.yaml +11 -0
- data/features/fixtures/configs/skeptic_empty.yaml +12 -0
- data/features/fixtures/configs/skeptic_hello_world.yaml +10 -0
- data/features/show.feature +38 -0
- data/features/states.feature +40 -0
- data/features/step_definitions/sdk_steps.rb +22 -0
- data/features/support/env.rb +9 -0
- data/lib/omnitest.rb +211 -0
- data/lib/omnitest/cli.rb +297 -0
- data/lib/omnitest/command.rb +103 -0
- data/lib/omnitest/command/generate.rb +29 -0
- data/lib/omnitest/command/generators/code2doc.rb +79 -0
- data/lib/omnitest/command/generators/dashboard.rb +148 -0
- data/lib/omnitest/command/generators/documentation.rb +119 -0
- data/lib/omnitest/command/list.rb +62 -0
- data/lib/omnitest/command/project_action.rb +26 -0
- data/lib/omnitest/command/scenario_action.rb +20 -0
- data/lib/omnitest/command/show.rb +148 -0
- data/lib/omnitest/command/task.rb +27 -0
- data/lib/omnitest/command/test.rb +41 -0
- data/lib/omnitest/configuration.rb +53 -0
- data/lib/omnitest/documentation_generator.rb +68 -0
- data/lib/omnitest/project.rb +100 -0
- data/lib/omnitest/project_logger.rb +273 -0
- data/lib/omnitest/project_set.rb +47 -0
- data/lib/omnitest/reporters.rb +27 -0
- data/lib/omnitest/reporters/hash_reporter.rb +32 -0
- data/lib/omnitest/reporters/json_reporter.rb +12 -0
- data/lib/omnitest/reporters/markdown_reporter.rb +26 -0
- data/lib/omnitest/reporters/yaml_reporter.rb +12 -0
- data/lib/omnitest/run_action.rb +44 -0
- data/lib/omnitest/version.rb +3 -0
- data/lib/omnitest/workflow.rb +5 -0
- data/mkdocs.yml +8 -0
- data/omnitest.gemspec +39 -0
- data/omnitest.yaml +5 -0
- data/resources/assets/angular/angular.min.js +217 -0
- data/resources/assets/angular/angular.min.js.map +8 -0
- data/resources/assets/angular/json-formatter.min.css +6 -0
- data/resources/assets/angular/json-formatter.min.js +7 -0
- data/resources/assets/angular/ng-table.map +1 -0
- data/resources/assets/angular/ng-table.min.css +3 -0
- data/resources/assets/angular/ng-table.min.js +3 -0
- data/resources/assets/angular/ui-bootstrap-tpls.min.js +10 -0
- data/resources/assets/bootstrap/bootstrap.min.css +9 -0
- data/resources/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/resources/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/resources/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/resources/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/resources/assets/pygments/autumn.css +58 -0
- data/resources/assets/pygments/borland.css +46 -0
- data/resources/assets/pygments/bw.css +34 -0
- data/resources/assets/pygments/colorful.css +61 -0
- data/resources/assets/pygments/default.css +62 -0
- data/resources/assets/pygments/emacs.css +61 -0
- data/resources/assets/pygments/friendly.css +61 -0
- data/resources/assets/pygments/fruity.css +69 -0
- data/resources/assets/pygments/github.css +61 -0
- data/resources/assets/pygments/manni.css +61 -0
- data/resources/assets/pygments/monokai.css +64 -0
- data/resources/assets/pygments/murphy.css +61 -0
- data/resources/assets/pygments/native.css +69 -0
- data/resources/assets/pygments/pastie.css +60 -0
- data/resources/assets/pygments/perldoc.css +58 -0
- data/resources/assets/pygments/tango.css +69 -0
- data/resources/assets/pygments/trac.css +59 -0
- data/resources/assets/pygments/vim.css +69 -0
- data/resources/assets/pygments/vs.css +33 -0
- data/resources/assets/pygments/zenburn.css +1 -0
- data/resources/assets/style.css +56 -0
- data/resources/code_sample.tt +2 -0
- data/resources/generators/dashboard/files/dashboard.html.tt +51 -0
- data/resources/generators/dashboard/files/dashboard.js +26 -0
- data/resources/generators/dashboard/templates/_test_report.html.haml +91 -0
- data/resources/generators/todo/templates/todo.md.tt +6 -0
- data/resources/generators/todo/todo_template.rb +1 -0
- data/samples/.gitignore +2 -0
- data/samples/_markdown.md +5 -0
- data/samples/bootstrap.sh +2 -0
- data/samples/clone.sh +2 -0
- data/samples/code2doc.sh +5 -0
- data/samples/default_bootstrap.rb +7 -0
- data/samples/detect.sh +2 -0
- data/samples/exec.sh +2 -0
- data/samples/omnitest.yaml +24 -0
- data/samples/omnitest_simple.yaml +8 -0
- data/samples/scripts/bootstrap +3 -0
- data/samples/show.sh +4 -0
- data/samples/skeptic.yaml +13 -0
- data/samples/skeptic_simple.yaml +9 -0
- data/samples/test.sh +2 -0
- data/samples/tests/omnitest/validators.rb +23 -0
- data/samples/verify.sh +3 -0
- data/scripts/bootstrap.ps1 +7 -0
- data/scripts/run_script.sh +4 -0
- data/skeptic.yaml +26 -0
- data/spec/fabricators/project_fabricator.rb +19 -0
- data/spec/fabricators/scenario_fabricator.rb +6 -0
- data/spec/fabricators/test_manifest_fabricator.rb +41 -0
- data/spec/fabricators/validator_fabricator.rb +12 -0
- data/spec/fixtures/factorial.py +18 -0
- data/spec/fixtures/omnitest.yaml +11 -0
- data/spec/fixtures/skeptic.yaml +16 -0
- data/spec/fixtures/src-doc/_scenario.md.erb +1 -0
- data/spec/fixtures/src-doc/quine.md.erb +20 -0
- data/spec/omnitest/cli_spec.rb +38 -0
- data/spec/omnitest/configuration_spec.rb +25 -0
- data/spec/omnitest/documentation_generator_spec.rb +59 -0
- data/spec/omnitest/file_finder_spec.rb +21 -0
- data/spec/omnitest/project_spec.rb +65 -0
- data/spec/omnitest_spec.rb +13 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/thor_spy.rb +66 -0
- data/tests/omnitest/bootstrap_validations.rb +7 -0
- data/tests/omnitest/show_validations.rb +22 -0
- data/yard_macros.rb +25 -0
- metadata +470 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="UTF-8"/>
|
4
|
+
<link data-require="bootstrap-css@*" data-semver="3.0.0" href="assets/bootstrap/bootstrap.min.css" rel="stylesheet">
|
5
|
+
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
6
|
+
</head>
|
7
|
+
<body ng-app="main" ng-controller="DemoCtrl">
|
8
|
+
<ul class="nav nav-tabs">
|
9
|
+
<% @tabs.each do |tab_name, tab_target | %>
|
10
|
+
<% attrs = 'class="active"' if @active_tab == tab_name %>
|
11
|
+
<li role="presentation" <%= attrs %> >
|
12
|
+
<a href="<%= tab_target%>"><%= tab_name %></a>
|
13
|
+
</li>
|
14
|
+
<% end %>
|
15
|
+
</ul>
|
16
|
+
<script data-require="angular.js@*" data-semver="1.2.27" src="assets/angular/angular.min.js"></script>
|
17
|
+
<script data-require="ng-table@*" data-semver="0.3.1" src="assets/angular/ng-table.min.js"></script>
|
18
|
+
<link data-require="ng-table@*" data-semver="0.3.1" href="assets/angular/ng-table.min.css" rel="stylesheet">
|
19
|
+
<script type="text/javascript" src="dashboard.js"></script>
|
20
|
+
<button ng-click="tableParams.sorting({})" class="btn btn-default pull-right">Clear sorting</button>
|
21
|
+
<button ng-click="tableParams.filter({})" class="btn btn-default pull-right">Clear filter</button>
|
22
|
+
<p><strong>Sorting:</strong> {{tableParams.sorting()|json}}
|
23
|
+
<p><strong>Filter:</strong> {{tableParams.filter()|json}}
|
24
|
+
<table class="table" ng-table="tableParams" show-filter="true">
|
25
|
+
<tbody ng-repeat="group in $groups">
|
26
|
+
<tr class="ng-table-group">
|
27
|
+
<td colspan="{{$columns.length}}">
|
28
|
+
<a href="" ng-click="group.$hideRows = !group.$hideRows"><span class="glyphicon" ng-class="{ 'glyphicon-chevron-right': group.$hideRows, 'glyphicon-chevron-down': !group.$hideRows }"></span><strong> {{ group.value }} </strong></a>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<tr ng-hide="group.$hideRows" ng-repeat="results in group.data">
|
32
|
+
<td data-title="'Scenario'" sortable="scenario" filter="{ 'scenario': 'text' }">
|
33
|
+
{{results.scenario}}
|
34
|
+
</td>
|
35
|
+
<% projects.each do |project| %>
|
36
|
+
<td data-title="'<%= project %>'" ng-class="{'passed': results.<%= project %>.indexOf('Fully Verified') != -1, 'partial': results.<%= project %>.indexOf('Partially Verified') != -1, 'failed': results.<%= project %>.indexOf('Failed') != -1 }" sortable="<%= project %>" filter="{ '<%= project %>': 'project' }">
|
37
|
+
<a href="details/{{results.slug_prefix}}-<%= project %>.html">{{results.<%= project %>}}</a>
|
38
|
+
</td>
|
39
|
+
<% end %>
|
40
|
+
</tr>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
<script type="text/ng-template" id="ng-table/filters/project.html">
|
44
|
+
<select ng-model="params.filter()[name]" name="filter-project">
|
45
|
+
<option value="">None</option>
|
46
|
+
<option value="Fully Verified">Fully Verified</option>
|
47
|
+
<option value="Partially Verified">Partially Verified</option>
|
48
|
+
</select>
|
49
|
+
</script>
|
50
|
+
</body>
|
51
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
var app = angular.module('main', ['ngTable']).controller('DemoCtrl', function($scope, $http, $filter, ngTableParams) {
|
2
|
+
$http.get('matrix.json').success(function(data, status, headers, config){
|
3
|
+
$scope.tableParams = new ngTableParams({
|
4
|
+
page: 1, // show first page
|
5
|
+
count: data.length // count per page
|
6
|
+
}, {
|
7
|
+
counts: [],
|
8
|
+
groupBy: 'suite',
|
9
|
+
filter: {
|
10
|
+
scenario: '' // initial filter
|
11
|
+
},
|
12
|
+
total: data.length,
|
13
|
+
getData: function($defer, params) {
|
14
|
+
var filteredData = params.filter() ?
|
15
|
+
$filter('filter')(data, params.filter()) :
|
16
|
+
data;
|
17
|
+
var orderedData = params.sorting() ?
|
18
|
+
$filter('orderBy')(filteredData, params.orderBy()) :
|
19
|
+
data;
|
20
|
+
|
21
|
+
params.total(orderedData.length);
|
22
|
+
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
})
|
@@ -0,0 +1,91 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%body
|
4
|
+
%meta{:charset => "UTF-8"}/
|
5
|
+
%link{"data-require" => "bootstrap-css@*", "data-semver" => "3.0.0", :href => "http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css", :rel => "stylesheet"}/
|
6
|
+
%link{:href => "../assets/pygments/#{options[:code_style]}.css", :rel => "stylesheet", :type => "text/css"}/
|
7
|
+
%link{:href => "../assets/style.css", :rel => "stylesheet", :type => "text/css"}/
|
8
|
+
%link{:href => "../assets/angular/json-formatter.min.css", :rel => "stylesheet", :type => "text/css"}/
|
9
|
+
%script{"data-require" => "angular.js@*", "data-semver" => "1.2.27", :src => "../assets/angular/angular.min.js"}
|
10
|
+
%script{:src => "../assets/angular/ui-bootstrap-tpls.min.js"}
|
11
|
+
%script{:src => "../assets/angular/json-formatter.min.js"}
|
12
|
+
:javascript
|
13
|
+
angular.module('details', ['jsonFormatter', 'ui.bootstrap']);
|
14
|
+
%div{:class => "panel panel-#{bootstrap_color(@scenario.status_color)}"}
|
15
|
+
.panel-heading
|
16
|
+
.panel-title
|
17
|
+
%strong
|
18
|
+
= @scenario.slug
|
19
|
+
%span{:class => "label pull-right label-#{bootstrap_color(@scenario.status_color)}"}= @scenario.status_description
|
20
|
+
.panel-body
|
21
|
+
%ul.list-group
|
22
|
+
%li.list-group-item= status('Test suite:', @scenario.suite)
|
23
|
+
%li.list-group-item= status('Test scenario:', @scenario.name)
|
24
|
+
%li.list-group-item= status('Implementor:', @scenario.psychic.name)
|
25
|
+
%li.list-group-item= status('Duration:', Omnitest::Core::Util.duration(@scenario.duration))
|
26
|
+
%li.list-group-item
|
27
|
+
%strong.list-group-item-heading Test Input
|
28
|
+
- source_file = @scenario.absolute_source_file ? Omnitest::Core::FileSystem.relativize(@scenario.absolute_source_file, Dir.pwd) : '<No code sample>'
|
29
|
+
%ul.list-group-item
|
30
|
+
%strong.list-group-item-heading Code sample
|
31
|
+
%p.list-group-item-text
|
32
|
+
- if @scenario.absolute_source_file
|
33
|
+
= @scenario.highlighted_code('html')
|
34
|
+
%ul.list-group-item
|
35
|
+
%strong.list-group-item-heading Test parameters
|
36
|
+
%tabset
|
37
|
+
%tab{:heading => "Tree"}
|
38
|
+
%json-formatter{:json => as_json(@scenario.vars), :open => "5"}
|
39
|
+
%tab{:heading => "Raw"}
|
40
|
+
%pre.list-group-item-text.console
|
41
|
+
%code
|
42
|
+
= highlight(@scenario.vars.to_hash.to_yaml, language: 'yaml', formatter: 'html')
|
43
|
+
- if @scenario.result
|
44
|
+
%li.list-group-item
|
45
|
+
%strong.list-group-item-heading Execution Results
|
46
|
+
%ul.list-group
|
47
|
+
`
|
48
|
+
%li.list-group-item
|
49
|
+
%strong.list-group-item-heading Validation Results
|
50
|
+
%ul.list-group
|
51
|
+
- @scenario.result.validations.each do |description, result|
|
52
|
+
%li{:class => "list-group-item #{result.result}"}
|
53
|
+
%strong.list-group-item-heading= description
|
54
|
+
- if result.error
|
55
|
+
.list-group-item
|
56
|
+
%strong.list-group-item-heading Error Message
|
57
|
+
%pre.list-group-item-text.console
|
58
|
+
= ansi2html(h result.error.to_s)
|
59
|
+
.list-group-item
|
60
|
+
%strong.list-group-item-heading Validator Source
|
61
|
+
.list-group-item-text
|
62
|
+
= highlight(result.error_source, language: 'ruby', formatter: 'html')
|
63
|
+
%li.list-group-item
|
64
|
+
%strong.list-group-item-heading STDOUT
|
65
|
+
%pre.list-group-item-text.console
|
66
|
+
- if @scenario.result
|
67
|
+
%code
|
68
|
+
= ansi2html(@scenario.result.execution_result.stdout)
|
69
|
+
%li.list-group-item
|
70
|
+
%strong.list-group-item-heading STDERR
|
71
|
+
%pre.list-group-item-text.console
|
72
|
+
- if @scenario.result
|
73
|
+
%code
|
74
|
+
= ansi2html(@scenario.result.execution_result.stderr)
|
75
|
+
- if @scenario.error
|
76
|
+
%li.list-group-item
|
77
|
+
%strong.list-group-item-heading Framework Errors
|
78
|
+
%pre.list-group-item-text.console
|
79
|
+
%code
|
80
|
+
= @scenario.error
|
81
|
+
- if @scenario.spy_data
|
82
|
+
%li.list-group-item
|
83
|
+
%strong.list-group-item-heading Spy data
|
84
|
+
%tabset
|
85
|
+
%tab{:heading => "Tree"}
|
86
|
+
%json-formatter{:json => as_json(@scenario.spy_data), :open => "5"}
|
87
|
+
%tab{:heading => "Raw"}
|
88
|
+
%pre.list-group-item-text.console
|
89
|
+
%code
|
90
|
+
= highlight(@scenario.spy_data.to_hash.to_yaml, language: 'yaml', formatter: 'html')
|
91
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
template 'templates/todo.md', 'todo.md'
|
data/samples/.gitignore
ADDED
data/samples/clone.sh
ADDED
data/samples/code2doc.sh
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
rm -rf docs # Or the test suite will get stuck asking about conflicts
|
3
|
+
bundle exec omnidoc code2doc java --destination=docs/code2doc/java
|
4
|
+
bundle exec omnidoc code2doc python --destination=docs/code2doc/python
|
5
|
+
bundle exec omnidoc code2doc ruby --destination=docs/code2doc/ruby
|
data/samples/detect.sh
ADDED
data/samples/exec.sh
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
projects:
|
3
|
+
ruby:
|
4
|
+
language: 'ruby'
|
5
|
+
basedir: 'sdks/ruby'
|
6
|
+
git:
|
7
|
+
repo: 'https://github.com/omnitest/ruby_samples'
|
8
|
+
java:
|
9
|
+
language: 'java'
|
10
|
+
basedir: 'sdks/java'
|
11
|
+
git:
|
12
|
+
repo: 'https://github.com/omnitest/java_samples'
|
13
|
+
python:
|
14
|
+
language: 'python'
|
15
|
+
basedir: 'sdks/python'
|
16
|
+
git:
|
17
|
+
repo: 'https://github.com/omnitest/python_samples'
|
18
|
+
workflows:
|
19
|
+
morning:
|
20
|
+
tasks:
|
21
|
+
# - update_repo
|
22
|
+
- bootstrap
|
23
|
+
- lint
|
24
|
+
- test
|
data/samples/show.sh
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
global_env: # global_env defines input available for all scenarios
|
3
|
+
LOCALE: <%= ENV['LANG'] %> # templating is allowed
|
4
|
+
suites:
|
5
|
+
Katas: # "Katas" is the name of the first test suite
|
6
|
+
samples: # Test scenarios within Katas
|
7
|
+
- hello world
|
8
|
+
- quine
|
9
|
+
Environment:
|
10
|
+
env: # Unlike global_env, these variables are only for the Katas suite
|
11
|
+
COLOR: red
|
12
|
+
samples:
|
13
|
+
- echo_color
|
data/samples/test.sh
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'omnitest'
|
2
|
+
|
3
|
+
Omnitest.validate 'Hello world validator', suite: 'Katas', scenario: 'hello world' do |scenario|
|
4
|
+
expect(scenario.result.stdout.strip).to match 'Hello, world!'
|
5
|
+
end
|
6
|
+
|
7
|
+
Omnitest.validate 'Quine output matches source code', suite: 'Katas', scenario: 'quine' do |scenario|
|
8
|
+
code = scenario.source
|
9
|
+
output = scenario.result.stdout
|
10
|
+
[code, output].each do | str |
|
11
|
+
# Standardize newlines...
|
12
|
+
str.gsub!(/[\r\n]+/, "\n")
|
13
|
+
end
|
14
|
+
expect(output).to eq(code)
|
15
|
+
end
|
16
|
+
|
17
|
+
Omnitest.validate 'default validator' do |scenario|
|
18
|
+
expect(scenario.result.exitstatus).to eq(0)
|
19
|
+
stderr = scenario.result.stderr
|
20
|
+
stderr.gsub!(/DL is deprecated, please use Fiddle[\r\n]+/, '') # Known windows warning
|
21
|
+
expect(stderr).to be_empty
|
22
|
+
expect(scenario.result.stdout).to end_with(/$/)
|
23
|
+
end
|
data/samples/verify.sh
ADDED
data/skeptic.yaml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
global_env: # global_env defines input available for all scenarios
|
3
|
+
LOCALE: <%= ENV['LANG'] %> # templating is allowed
|
4
|
+
FAVORITE_NUMBER: 5
|
5
|
+
suites:
|
6
|
+
CLI:
|
7
|
+
samples:
|
8
|
+
- clone
|
9
|
+
- detect
|
10
|
+
- bootstrap
|
11
|
+
- exec
|
12
|
+
- verify
|
13
|
+
- test
|
14
|
+
Spies:
|
15
|
+
samples:
|
16
|
+
- built in spies
|
17
|
+
- custom spies
|
18
|
+
Reports: # "Katas" is the name of the first suite
|
19
|
+
samples: # samples defines the individual tests in a suite
|
20
|
+
- show
|
21
|
+
- dashboard
|
22
|
+
- code2doc
|
23
|
+
- custom spy report
|
24
|
+
Generate:
|
25
|
+
samples:
|
26
|
+
- slate docs
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Fabricates test manifests (.omnitest.yaml files)
|
2
|
+
|
3
|
+
Fabricator(:project, from: Omnitest::Project) do
|
4
|
+
initialize_with { @_klass.new to_hash } # Hash based initialization
|
5
|
+
language { LANGUAGES.sample }
|
6
|
+
name do |attr|
|
7
|
+
"my_#{attr[:language]}_project"
|
8
|
+
end
|
9
|
+
basedir do |attr|
|
10
|
+
"sdks/#{attr[:name]}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Fabricator(:project_set, from: Omnitest::ProjectSet) do
|
15
|
+
initialize_with { @_klass.new to_hash } # Hash based initialization
|
16
|
+
projects do
|
17
|
+
Fabricate(:project)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Fabricates test manifests (.omnitest.yaml files)
|
2
|
+
|
3
|
+
Fabricator(:manifest, from: Omnitest::Skeptic::TestManifest) do
|
4
|
+
initialize_with { @_klass.new to_hash } # Hash based initialization
|
5
|
+
transient suite_count: 3
|
6
|
+
transient samples_per_suite: 3
|
7
|
+
global_env do
|
8
|
+
{
|
9
|
+
VAR1: 1,
|
10
|
+
VAR2: 2
|
11
|
+
}
|
12
|
+
end
|
13
|
+
suites do |attr|
|
14
|
+
suite_count = attr[:suite_count]
|
15
|
+
if suite_count
|
16
|
+
suites = attr[:suite_count].times.each_with_object({}) do |i, h|
|
17
|
+
name = LANGUAGES[i] ||= "suite_#{i}"
|
18
|
+
h[name] = Fabricate(:suite, name: name, sample_count: attr[:samples_per_suite])
|
19
|
+
end
|
20
|
+
suites
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
Fabricator(:suite, from: Omnitest::Core::Mash) do
|
28
|
+
initialize_with { @_klass.new to_hash } # Hash based initialization
|
29
|
+
transient name: LANGUAGES[0]
|
30
|
+
transient sample_count: 3
|
31
|
+
samples do |attr|
|
32
|
+
sample_count = attr[:sample_count]
|
33
|
+
if sample_count
|
34
|
+
attr[:sample_count].times.map do |i|
|
35
|
+
SCENARIO_NAMES[i] ||= "sample_#{i}"
|
36
|
+
end
|
37
|
+
else
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|