omnitest 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.gitmodules +0 -0
  4. data/.groc.json +7 -0
  5. data/.rspec +6 -0
  6. data/.rubocop.yml +5 -0
  7. data/.rubocop_todo.yml +47 -0
  8. data/.travis.yml +12 -0
  9. data/.yardopts +3 -0
  10. data/Gemfile +26 -0
  11. data/README.md +341 -0
  12. data/Rakefile +33 -0
  13. data/appveyor.yml +9 -0
  14. data/bin/omnidoc +5 -0
  15. data/bin/omnitask +5 -0
  16. data/bin/omnitest +5 -0
  17. data/bower.json +21 -0
  18. data/doc-src/index.md.tt +341 -0
  19. data/doc-src/project_sets.md.tt +31 -0
  20. data/doc-src/usage/crosstask.md.tt +86 -0
  21. data/doc-src/usage/omnitest.md.tt +87 -0
  22. data/features/bootstrapping.feature +25 -0
  23. data/features/cloning.feature +32 -0
  24. data/features/fixtures/configs/omnitest_sample.yaml +11 -0
  25. data/features/fixtures/configs/skeptic_empty.yaml +12 -0
  26. data/features/fixtures/configs/skeptic_hello_world.yaml +10 -0
  27. data/features/show.feature +38 -0
  28. data/features/states.feature +40 -0
  29. data/features/step_definitions/sdk_steps.rb +22 -0
  30. data/features/support/env.rb +9 -0
  31. data/lib/omnitest.rb +211 -0
  32. data/lib/omnitest/cli.rb +297 -0
  33. data/lib/omnitest/command.rb +103 -0
  34. data/lib/omnitest/command/generate.rb +29 -0
  35. data/lib/omnitest/command/generators/code2doc.rb +79 -0
  36. data/lib/omnitest/command/generators/dashboard.rb +148 -0
  37. data/lib/omnitest/command/generators/documentation.rb +119 -0
  38. data/lib/omnitest/command/list.rb +62 -0
  39. data/lib/omnitest/command/project_action.rb +26 -0
  40. data/lib/omnitest/command/scenario_action.rb +20 -0
  41. data/lib/omnitest/command/show.rb +148 -0
  42. data/lib/omnitest/command/task.rb +27 -0
  43. data/lib/omnitest/command/test.rb +41 -0
  44. data/lib/omnitest/configuration.rb +53 -0
  45. data/lib/omnitest/documentation_generator.rb +68 -0
  46. data/lib/omnitest/project.rb +100 -0
  47. data/lib/omnitest/project_logger.rb +273 -0
  48. data/lib/omnitest/project_set.rb +47 -0
  49. data/lib/omnitest/reporters.rb +27 -0
  50. data/lib/omnitest/reporters/hash_reporter.rb +32 -0
  51. data/lib/omnitest/reporters/json_reporter.rb +12 -0
  52. data/lib/omnitest/reporters/markdown_reporter.rb +26 -0
  53. data/lib/omnitest/reporters/yaml_reporter.rb +12 -0
  54. data/lib/omnitest/run_action.rb +44 -0
  55. data/lib/omnitest/version.rb +3 -0
  56. data/lib/omnitest/workflow.rb +5 -0
  57. data/mkdocs.yml +8 -0
  58. data/omnitest.gemspec +39 -0
  59. data/omnitest.yaml +5 -0
  60. data/resources/assets/angular/angular.min.js +217 -0
  61. data/resources/assets/angular/angular.min.js.map +8 -0
  62. data/resources/assets/angular/json-formatter.min.css +6 -0
  63. data/resources/assets/angular/json-formatter.min.js +7 -0
  64. data/resources/assets/angular/ng-table.map +1 -0
  65. data/resources/assets/angular/ng-table.min.css +3 -0
  66. data/resources/assets/angular/ng-table.min.js +3 -0
  67. data/resources/assets/angular/ui-bootstrap-tpls.min.js +10 -0
  68. data/resources/assets/bootstrap/bootstrap.min.css +9 -0
  69. data/resources/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  70. data/resources/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  71. data/resources/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  72. data/resources/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  73. data/resources/assets/pygments/autumn.css +58 -0
  74. data/resources/assets/pygments/borland.css +46 -0
  75. data/resources/assets/pygments/bw.css +34 -0
  76. data/resources/assets/pygments/colorful.css +61 -0
  77. data/resources/assets/pygments/default.css +62 -0
  78. data/resources/assets/pygments/emacs.css +61 -0
  79. data/resources/assets/pygments/friendly.css +61 -0
  80. data/resources/assets/pygments/fruity.css +69 -0
  81. data/resources/assets/pygments/github.css +61 -0
  82. data/resources/assets/pygments/manni.css +61 -0
  83. data/resources/assets/pygments/monokai.css +64 -0
  84. data/resources/assets/pygments/murphy.css +61 -0
  85. data/resources/assets/pygments/native.css +69 -0
  86. data/resources/assets/pygments/pastie.css +60 -0
  87. data/resources/assets/pygments/perldoc.css +58 -0
  88. data/resources/assets/pygments/tango.css +69 -0
  89. data/resources/assets/pygments/trac.css +59 -0
  90. data/resources/assets/pygments/vim.css +69 -0
  91. data/resources/assets/pygments/vs.css +33 -0
  92. data/resources/assets/pygments/zenburn.css +1 -0
  93. data/resources/assets/style.css +56 -0
  94. data/resources/code_sample.tt +2 -0
  95. data/resources/generators/dashboard/files/dashboard.html.tt +51 -0
  96. data/resources/generators/dashboard/files/dashboard.js +26 -0
  97. data/resources/generators/dashboard/templates/_test_report.html.haml +91 -0
  98. data/resources/generators/todo/templates/todo.md.tt +6 -0
  99. data/resources/generators/todo/todo_template.rb +1 -0
  100. data/samples/.gitignore +2 -0
  101. data/samples/_markdown.md +5 -0
  102. data/samples/bootstrap.sh +2 -0
  103. data/samples/clone.sh +2 -0
  104. data/samples/code2doc.sh +5 -0
  105. data/samples/default_bootstrap.rb +7 -0
  106. data/samples/detect.sh +2 -0
  107. data/samples/exec.sh +2 -0
  108. data/samples/omnitest.yaml +24 -0
  109. data/samples/omnitest_simple.yaml +8 -0
  110. data/samples/scripts/bootstrap +3 -0
  111. data/samples/show.sh +4 -0
  112. data/samples/skeptic.yaml +13 -0
  113. data/samples/skeptic_simple.yaml +9 -0
  114. data/samples/test.sh +2 -0
  115. data/samples/tests/omnitest/validators.rb +23 -0
  116. data/samples/verify.sh +3 -0
  117. data/scripts/bootstrap.ps1 +7 -0
  118. data/scripts/run_script.sh +4 -0
  119. data/skeptic.yaml +26 -0
  120. data/spec/fabricators/project_fabricator.rb +19 -0
  121. data/spec/fabricators/scenario_fabricator.rb +6 -0
  122. data/spec/fabricators/test_manifest_fabricator.rb +41 -0
  123. data/spec/fabricators/validator_fabricator.rb +12 -0
  124. data/spec/fixtures/factorial.py +18 -0
  125. data/spec/fixtures/omnitest.yaml +11 -0
  126. data/spec/fixtures/skeptic.yaml +16 -0
  127. data/spec/fixtures/src-doc/_scenario.md.erb +1 -0
  128. data/spec/fixtures/src-doc/quine.md.erb +20 -0
  129. data/spec/omnitest/cli_spec.rb +38 -0
  130. data/spec/omnitest/configuration_spec.rb +25 -0
  131. data/spec/omnitest/documentation_generator_spec.rb +59 -0
  132. data/spec/omnitest/file_finder_spec.rb +21 -0
  133. data/spec/omnitest/project_spec.rb +65 -0
  134. data/spec/omnitest_spec.rb +13 -0
  135. data/spec/spec_helper.rb +32 -0
  136. data/spec/thor_spy.rb +66 -0
  137. data/tests/omnitest/bootstrap_validations.rb +7 -0
  138. data/tests/omnitest/show_validations.rb +22 -0
  139. data/yard_macros.rb +25 -0
  140. metadata +470 -0
@@ -0,0 +1,2 @@
1
+ <%= commented "Sample for #{@scenario.name}" %>
2
+ <%= commented @scenario.description if @scenario.description %>
@@ -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,6 @@
1
+ <%- Omnitest.projects.each do |project| -%>
2
+ <%= project.name %>:
3
+ <%- @challenges.select{|c| c.project == project}.each do |challenge| -%>
4
+ - [<%= challenge.source? ? 'x' : ' ' %>] <%= challenge.name %>
5
+ <% end %>
6
+ <%- end -%>
@@ -0,0 +1 @@
1
+ template 'templates/todo.md', 'todo.md'
@@ -0,0 +1,2 @@
1
+ reports/
2
+ tmp/
@@ -0,0 +1,5 @@
1
+ <% challenges.compact.each do |challenge| %>
2
+ ``` <%= challenge.implementor.language %>
3
+ <%= File.read(challenge.source_file) %>
4
+ ```
5
+ <% end %>
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest bootstrap "(java|ruby)"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest clone
@@ -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
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This example shows the default behavior of `Omnitest#bootstrap`
4
+ require 'omnitest'
5
+
6
+ # Snippet: bootstrap
7
+ Omnitest.bootstrap
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest detect
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest exec
@@ -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
@@ -0,0 +1,8 @@
1
+ ---
2
+ projects:
3
+ ruby:
4
+ basedir: 'projects/ruby_samples'
5
+ java:
6
+ basedir: 'projects/java_samples'
7
+ python:
8
+ basedir: 'projects/python_samples'
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ bundle install
3
+ bundle exec omnitest clone
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest clear
3
+ bundle exec omnitest test ruby
4
+ bundle exec omnitest show ruby 'hello world'
@@ -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
@@ -0,0 +1,9 @@
1
+ ---
2
+ suites:
3
+ Katas:
4
+ samples:
5
+ - hello world
6
+ - quine
7
+ Environment:
8
+ samples:
9
+ - echo_color
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest test
@@ -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
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ bundle exec omnitest clear
3
+ bundle exec omnitest verify
@@ -0,0 +1,7 @@
1
+ bundle install
2
+ pushd samples
3
+ # Replace sh files w/ ps1 files... they should be platform independent except
4
+ # for the file extension.
5
+ Dir *.sh | Rename-Item -NewName { $_.name -replace '\.sh$','.ps1' }
6
+ bundle exec omnitest clone
7
+ popd
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ # This is a trick to force a pty and capture colored output,
3
+ # because Omnitest does not currently run command with a PTY.
4
+ script -q /dev/null "$@"
@@ -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,6 @@
1
+ Fabricator(:scenario_definition, from: Omnitest::Skeptic::ScenarioDefinition) do
2
+ initialize_with { @_klass.new to_hash } # Hash based initialization
3
+ name { SCENARIO_NAMES.sample }
4
+ suite { LANGUAGES.sample }
5
+ properties {}
6
+ 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