hiptest-publisher-fork 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +295 -0
- data/LICENSE +21 -0
- data/README.md +265 -0
- data/bin/hiptest-publisher +47 -0
- data/config/i18n-tasks.yml +137 -0
- data/config/locales/en.yml +250 -0
- data/lib/config/behat.conf +44 -0
- data/lib/config/behave.conf +40 -0
- data/lib/config/csharp-nunit.conf +15 -0
- data/lib/config/cucumber-groovy.conf +40 -0
- data/lib/config/cucumber-java.conf +24 -0
- data/lib/config/cucumber-javascript.conf +23 -0
- data/lib/config/cucumber-ruby.conf +22 -0
- data/lib/config/cucumber-typescript.conf +41 -0
- data/lib/config/cucumber_legacy-groovy.conf +40 -0
- data/lib/config/cucumber_legacy-java.conf +24 -0
- data/lib/config/cucumber_legacy-typescript.conf +41 -0
- data/lib/config/groovy-spock.conf +25 -0
- data/lib/config/java-espresso.conf +15 -0
- data/lib/config/java-junit.conf +21 -0
- data/lib/config/java-testng.conf +15 -0
- data/lib/config/javascript-codeceptjs.conf +23 -0
- data/lib/config/javascript-jasmine.conf +12 -0
- data/lib/config/javascript-mocha.conf +12 -0
- data/lib/config/javascript-protractor.conf +12 -0
- data/lib/config/javascript-qunit.conf +12 -0
- data/lib/config/jbehave.conf +24 -0
- data/lib/config/php-phpunit.conf +14 -0
- data/lib/config/python-unittest.conf +13 -0
- data/lib/config/robotframework.conf +13 -0
- data/lib/config/ruby-minitest.conf +11 -0
- data/lib/config/ruby-rspec.conf +11 -0
- data/lib/config/seleniumide.conf +12 -0
- data/lib/config/specflow.conf +25 -0
- data/lib/config/swift-xctest.conf +18 -0
- data/lib/hiptest-publisher/cli_options_checker.rb +270 -0
- data/lib/hiptest-publisher/client.rb +326 -0
- data/lib/hiptest-publisher/export_cache.rb +85 -0
- data/lib/hiptest-publisher/file_writer.rb +30 -0
- data/lib/hiptest-publisher/formatters/console_formatter.rb +101 -0
- data/lib/hiptest-publisher/formatters/diff_displayer.rb +173 -0
- data/lib/hiptest-publisher/formatters/reporter.rb +74 -0
- data/lib/hiptest-publisher/handlebars_helper.rb +314 -0
- data/lib/hiptest-publisher/i18n.rb +5 -0
- data/lib/hiptest-publisher/indexers/actionword_indexer.rb +32 -0
- data/lib/hiptest-publisher/indexers/library_actionword_indexer.rb +32 -0
- data/lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb +39 -0
- data/lib/hiptest-publisher/node_modifiers/add_all.rb +21 -0
- data/lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb +46 -0
- data/lib/hiptest-publisher/node_modifiers/datatable_fixer.rb +32 -0
- data/lib/hiptest-publisher/node_modifiers/gherkin_adder.rb +252 -0
- data/lib/hiptest-publisher/node_modifiers/items_orderer.rb +33 -0
- data/lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb +141 -0
- data/lib/hiptest-publisher/node_modifiers/parent_adder.rb +18 -0
- data/lib/hiptest-publisher/nodes.rb +601 -0
- data/lib/hiptest-publisher/nodes_walker.rb +34 -0
- data/lib/hiptest-publisher/options_parser.rb +826 -0
- data/lib/hiptest-publisher/project_grapher.rb +94 -0
- data/lib/hiptest-publisher/render_context_maker.rb +194 -0
- data/lib/hiptest-publisher/renderer.rb +52 -0
- data/lib/hiptest-publisher/renderer_addons/behave_addon.rb +23 -0
- data/lib/hiptest-publisher/renderer_addons/gherkin_addon.rb +59 -0
- data/lib/hiptest-publisher/renderer_addons/groovy_spock_addon.rb +34 -0
- data/lib/hiptest-publisher/renderer_addons/robot_framework_addon.rb +42 -0
- data/lib/hiptest-publisher/renderer_addons.rb +4 -0
- data/lib/hiptest-publisher/signature_differ.rb +105 -0
- data/lib/hiptest-publisher/signature_exporter.rb +56 -0
- data/lib/hiptest-publisher/string.rb +76 -0
- data/lib/hiptest-publisher/utils.rb +39 -0
- data/lib/hiptest-publisher/version_checker.rb +41 -0
- data/lib/hiptest-publisher/xml_parser.rb +407 -0
- data/lib/hiptest-publisher.rb +261 -0
- data/lib/templates/behat/actionword.hbs +8 -0
- data/lib/templates/behat/actionwords/parameter.hbs +1 -0
- data/lib/templates/behat/actionwords.hbs +16 -0
- data/lib/templates/behat/library.hbs +16 -0
- data/lib/templates/behat/libraryactionword.hbs +8 -0
- data/lib/templates/behat/parameter.hbs +1 -0
- data/lib/templates/behave/actionword.hbs +4 -0
- data/lib/templates/behave/actionwords.hbs +12 -0
- data/lib/templates/behave/library.hbs +7 -0
- data/lib/templates/behave/libraryactionword.hbs +4 -0
- data/lib/templates/behave/nullliteral.hbs +1 -0
- data/lib/templates/common/_gherkin_pattern.hbs +1 -0
- data/lib/templates/common/_gherkin_typed_pattern.hbs +1 -0
- data/lib/templates/common/booleanliteral.hbs +1 -0
- data/lib/templates/common/dataset.hbs +0 -0
- data/lib/templates/common/datatable.hbs +3 -0
- data/lib/templates/common/empty.hbs +0 -0
- data/lib/templates/common/nullliteral.hbs +1 -0
- data/lib/templates/common/numericliteral.hbs +1 -0
- data/lib/templates/common/stringliteral.hbs +1 -0
- data/lib/templates/common/symbol.hbs +1 -0
- data/lib/templates/common/unaryexpression.hbs +1 -0
- data/lib/templates/common/variable.hbs +1 -0
- data/lib/templates/csharp/_body.hbs +5 -0
- data/lib/templates/csharp/_item_as_function.hbs +8 -0
- data/lib/templates/csharp/_scenario.hbs +8 -0
- data/lib/templates/csharp/actionword.hbs +1 -0
- data/lib/templates/csharp/actionwords.hbs +10 -0
- data/lib/templates/csharp/argument.hbs +1 -0
- data/lib/templates/csharp/assign.hbs +1 -0
- data/lib/templates/csharp/binaryexpression.hbs +1 -0
- data/lib/templates/csharp/call.hbs +2 -0
- data/lib/templates/csharp/dataset.hbs +4 -0
- data/lib/templates/csharp/dict.hbs +1 -0
- data/lib/templates/csharp/field.hbs +1 -0
- data/lib/templates/csharp/folder.hbs +22 -0
- data/lib/templates/csharp/ifthen.hbs +7 -0
- data/lib/templates/csharp/index.hbs +1 -0
- data/lib/templates/csharp/list.hbs +1 -0
- data/lib/templates/csharp/nullliteral.hbs +1 -0
- data/lib/templates/csharp/parameter.hbs +1 -0
- data/lib/templates/csharp/parenthesis.hbs +1 -0
- data/lib/templates/csharp/property.hbs +1 -0
- data/lib/templates/csharp/scenario.hbs +1 -0
- data/lib/templates/csharp/scenarios.hbs +20 -0
- data/lib/templates/csharp/single_scenario.hbs +16 -0
- data/lib/templates/csharp/single_test.hbs +15 -0
- data/lib/templates/csharp/step.hbs +1 -0
- data/lib/templates/csharp/stringliteral.hbs +1 -0
- data/lib/templates/csharp/tag.hbs +1 -0
- data/lib/templates/csharp/template.hbs +1 -0
- data/lib/templates/csharp/test.hbs +1 -0
- data/lib/templates/csharp/tests.hbs +15 -0
- data/lib/templates/csharp/variable.hbs +1 -0
- data/lib/templates/csharp/while.hbs +4 -0
- data/lib/templates/cucumber/actionword.hbs +5 -0
- data/lib/templates/cucumber/actionwords.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/_gherkin_pattern.hbs +1 -0
- data/lib/templates/cucumber/groovy/step-definitions/actionword.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/actionwords.hbs +11 -0
- data/lib/templates/cucumber/groovy/step-definitions/library.hbs +11 -0
- data/lib/templates/cucumber/groovy/step-definitions/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/parameter.hbs +1 -0
- data/lib/templates/cucumber/java/actionword.hbs +6 -0
- data/lib/templates/cucumber/java/actionwords/parameter.hbs +1 -0
- data/lib/templates/cucumber/java/actionwords.hbs +12 -0
- data/lib/templates/cucumber/java/parameter.hbs +1 -0
- data/lib/templates/cucumber/javascript/_after_hook.hbs +4 -0
- data/lib/templates/cucumber/javascript/_before_hook.hbs +4 -0
- data/lib/templates/cucumber/javascript/actionword.hbs +6 -0
- data/lib/templates/cucumber/javascript/actionwords.hbs +8 -0
- data/lib/templates/cucumber/parameter.hbs +1 -0
- data/lib/templates/cucumber/typescript/_after_hook.hbs +4 -0
- data/lib/templates/cucumber/typescript/_before_hook.hbs +4 -0
- data/lib/templates/cucumber/typescript/actionword.hbs +5 -0
- data/lib/templates/cucumber/typescript/actionwords.hbs +10 -0
- data/lib/templates/cucumber/typescript/library.hbs +12 -0
- data/lib/templates/cucumber/typescript/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/actionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/actionwords.hbs +10 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/library.hbs +10 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/java/actionword.hbs +6 -0
- data/lib/templates/cucumber_legacy/java/actionwords.hbs +12 -0
- data/lib/templates/cucumber_legacy/typescript/actionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/typescript/libraryactionword.hbs +5 -0
- data/lib/templates/gherkin/_call.hbs +5 -0
- data/lib/templates/gherkin/_gherkin_text.hbs +1 -0
- data/lib/templates/gherkin/_scenario.hbs +18 -0
- data/lib/templates/gherkin/_scenario_outline_title.hbs +1 -0
- data/lib/templates/gherkin/argument.hbs +1 -0
- data/lib/templates/gherkin/call.hbs +1 -0
- data/lib/templates/gherkin/dataset.hbs +1 -0
- data/lib/templates/gherkin/datatable.hbs +2 -0
- data/lib/templates/gherkin/folder.hbs +10 -0
- data/lib/templates/gherkin/inlined_uids/_scenario_outline_title.hbs +1 -0
- data/lib/templates/gherkin/java/single_scenario.hbs +1 -0
- data/lib/templates/gherkin/parameter.hbs +1 -0
- data/lib/templates/gherkin/scenarios.hbs +3 -0
- data/lib/templates/gherkin/single_scenario.hbs +1 -0
- data/lib/templates/gherkin/single_test.hbs +3 -0
- data/lib/templates/gherkin/step.hbs +1 -0
- data/lib/templates/gherkin/stringliteral.hbs +1 -0
- data/lib/templates/gherkin/tag.hbs +1 -0
- data/lib/templates/gherkin/template.hbs +1 -0
- data/lib/templates/groovy/_body.hbs +8 -0
- data/lib/templates/groovy/_desc.hbs +5 -0
- data/lib/templates/groovy/_scenario.hbs +10 -0
- data/lib/templates/groovy/_steps.hbs +4 -0
- data/lib/templates/groovy/_test.hbs +4 -0
- data/lib/templates/groovy/actionword.hbs +2 -0
- data/lib/templates/groovy/actionwords.hbs +7 -0
- data/lib/templates/groovy/assign.hbs +1 -0
- data/lib/templates/groovy/call.hbs +2 -0
- data/lib/templates/groovy/dataset.hbs +1 -0
- data/lib/templates/groovy/datatable.hbs +2 -0
- data/lib/templates/groovy/dict.hbs +1 -0
- data/lib/templates/groovy/folder.hbs +18 -0
- data/lib/templates/groovy/index.hbs +1 -0
- data/lib/templates/groovy/libraries.hbs +9 -0
- data/lib/templates/groovy/library.hbs +8 -0
- data/lib/templates/groovy/libraryactionword.hbs +2 -0
- data/lib/templates/groovy/list.hbs +1 -0
- data/lib/templates/groovy/nullliteral.hbs +1 -0
- data/lib/templates/groovy/parameter.hbs +1 -0
- data/lib/templates/groovy/property.hbs +1 -0
- data/lib/templates/groovy/scenario.hbs +1 -0
- data/lib/templates/groovy/scenarios.hbs +10 -0
- data/lib/templates/groovy/single_scenario.hbs +9 -0
- data/lib/templates/groovy/single_test.hbs +10 -0
- data/lib/templates/groovy/template.hbs +1 -0
- data/lib/templates/groovy/test.hbs +1 -0
- data/lib/templates/groovy/tests.hbs +10 -0
- data/lib/templates/java/_body.hbs +5 -0
- data/lib/templates/java/_item_as_function.hbs +8 -0
- data/lib/templates/java/_scenario.hbs +7 -0
- data/lib/templates/java/actionword.hbs +1 -0
- data/lib/templates/java/actionwords.hbs +8 -0
- data/lib/templates/java/argument.hbs +1 -0
- data/lib/templates/java/assign.hbs +1 -0
- data/lib/templates/java/binaryexpression.hbs +1 -0
- data/lib/templates/java/call.hbs +2 -0
- data/lib/templates/java/dataset.hbs +3 -0
- data/lib/templates/java/dict.hbs +1 -0
- data/lib/templates/java/espresso/_scenario.hbs +8 -0
- data/lib/templates/java/espresso/dataset.hbs +4 -0
- data/lib/templates/java/espresso/folder.hbs +29 -0
- data/lib/templates/java/espresso/scenarios.hbs +23 -0
- data/lib/templates/java/espresso/single_scenario.hbs +24 -0
- data/lib/templates/java/espresso/single_test.hbs +22 -0
- data/lib/templates/java/espresso/tests.hbs +23 -0
- data/lib/templates/java/field.hbs +1 -0
- data/lib/templates/java/folder.hbs +18 -0
- data/lib/templates/java/ifthen.hbs +7 -0
- data/lib/templates/java/index.hbs +1 -0
- data/lib/templates/java/libraries.hbs +9 -0
- data/lib/templates/java/library.hbs +7 -0
- data/lib/templates/java/libraryactionword.hbs +1 -0
- data/lib/templates/java/list.hbs +1 -0
- data/lib/templates/java/nullliteral.hbs +1 -0
- data/lib/templates/java/parameter.hbs +1 -0
- data/lib/templates/java/parenthesis.hbs +1 -0
- data/lib/templates/java/property.hbs +1 -0
- data/lib/templates/java/scenario.hbs +1 -0
- data/lib/templates/java/scenarios.hbs +11 -0
- data/lib/templates/java/single_scenario.hbs +12 -0
- data/lib/templates/java/single_test.hbs +11 -0
- data/lib/templates/java/step.hbs +1 -0
- data/lib/templates/java/stringliteral.hbs +1 -0
- data/lib/templates/java/tag.hbs +1 -0
- data/lib/templates/java/template.hbs +1 -0
- data/lib/templates/java/test.hbs +1 -0
- data/lib/templates/java/testng/_scenario.hbs +8 -0
- data/lib/templates/java/testng/dataset.hbs +4 -0
- data/lib/templates/java/testng/folder.hbs +19 -0
- data/lib/templates/java/testng/scenarios.hbs +16 -0
- data/lib/templates/java/testng/single_scenario.hbs +12 -0
- data/lib/templates/java/testng/single_test.hbs +11 -0
- data/lib/templates/java/testng/tests.hbs +16 -0
- data/lib/templates/java/tests.hbs +11 -0
- data/lib/templates/java/variable.hbs +1 -0
- data/lib/templates/java/while.hbs +4 -0
- data/lib/templates/javascript/_body.hbs +10 -0
- data/lib/templates/javascript/_item_as_function.hbs +3 -0
- data/lib/templates/javascript/_item_as_hash_key.hbs +3 -0
- data/lib/templates/javascript/_module_declaration.hbs +5 -0
- data/lib/templates/javascript/_scenario.hbs +4 -0
- data/lib/templates/javascript/actionword.hbs +1 -0
- data/lib/templates/javascript/actionwords.hbs +4 -0
- data/lib/templates/javascript/argument.hbs +1 -0
- data/lib/templates/javascript/assign.hbs +1 -0
- data/lib/templates/javascript/binaryexpression.hbs +1 -0
- data/lib/templates/javascript/call.hbs +2 -0
- data/lib/templates/javascript/codeceptjs/actionword.hbs +5 -0
- data/lib/templates/javascript/codeceptjs/actionwords.hbs +9 -0
- data/lib/templates/javascript/dataset.hbs +3 -0
- data/lib/templates/javascript/dict.hbs +1 -0
- data/lib/templates/javascript/es6/actionwords.hbs +4 -0
- data/lib/templates/javascript/field.hbs +1 -0
- data/lib/templates/javascript/folder.hbs +14 -0
- data/lib/templates/javascript/ifthen.hbs +7 -0
- data/lib/templates/javascript/index.hbs +1 -0
- data/lib/templates/javascript/jasmine/_before_each.hbs +3 -0
- data/lib/templates/javascript/jasmine/_scenario.hbs +8 -0
- data/lib/templates/javascript/jasmine/dataset.hbs +3 -0
- data/lib/templates/javascript/jasmine/folder.hbs +11 -0
- data/lib/templates/javascript/jasmine/scenarios.hbs +8 -0
- data/lib/templates/javascript/jasmine/single_scenario.hbs +6 -0
- data/lib/templates/javascript/jasmine/single_test.hbs +6 -0
- data/lib/templates/javascript/jasmine/tests.hbs +8 -0
- data/lib/templates/javascript/list.hbs +1 -0
- data/lib/templates/javascript/mocha/_before_each.hbs +4 -0
- data/lib/templates/javascript/mocha/folder.hbs +11 -0
- data/lib/templates/javascript/nullliteral.hbs +1 -0
- data/lib/templates/javascript/parameter.hbs +1 -0
- data/lib/templates/javascript/parenthesis.hbs +1 -0
- data/lib/templates/javascript/project.hbs +2 -0
- data/lib/templates/javascript/property.hbs +1 -0
- data/lib/templates/javascript/scenario.hbs +1 -0
- data/lib/templates/javascript/scenarios.hbs +8 -0
- data/lib/templates/javascript/single_scenario.hbs +6 -0
- data/lib/templates/javascript/single_test.hbs +6 -0
- data/lib/templates/javascript/step.hbs +1 -0
- data/lib/templates/javascript/tag.hbs +1 -0
- data/lib/templates/javascript/template.hbs +1 -0
- data/lib/templates/javascript/test.hbs +1 -0
- data/lib/templates/javascript/tests.hbs +8 -0
- data/lib/templates/javascript/while.hbs +5 -0
- data/lib/templates/jbehave/_scenario.hbs +9 -0
- data/lib/templates/jbehave/actionwords/parameter.hbs +1 -0
- data/lib/templates/jbehave/call.hbs +5 -0
- data/lib/templates/jbehave/folder.hbs +16 -0
- data/lib/templates/jbehave/single_test.hbs +3 -0
- data/lib/templates/jbehave/steps/_gherkin_pattern.hbs +1 -0
- data/lib/templates/jbehave/steps/actionword.hbs +6 -0
- data/lib/templates/jbehave/steps/actionwords.hbs +18 -0
- data/lib/templates/php/_body.hbs +9 -0
- data/lib/templates/php/_item_as_function.hbs +3 -0
- data/lib/templates/php/_scenario.hbs +4 -0
- data/lib/templates/php/_setup.hbs +4 -0
- data/lib/templates/php/actionword.hbs +1 -0
- data/lib/templates/php/actionwords.hbs +9 -0
- data/lib/templates/php/argument.hbs +1 -0
- data/lib/templates/php/assign.hbs +1 -0
- data/lib/templates/php/binaryexpression.hbs +1 -0
- data/lib/templates/php/call.hbs +2 -0
- data/lib/templates/php/dataset.hbs +3 -0
- data/lib/templates/php/dict.hbs +1 -0
- data/lib/templates/php/field.hbs +1 -0
- data/lib/templates/php/folder.hbs +17 -0
- data/lib/templates/php/ifthen.hbs +7 -0
- data/lib/templates/php/index.hbs +1 -0
- data/lib/templates/php/libraries.hbs +11 -0
- data/lib/templates/php/library.hbs +20 -0
- data/lib/templates/php/libraryactionword.hbs +1 -0
- data/lib/templates/php/list.hbs +1 -0
- data/lib/templates/php/nullliteral.hbs +1 -0
- data/lib/templates/php/parameter.hbs +1 -0
- data/lib/templates/php/parenthesis.hbs +1 -0
- data/lib/templates/php/project.hbs +2 -0
- data/lib/templates/php/property.hbs +1 -0
- data/lib/templates/php/scenario.hbs +1 -0
- data/lib/templates/php/scenarios.hbs +13 -0
- data/lib/templates/php/single_scenario.hbs +11 -0
- data/lib/templates/php/single_test.hbs +11 -0
- data/lib/templates/php/step.hbs +1 -0
- data/lib/templates/php/tag.hbs +1 -0
- data/lib/templates/php/template.hbs +1 -0
- data/lib/templates/php/test.hbs +1 -0
- data/lib/templates/php/tests.hbs +13 -0
- data/lib/templates/php/variable.hbs +1 -0
- data/lib/templates/php/while.hbs +5 -0
- data/lib/templates/python/_body.hbs +11 -0
- data/lib/templates/python/_item_as_def.hbs +2 -0
- data/lib/templates/python/_parameters.hbs +1 -0
- data/lib/templates/python/_scenario.hbs +4 -0
- data/lib/templates/python/actionword.hbs +1 -0
- data/lib/templates/python/actionwords.hbs +12 -0
- data/lib/templates/python/argument.hbs +1 -0
- data/lib/templates/python/assign.hbs +1 -0
- data/lib/templates/python/binaryexpression.hbs +1 -0
- data/lib/templates/python/booleanliteral.hbs +1 -0
- data/lib/templates/python/call.hbs +2 -0
- data/lib/templates/python/dataset.hbs +2 -0
- data/lib/templates/python/dict.hbs +1 -0
- data/lib/templates/python/field.hbs +1 -0
- data/lib/templates/python/folder.hbs +12 -0
- data/lib/templates/python/ifthen.hbs +4 -0
- data/lib/templates/python/index.hbs +1 -0
- data/lib/templates/python/libraries.hbs +9 -0
- data/lib/templates/python/library.hbs +17 -0
- data/lib/templates/python/libraryactionword.hbs +1 -0
- data/lib/templates/python/list.hbs +1 -0
- data/lib/templates/python/nullliteral.hbs +1 -0
- data/lib/templates/python/parameter.hbs +1 -0
- data/lib/templates/python/parenthesis.hbs +1 -0
- data/lib/templates/python/project.hbs +2 -0
- data/lib/templates/python/property.hbs +1 -0
- data/lib/templates/python/scenario.hbs +1 -0
- data/lib/templates/python/scenarios.hbs +11 -0
- data/lib/templates/python/single_scenario.hbs +9 -0
- data/lib/templates/python/single_test.hbs +9 -0
- data/lib/templates/python/step.hbs +1 -0
- data/lib/templates/python/tag.hbs +1 -0
- data/lib/templates/python/template.hbs +1 -0
- data/lib/templates/python/test.hbs +1 -0
- data/lib/templates/python/tests.hbs +11 -0
- data/lib/templates/python/unittest/actionwords.hbs +9 -0
- data/lib/templates/python/while.hbs +4 -0
- data/lib/templates/robotframework/_keyword.hbs +1 -0
- data/lib/templates/robotframework/_keyword_body.hbs +4 -0
- data/lib/templates/robotframework/_scenario.hbs +12 -0
- data/lib/templates/robotframework/actionword.hbs +3 -0
- data/lib/templates/robotframework/actionwords.hbs +4 -0
- data/lib/templates/robotframework/argument.hbs +1 -0
- data/lib/templates/robotframework/call.hbs +1 -0
- data/lib/templates/robotframework/dataset.hbs +1 -0
- data/lib/templates/robotframework/datatable.hbs +2 -0
- data/lib/templates/robotframework/folder.hbs +35 -0
- data/lib/templates/robotframework/ifthen.hbs +1 -0
- data/lib/templates/robotframework/parameter.hbs +1 -0
- data/lib/templates/robotframework/property.hbs +1 -0
- data/lib/templates/robotframework/scenarios.hbs +25 -0
- data/lib/templates/robotframework/single_scenario.hbs +10 -0
- data/lib/templates/robotframework/single_test.hbs +10 -0
- data/lib/templates/robotframework/stringliteral.hbs +1 -0
- data/lib/templates/robotframework/template.hbs +1 -0
- data/lib/templates/robotframework/test.hbs +1 -0
- data/lib/templates/robotframework/tests.hbs +7 -0
- data/lib/templates/robotframework/variable.hbs +1 -0
- data/lib/templates/robotframework/while.hbs +1 -0
- data/lib/templates/ruby/_body.hbs +10 -0
- data/lib/templates/ruby/_item_as_def.hbs +3 -0
- data/lib/templates/ruby/_scenario.hbs +5 -0
- data/lib/templates/ruby/actionword.hbs +1 -0
- data/lib/templates/ruby/actionwords.hbs +6 -0
- data/lib/templates/ruby/argument.hbs +1 -0
- data/lib/templates/ruby/assign.hbs +1 -0
- data/lib/templates/ruby/binaryexpression.hbs +1 -0
- data/lib/templates/ruby/call.hbs +2 -0
- data/lib/templates/ruby/dataset.hbs +3 -0
- data/lib/templates/ruby/dict.hbs +1 -0
- data/lib/templates/ruby/field.hbs +1 -0
- data/lib/templates/ruby/folder.hbs +16 -0
- data/lib/templates/ruby/ifthen.hbs +7 -0
- data/lib/templates/ruby/index.hbs +1 -0
- data/lib/templates/ruby/list.hbs +1 -0
- data/lib/templates/ruby/minitest/_item_as_def.hbs +3 -0
- data/lib/templates/ruby/minitest/_scenario.hbs +4 -0
- data/lib/templates/ruby/minitest/dataset.hbs +3 -0
- data/lib/templates/ruby/minitest/folder.hbs +18 -0
- data/lib/templates/ruby/minitest/scenario.hbs +1 -0
- data/lib/templates/ruby/minitest/scenarios.hbs +13 -0
- data/lib/templates/ruby/minitest/single_scenario.hbs +11 -0
- data/lib/templates/ruby/minitest/single_test.hbs +11 -0
- data/lib/templates/ruby/minitest/test.hbs +1 -0
- data/lib/templates/ruby/minitest/tests.hbs +13 -0
- data/lib/templates/ruby/parameter.hbs +1 -0
- data/lib/templates/ruby/parenthesis.hbs +1 -0
- data/lib/templates/ruby/project.hbs +2 -0
- data/lib/templates/ruby/property.hbs +1 -0
- data/lib/templates/ruby/scenario.hbs +1 -0
- data/lib/templates/ruby/scenarios.hbs +12 -0
- data/lib/templates/ruby/single_scenario.hbs +11 -0
- data/lib/templates/ruby/single_test.hbs +11 -0
- data/lib/templates/ruby/step.hbs +1 -0
- data/lib/templates/ruby/symbol.hbs +1 -0
- data/lib/templates/ruby/tag.hbs +1 -0
- data/lib/templates/ruby/template.hbs +1 -0
- data/lib/templates/ruby/test.hbs +1 -0
- data/lib/templates/ruby/tests.hbs +12 -0
- data/lib/templates/ruby/while.hbs +5 -0
- data/lib/templates/seleniumide/argument.hbs +1 -0
- data/lib/templates/seleniumide/call.hbs +6 -0
- data/lib/templates/seleniumide/single_test.hbs +28 -0
- data/lib/templates/seleniumide/step.hbs +0 -0
- data/lib/templates/seleniumide/stringliteral.hbs +1 -0
- data/lib/templates/seleniumide/template.hbs +1 -0
- data/lib/templates/seleniumide/test.hbs +4 -0
- data/lib/templates/seleniumide/tests.hbs +19 -0
- data/lib/templates/specflow/actionword.hbs +6 -0
- data/lib/templates/specflow/actionwords/parameter.hbs +1 -0
- data/lib/templates/specflow/actionwords.hbs +14 -0
- data/lib/templates/specflow/gherkin/tag.hbs +1 -0
- data/lib/templates/specflow/parameter.hbs +1 -0
- data/lib/templates/swift/_body.hbs +11 -0
- data/lib/templates/swift/_item_as_def.hbs +5 -0
- data/lib/templates/swift/_scenario.hbs +7 -0
- data/lib/templates/swift/actionword.hbs +1 -0
- data/lib/templates/swift/actionwords.hbs +6 -0
- data/lib/templates/swift/argument.hbs +1 -0
- data/lib/templates/swift/assign.hbs +1 -0
- data/lib/templates/swift/binaryexpression.hbs +1 -0
- data/lib/templates/swift/call.hbs +2 -0
- data/lib/templates/swift/dataset.hbs +4 -0
- data/lib/templates/swift/dict.hbs +1 -0
- data/lib/templates/swift/field.hbs +1 -0
- data/lib/templates/swift/folder.hbs +23 -0
- data/lib/templates/swift/ifthen.hbs +7 -0
- data/lib/templates/swift/index.hbs +1 -0
- data/lib/templates/swift/list.hbs +1 -0
- data/lib/templates/swift/parameter.hbs +1 -0
- data/lib/templates/swift/parenthesis.hbs +1 -0
- data/lib/templates/swift/project.hbs +2 -0
- data/lib/templates/swift/property.hbs +1 -0
- data/lib/templates/swift/scenario.hbs +1 -0
- data/lib/templates/swift/scenarios.hbs +25 -0
- data/lib/templates/swift/single_scenario.hbs +24 -0
- data/lib/templates/swift/single_test.hbs +23 -0
- data/lib/templates/swift/step.hbs +1 -0
- data/lib/templates/swift/stringliteral.hbs +1 -0
- data/lib/templates/swift/symbol.hbs +1 -0
- data/lib/templates/swift/tag.hbs +1 -0
- data/lib/templates/swift/template.hbs +1 -0
- data/lib/templates/swift/test.hbs +1 -0
- data/lib/templates/swift/tests.hbs +25 -0
- data/lib/templates/swift/while.hbs +5 -0
- data/lib/templates/typescript/_item_as_function.hbs +3 -0
- data/lib/templates/typescript/actionword.hbs +1 -0
- data/lib/templates/typescript/actionwords.hbs +7 -0
- data/lib/templates/typescript/libraries.hbs +9 -0
- data/lib/templates/typescript/library.hbs +18 -0
- data/lib/templates/typescript/libraryactionword.hbs +1 -0
- data/lib/templates/typescript/parameter.hbs +1 -0
- metadata +783 -0
@@ -0,0 +1,601 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
require 'hiptest-publisher/string'
|
4
|
+
require 'hiptest-publisher/utils'
|
5
|
+
require 'hiptest-publisher/renderer'
|
6
|
+
|
7
|
+
module Hiptest
|
8
|
+
module Nodes
|
9
|
+
class Node
|
10
|
+
attr_reader :children, :parent
|
11
|
+
attr_writer :parent
|
12
|
+
|
13
|
+
def pretty_print_instance_variables
|
14
|
+
super - [:@parent] # do not overload pry output
|
15
|
+
end
|
16
|
+
|
17
|
+
def render(rendering_context)
|
18
|
+
return Hiptest::Renderer.render(self, rendering_context)
|
19
|
+
end
|
20
|
+
|
21
|
+
def each_sub_nodes(*types, deep: false)
|
22
|
+
return to_enum(:each_sub_nodes, *types, deep: deep) unless block_given?
|
23
|
+
path = [self]
|
24
|
+
parsed_nodes_id = Set.new
|
25
|
+
|
26
|
+
until path.empty?
|
27
|
+
current_node = path.shift
|
28
|
+
|
29
|
+
if current_node.is_a?(Node)
|
30
|
+
next if parsed_nodes_id.include? current_node.object_id
|
31
|
+
parsed_nodes_id << current_node.object_id
|
32
|
+
|
33
|
+
if types.empty? || types.any? {|type| current_node.is_a?(type)}
|
34
|
+
yield current_node
|
35
|
+
next unless deep
|
36
|
+
end
|
37
|
+
current_node.children.each_value {|item| path << item}
|
38
|
+
elsif current_node.is_a?(Array)
|
39
|
+
current_node.each {|item| path << item}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def each_direct_children
|
45
|
+
children.each_value do |child|
|
46
|
+
if child.is_a? Hiptest::Nodes::Node
|
47
|
+
yield child
|
48
|
+
elsif child.is_a? Array
|
49
|
+
child.each {|c| yield c if c.is_a? Hiptest::Nodes::Node }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def ==(other)
|
55
|
+
other.class == self.class && other.children == @children
|
56
|
+
end
|
57
|
+
|
58
|
+
def project
|
59
|
+
project = self
|
60
|
+
while project && !project.is_a?(Hiptest::Nodes::Project)
|
61
|
+
project = project.parent
|
62
|
+
end
|
63
|
+
project
|
64
|
+
end
|
65
|
+
|
66
|
+
def kind
|
67
|
+
node_kinds[self.class] ||= begin
|
68
|
+
self.class.name.split('::').last.downcase
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def flat_string
|
73
|
+
flat_childs = children.map do |key, value|
|
74
|
+
"#{key}: #{flatten_child(value)}"
|
75
|
+
end.join(", ")
|
76
|
+
"<#{self.class.name} [#{flat_childs}]>"
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def node_kinds
|
82
|
+
@@node_kinds ||= {}
|
83
|
+
end
|
84
|
+
|
85
|
+
def flatten_child(child)
|
86
|
+
return child.flat_string if child.is_a?(Node)
|
87
|
+
if child.is_a?(Array)
|
88
|
+
return child.map {|item| flatten_child(item)}
|
89
|
+
end
|
90
|
+
child.to_s
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class Literal < Node
|
95
|
+
def initialize(value)
|
96
|
+
super()
|
97
|
+
@children = {value: value}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class NullLiteral < Node
|
102
|
+
def initialize
|
103
|
+
super()
|
104
|
+
@children = {}
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class StringLiteral < Literal
|
109
|
+
end
|
110
|
+
|
111
|
+
class NumericLiteral < Literal
|
112
|
+
end
|
113
|
+
|
114
|
+
class BooleanLiteral < Literal
|
115
|
+
end
|
116
|
+
|
117
|
+
class Variable < Node
|
118
|
+
def initialize(name)
|
119
|
+
super()
|
120
|
+
@children = {name: name}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
class Symbol < Node
|
125
|
+
def initialize(value, delimiter)
|
126
|
+
super()
|
127
|
+
@children = {delimiter: delimiter, value: value}
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class Property < Node
|
132
|
+
def initialize(key, value)
|
133
|
+
super()
|
134
|
+
@children = {key: key, value: value}
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
class Field < Node
|
139
|
+
def initialize(base, name)
|
140
|
+
super()
|
141
|
+
@children = {base: base, name: name}
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class Index < Node
|
146
|
+
def initialize(base, expression)
|
147
|
+
super()
|
148
|
+
@children = {base: base, expression: expression}
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class BinaryExpression < Node
|
153
|
+
def initialize(left, operator, right)
|
154
|
+
super()
|
155
|
+
@children = {operator: operator, left: left, right: right}
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
class UnaryExpression < Node
|
160
|
+
def initialize(operator, expression)
|
161
|
+
super()
|
162
|
+
@children = {operator: operator, expression: expression}
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
class Parenthesis < Node
|
167
|
+
def initialize(content)
|
168
|
+
super()
|
169
|
+
@children = {content: content}
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
class List < Node
|
174
|
+
def initialize(items)
|
175
|
+
super()
|
176
|
+
@children = {items: items}
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class Dict < Node
|
181
|
+
def initialize(items)
|
182
|
+
super()
|
183
|
+
@children = {items: items}
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class Template < Node
|
188
|
+
def initialize(chunks)
|
189
|
+
super()
|
190
|
+
@children = {chunks: chunks}
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
class Assign < Node
|
195
|
+
def initialize(to, value)
|
196
|
+
super()
|
197
|
+
@children = {to: to, value: value}
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class Argument < Node
|
202
|
+
def initialize(name, value)
|
203
|
+
super()
|
204
|
+
@children = {name: name, value: value}
|
205
|
+
end
|
206
|
+
|
207
|
+
def free_text?
|
208
|
+
@children[:name] == "__free_text"
|
209
|
+
end
|
210
|
+
|
211
|
+
def datatable?
|
212
|
+
@children[:name] == "__datatable"
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
class Call < Node
|
217
|
+
attr_reader :chunks, :extra_inlined_arguments
|
218
|
+
attr_writer :chunks, :extra_inlined_arguments
|
219
|
+
|
220
|
+
def initialize(actionword, arguments = [], annotation = nil)
|
221
|
+
super()
|
222
|
+
annotation = nil if annotation == ""
|
223
|
+
@children = {actionword: actionword, arguments: arguments, all_arguments: arguments, annotation: annotation}
|
224
|
+
|
225
|
+
@chunks = []
|
226
|
+
@extra_inlined_arguments = []
|
227
|
+
end
|
228
|
+
|
229
|
+
def free_text_arg
|
230
|
+
children[:arguments].find(&:free_text?)
|
231
|
+
end
|
232
|
+
|
233
|
+
def datatable_arg
|
234
|
+
children[:arguments].find(&:datatable?)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
class IfThen < Node
|
239
|
+
def initialize(condition, then_, else_ = [])
|
240
|
+
super()
|
241
|
+
@children = {condition: condition, then: then_, else: else_}
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
class Step < Node
|
246
|
+
def initialize(key, value)
|
247
|
+
super()
|
248
|
+
@children = {key: key, value: value}
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
class While < Node
|
253
|
+
def initialize(condition, body)
|
254
|
+
super()
|
255
|
+
@children = {condition: condition, body: body}
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
class Tag < Node
|
260
|
+
def initialize(key, value = nil)
|
261
|
+
super()
|
262
|
+
@children = {key: key, value: value}
|
263
|
+
end
|
264
|
+
|
265
|
+
def to_s
|
266
|
+
"#{@children[:key]}#{@children[:value].nil? ? '' : ':' + @children[:value]}"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
class Parameter < Node
|
271
|
+
def initialize(name, default = nil)
|
272
|
+
super()
|
273
|
+
@children = {name: name, default: default}
|
274
|
+
end
|
275
|
+
|
276
|
+
def type
|
277
|
+
if @children[:type].nil?
|
278
|
+
'String'
|
279
|
+
else
|
280
|
+
@children[:type].to_s
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
def free_text?
|
285
|
+
@children[:name] == "__free_text"
|
286
|
+
end
|
287
|
+
|
288
|
+
def datatable?
|
289
|
+
@children[:name] == "__datatable"
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
class Item < Node
|
294
|
+
attr_reader :variables, :non_valued_parameters, :valued_parameters
|
295
|
+
|
296
|
+
def initialize(name, tags = [], description = '', parameters = [], body = [])
|
297
|
+
super()
|
298
|
+
@children = {
|
299
|
+
name: name,
|
300
|
+
tags: tags,
|
301
|
+
description: description,
|
302
|
+
parameters: parameters,
|
303
|
+
body: body
|
304
|
+
}
|
305
|
+
end
|
306
|
+
|
307
|
+
def declared_variables_names
|
308
|
+
p_names = children[:parameters].map {|p| p.children[:name]}
|
309
|
+
each_sub_nodes(Hiptest::Nodes::Variable).map do |var|
|
310
|
+
v_name = var.children[:name]
|
311
|
+
p_names.include?(v_name) ? nil : v_name
|
312
|
+
end.uniq.compact
|
313
|
+
end
|
314
|
+
|
315
|
+
def add_tags(tags)
|
316
|
+
existing = @children[:tags].map(&:to_s)
|
317
|
+
|
318
|
+
tags.each do |tag|
|
319
|
+
next if existing.include? tag.to_s
|
320
|
+
|
321
|
+
existing << tag.to_s
|
322
|
+
@children[:tags] << tag
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
class Actionword < Item
|
328
|
+
attr_reader :chunks, :extra_inlined_parameters, :uniq_name
|
329
|
+
attr_writer :chunks, :extra_inlined_parameters, :uniq_name
|
330
|
+
|
331
|
+
def initialize(name, tags = [], parameters = [], body = [], uid = nil, description = '')
|
332
|
+
super(name, tags, description, parameters, body)
|
333
|
+
@children[:uid] = uid
|
334
|
+
|
335
|
+
@chunks = []
|
336
|
+
@extra_inlined_parameters = []
|
337
|
+
@uniq_name = name
|
338
|
+
end
|
339
|
+
|
340
|
+
def must_be_implemented?
|
341
|
+
@children[:body].empty? || @children[:body].map {|step| step.class}.compact.include?(Hiptest::Nodes::Step)
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
class LibraryActionword < Item
|
346
|
+
attr_reader :chunks, :extra_inlined_parameters, :uniq_name
|
347
|
+
attr_writer :chunks, :extra_inlined_parameters, :uniq_name
|
348
|
+
|
349
|
+
def initialize(name, tags = [], parameters = [], body = [], uid = nil, description = '')
|
350
|
+
super(name, tags, description, parameters, body)
|
351
|
+
@children[:uid] = uid
|
352
|
+
|
353
|
+
@chunks = []
|
354
|
+
@extra_inlined_parameters = []
|
355
|
+
@uniq_name = name
|
356
|
+
end
|
357
|
+
|
358
|
+
def must_be_implemented?
|
359
|
+
@children[:body].empty? || @children[:body].map {|step| step.class}.compact.include?(Hiptest::Nodes::Step)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
class Scenario < Item
|
364
|
+
attr_reader :folder_uid, :order_in_parent
|
365
|
+
|
366
|
+
def initialize(name, description = '', tags = [], parameters = [], body = [], folder_uid = nil, datatable = Datatable.new, order_in_parent = 0)
|
367
|
+
super(name, tags, description, parameters, body)
|
368
|
+
@children[:datatable] = datatable
|
369
|
+
|
370
|
+
@folder_uid = folder_uid
|
371
|
+
@order_in_parent = order_in_parent
|
372
|
+
end
|
373
|
+
|
374
|
+
def set_uid(uid)
|
375
|
+
@children[:uid] = uid
|
376
|
+
end
|
377
|
+
|
378
|
+
def folder
|
379
|
+
project && project.children[:test_plan] && project.children[:test_plan].find_folder_by_uid(folder_uid)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
class Test < Node
|
384
|
+
def initialize(name, description = '', tags = [], body = [])
|
385
|
+
super()
|
386
|
+
|
387
|
+
@children = {
|
388
|
+
name: name,
|
389
|
+
description: description,
|
390
|
+
tags: tags,
|
391
|
+
body: body
|
392
|
+
}
|
393
|
+
end
|
394
|
+
|
395
|
+
def folder
|
396
|
+
nil
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
class Datatable < Node
|
401
|
+
def initialize(datasets = [])
|
402
|
+
super()
|
403
|
+
|
404
|
+
@children = {
|
405
|
+
datasets: datasets
|
406
|
+
}
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
class Dataset < Node
|
411
|
+
def initialize(name, arguments = [], uid = nil)
|
412
|
+
super()
|
413
|
+
|
414
|
+
@children = {
|
415
|
+
name: name,
|
416
|
+
uid: uid,
|
417
|
+
arguments: arguments
|
418
|
+
}
|
419
|
+
end
|
420
|
+
|
421
|
+
def set_test_snapshot_uid(uid)
|
422
|
+
@children[:test_snapshot_uid] = uid
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
class Actionwords < Node
|
427
|
+
attr_reader :to_implement, :no_implement
|
428
|
+
def initialize(actionwords = [])
|
429
|
+
super()
|
430
|
+
@children = {actionwords: actionwords}
|
431
|
+
mark_actionwords_for_implementation
|
432
|
+
index_actionwords
|
433
|
+
end
|
434
|
+
|
435
|
+
def find_actionword(name)
|
436
|
+
return @actionwords_index[name]
|
437
|
+
end
|
438
|
+
|
439
|
+
private
|
440
|
+
def mark_actionwords_for_implementation
|
441
|
+
@to_implement = []
|
442
|
+
@no_implement = []
|
443
|
+
|
444
|
+
@children[:actionwords].each do |aw|
|
445
|
+
if aw.must_be_implemented?
|
446
|
+
@to_implement << aw
|
447
|
+
else
|
448
|
+
@no_implement << aw
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def index_actionwords
|
454
|
+
@actionwords_index = {}
|
455
|
+
|
456
|
+
@children[:actionwords].each do |aw|
|
457
|
+
@actionwords_index[aw.children[:name]] = aw
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
class Scenarios < Node
|
463
|
+
def initialize(scenarios = [])
|
464
|
+
super()
|
465
|
+
@children = {scenarios: scenarios}
|
466
|
+
scenarios.each {|sc| sc.parent = self}
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
class Tests < Node
|
471
|
+
def initialize(tests = [])
|
472
|
+
super()
|
473
|
+
@children = {tests: tests}
|
474
|
+
tests.each {|test| test.parent = self}
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
class Folder < Node
|
479
|
+
attr_reader :uid, :parent_uid, :order_in_parent
|
480
|
+
|
481
|
+
def initialize(uid, parent_uid, name, description, tags = [], order_in_parent = 0, body = [])
|
482
|
+
super()
|
483
|
+
@uid = uid
|
484
|
+
@parent_uid = parent_uid
|
485
|
+
@order_in_parent = order_in_parent
|
486
|
+
|
487
|
+
@children = {
|
488
|
+
name: name,
|
489
|
+
description: description,
|
490
|
+
subfolders: [],
|
491
|
+
scenarios: [],
|
492
|
+
tags: tags,
|
493
|
+
body: body
|
494
|
+
}
|
495
|
+
end
|
496
|
+
|
497
|
+
def root?
|
498
|
+
parent_uid == nil
|
499
|
+
end
|
500
|
+
|
501
|
+
def folder
|
502
|
+
root? ? nil : parent
|
503
|
+
end
|
504
|
+
|
505
|
+
def ancestors
|
506
|
+
ancestors = []
|
507
|
+
|
508
|
+
current_ancestor = folder
|
509
|
+
until current_ancestor.nil?
|
510
|
+
ancestors << current_ancestor
|
511
|
+
current_ancestor = current_ancestor.folder
|
512
|
+
end
|
513
|
+
|
514
|
+
ancestors
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
class TestPlan < Node
|
519
|
+
def initialize(folders = [])
|
520
|
+
super()
|
521
|
+
@uids_mapping = {}
|
522
|
+
@children = {
|
523
|
+
root_folder: nil,
|
524
|
+
folders: folders
|
525
|
+
}
|
526
|
+
end
|
527
|
+
|
528
|
+
def organize_folders
|
529
|
+
@children[:root_folder] = @children[:folders].find(&:root?)
|
530
|
+
@children[:root_folder].parent = self if @children[:root_folder]
|
531
|
+
|
532
|
+
@children[:folders].each do |folder|
|
533
|
+
@uids_mapping[folder.uid] = folder
|
534
|
+
end
|
535
|
+
|
536
|
+
@children[:folders].each do |folder|
|
537
|
+
next if folder.root?
|
538
|
+
|
539
|
+
parent = find_folder_by_uid(folder.parent_uid) || @children[:root_folder]
|
540
|
+
folder.parent = parent
|
541
|
+
parent.children[:subfolders] << folder unless parent.children[:subfolders].include?(folder)
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
def find_folder_by_uid(uid)
|
546
|
+
return @uids_mapping[uid]
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
class Libraries < Node
|
551
|
+
def initialize(libraries = [])
|
552
|
+
super()
|
553
|
+
@children = {
|
554
|
+
libraries: libraries
|
555
|
+
}
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
class Library < Node
|
560
|
+
def initialize(name = 'default_library', library_actionwords = [])
|
561
|
+
super()
|
562
|
+
@children = {
|
563
|
+
name: name,
|
564
|
+
library_actionwords: library_actionwords
|
565
|
+
}
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
class Project < Node
|
570
|
+
def initialize(name, description = '', test_plan = TestPlan.new, scenarios = Scenarios.new, actionwords = Actionwords.new, tests = Tests.new, libraries = Libraries.new)
|
571
|
+
super()
|
572
|
+
test_plan.parent = self if test_plan.respond_to?(:parent=)
|
573
|
+
scenarios.parent = self
|
574
|
+
tests.parent = self
|
575
|
+
|
576
|
+
@children = {
|
577
|
+
name: name,
|
578
|
+
description: description,
|
579
|
+
test_plan: test_plan,
|
580
|
+
scenarios: scenarios,
|
581
|
+
actionwords: actionwords,
|
582
|
+
tests: tests,
|
583
|
+
libraries: libraries
|
584
|
+
}
|
585
|
+
end
|
586
|
+
|
587
|
+
def has_libraries?
|
588
|
+
!children[:libraries].children[:libraries].empty?
|
589
|
+
end
|
590
|
+
|
591
|
+
def assign_scenarios_to_folders
|
592
|
+
@children[:scenarios].children[:scenarios].each do |scenario|
|
593
|
+
folder = @children[:test_plan].find_folder_by_uid(scenario.folder_uid)
|
594
|
+
next if folder.nil?
|
595
|
+
|
596
|
+
folder.children[:scenarios] << scenario
|
597
|
+
end
|
598
|
+
end
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Hiptest
|
2
|
+
module Nodes
|
3
|
+
class Walker
|
4
|
+
|
5
|
+
def walk_node(node)
|
6
|
+
walk_children(node)
|
7
|
+
|
8
|
+
node.each {|item| walk_node(item)} if node.is_a? Array
|
9
|
+
call_node_walker(node)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def walk_children(node)
|
15
|
+
return unless node.is_a? Hiptest::Nodes::Node
|
16
|
+
node.children.each_value {|child| walk_node(child)}
|
17
|
+
end
|
18
|
+
|
19
|
+
def call_node_walker(node)
|
20
|
+
return unless node.is_a? Hiptest::Nodes::Node
|
21
|
+
|
22
|
+
if respond_to? walk_method_name(node)
|
23
|
+
self.send(walk_method_name(node), node)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
WALK_METHOD_NAMES = {}
|
28
|
+
|
29
|
+
def walk_method_name(node)
|
30
|
+
WALK_METHOD_NAMES[node.class] ||= "walk_#{node.kind}".to_sym
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|