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,32 @@
|
|
1
|
+
module Hiptest
|
2
|
+
class LibraryActionwordIndexer
|
3
|
+
def initialize(project)
|
4
|
+
@project = project
|
5
|
+
@indexed = {}
|
6
|
+
index_library_actionwords
|
7
|
+
end
|
8
|
+
|
9
|
+
def index_library_actionwords
|
10
|
+
@project.each_sub_nodes(Hiptest::Nodes::LibraryActionword) do |aw|
|
11
|
+
aw_name = aw.children[:name]
|
12
|
+
indexed_parameters = {}
|
13
|
+
|
14
|
+
aw.children[:parameters].map do |param|
|
15
|
+
param_name = param.children[:name]
|
16
|
+
indexed_parameters[param_name] = param.children[:default]
|
17
|
+
end
|
18
|
+
|
19
|
+
data = {
|
20
|
+
actionword: aw,
|
21
|
+
parameters: indexed_parameters
|
22
|
+
}
|
23
|
+
|
24
|
+
@indexed[aw_name] = data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_index(name)
|
29
|
+
@indexed[name]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Hiptest
|
2
|
+
module NodeModifiers
|
3
|
+
class ActionwordUniqRenamer
|
4
|
+
def self.add(project)
|
5
|
+
self.new(project).make_uniq_names
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(project)
|
9
|
+
@project = project
|
10
|
+
end
|
11
|
+
|
12
|
+
def make_uniq_names
|
13
|
+
@project.children[:libraries].children[:libraries].each do |library|
|
14
|
+
library.children[:library_actionwords].each do |library_actionword|
|
15
|
+
existing_names = library.children[:library_actionwords].reject{|aw| aw == library_actionword}.map(&:uniq_name)
|
16
|
+
new_name = find_uniq_name(library_actionword.children[:name], existing_names)
|
17
|
+
library_actionword.uniq_name = new_name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_uniq_name(name, existing)
|
23
|
+
return name unless existing.include?(name)
|
24
|
+
|
25
|
+
index = 1
|
26
|
+
new_name = ""
|
27
|
+
|
28
|
+
loop do
|
29
|
+
new_name = "#{name} #{index}"
|
30
|
+
|
31
|
+
break unless existing.include?(new_name)
|
32
|
+
index += 1
|
33
|
+
end
|
34
|
+
|
35
|
+
new_name
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'hiptest-publisher/node_modifiers/actionword_uniq_renamer'
|
2
|
+
require 'hiptest-publisher/node_modifiers/call_arguments_adder'
|
3
|
+
require 'hiptest-publisher/node_modifiers/datatable_fixer'
|
4
|
+
require 'hiptest-publisher/node_modifiers/gherkin_adder'
|
5
|
+
require 'hiptest-publisher/node_modifiers/items_orderer'
|
6
|
+
require 'hiptest-publisher/node_modifiers/parameter_type_adder'
|
7
|
+
require 'hiptest-publisher/node_modifiers/parent_adder'
|
8
|
+
|
9
|
+
module Hiptest
|
10
|
+
module NodeModifiers
|
11
|
+
def self.add_all(project, sort_method = nil)
|
12
|
+
DatatableFixer.add(project)
|
13
|
+
ParentAdder.add(project)
|
14
|
+
ParameterTypeAdder.add(project)
|
15
|
+
DefaultArgumentAdder.add(project)
|
16
|
+
ActionwordUniqRenamer.add(project)
|
17
|
+
GherkinAdder.add(project)
|
18
|
+
ItemsOrderer.add(project, sort_method) unless sort_method.nil?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'hiptest-publisher/indexers/actionword_indexer'
|
2
|
+
require 'hiptest-publisher/indexers/library_actionword_indexer'
|
3
|
+
require 'hiptest-publisher/nodes'
|
4
|
+
|
5
|
+
module Hiptest
|
6
|
+
module NodeModifiers
|
7
|
+
class DefaultArgumentAdder
|
8
|
+
def self.add(project)
|
9
|
+
self.new(project).update_calls
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(project)
|
13
|
+
@project = project
|
14
|
+
@library_indexer = LibraryActionwordIndexer.new(project)
|
15
|
+
@indexer = ActionwordIndexer.new(project)
|
16
|
+
end
|
17
|
+
|
18
|
+
def update_calls
|
19
|
+
@project.each_sub_nodes(Hiptest::Nodes::Call) do |call|
|
20
|
+
actionword = @library_indexer.get_index(call.children[:actionword])
|
21
|
+
actionword = @indexer.get_index(call.children[:actionword]) if actionword.nil?
|
22
|
+
|
23
|
+
update_call(call, actionword)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def update_call(call, aw_data)
|
30
|
+
return if aw_data.nil?
|
31
|
+
|
32
|
+
arguments = {}
|
33
|
+
call.children[:arguments].each do |arg|
|
34
|
+
arguments[arg.children[:name]] = arg.children[:value]
|
35
|
+
end
|
36
|
+
|
37
|
+
call.children[:all_arguments] = aw_data[:parameters].map do |p_name, default_value|
|
38
|
+
Hiptest::Nodes::Argument.new(
|
39
|
+
p_name,
|
40
|
+
arguments.has_key?(p_name) ? arguments[p_name] : default_value
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'hiptest-publisher/nodes_walker'
|
2
|
+
|
3
|
+
module Hiptest
|
4
|
+
module NodeModifiers
|
5
|
+
class DatatableFixer < Nodes::Walker
|
6
|
+
def self.add(project)
|
7
|
+
self.new.walk_node(project)
|
8
|
+
end
|
9
|
+
|
10
|
+
def walk_scenario(scenario)
|
11
|
+
return if scenario.children[:datatable].nil?
|
12
|
+
|
13
|
+
@argument_names = scenario.children[:parameters].map{|param| param.children[:name]}
|
14
|
+
|
15
|
+
scenario.children[:datatable].children[:datasets].map do |dataset|
|
16
|
+
arguments_mapping = {}
|
17
|
+
dataset.children[:arguments].map do |arg|
|
18
|
+
arguments_mapping[arg.children[:name]] = arg
|
19
|
+
end
|
20
|
+
|
21
|
+
dataset.children[:arguments] = @argument_names.map do |arg_name|
|
22
|
+
if arguments_mapping.has_key?(arg_name)
|
23
|
+
arguments_mapping[arg_name]
|
24
|
+
else
|
25
|
+
Hiptest::Nodes::Argument.new(arg_name, Hiptest::Nodes::StringLiteral.new(''))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
require 'hiptest-publisher/indexers/actionword_indexer'
|
2
|
+
require 'hiptest-publisher/indexers/library_actionword_indexer'
|
3
|
+
require 'hiptest-publisher/nodes'
|
4
|
+
|
5
|
+
module Hiptest
|
6
|
+
module NodeModifiers
|
7
|
+
class GherkinAdder
|
8
|
+
def self.add(project)
|
9
|
+
self.new(project).update_calls
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(project)
|
13
|
+
@project = project
|
14
|
+
@indexer = ActionwordIndexer.new(project)
|
15
|
+
@library_indexer = LibraryActionwordIndexer.new(project)
|
16
|
+
@annotations_counter = AnnotationsCounter.new
|
17
|
+
|
18
|
+
@special_params = ['__free_text', '__datatable']
|
19
|
+
end
|
20
|
+
|
21
|
+
def update_calls
|
22
|
+
@project.each_sub_nodes(Hiptest::Nodes::Scenario, Hiptest::Nodes::Actionword, Hiptest::Nodes::Test, Hiptest::Nodes::Folder) do |item|
|
23
|
+
@last_annotation = nil
|
24
|
+
item.each_sub_nodes(Hiptest::Nodes::Call) do |call|
|
25
|
+
set_call_chunks(call)
|
26
|
+
call.children[:gherkin_text] ||= "#{text_annotation(call)} #{prettified(call)}"
|
27
|
+
|
28
|
+
if actionword = get_actionword(call)
|
29
|
+
if actionword.is_a?(Hiptest::Nodes::LibraryActionword)
|
30
|
+
call.children[:library_name] = actionword.parent.children[:name]
|
31
|
+
end
|
32
|
+
@annotations_counter.increment(actionword, code_annotation(call))
|
33
|
+
set_actionwords_chunks(actionword)
|
34
|
+
|
35
|
+
actionword.children[:gherkin_pattern] ||= pattern(actionword)
|
36
|
+
actionword.children[:parameters_ordered_by_pattern] ||= order_parameters_by_pattern(actionword)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
@annotations_counter.actionwords.each do |actionword|
|
42
|
+
actionword.children[:gherkin_annotation] = @annotations_counter.most_used_annotation(actionword) || "Given"
|
43
|
+
actionword.children[:gherkin_used_annotations] = @annotations_counter.all_used_annotations(actionword) || ['Given']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def annotation(call)
|
48
|
+
call.children[:annotation].capitalize if call.children[:annotation]
|
49
|
+
end
|
50
|
+
|
51
|
+
def text_annotation(call)
|
52
|
+
annotation(call) || "*"
|
53
|
+
end
|
54
|
+
|
55
|
+
def code_annotation(call)
|
56
|
+
call_annotation = annotation(call)
|
57
|
+
if call_annotation
|
58
|
+
if ["And", "But"].include?(call_annotation)
|
59
|
+
call_annotation = @last_annotation || "Given"
|
60
|
+
end
|
61
|
+
@last_annotation = call_annotation
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def prettified(call)
|
66
|
+
base = call.chunks.map {|chunk| chunk[:value]}.join("\"").strip
|
67
|
+
call.extra_inlined_arguments.each do |chunk|
|
68
|
+
base += " \"#{chunk[:value]}\""
|
69
|
+
end
|
70
|
+
|
71
|
+
base
|
72
|
+
end
|
73
|
+
|
74
|
+
def set_call_chunks(call)
|
75
|
+
all_arguments = all_valued_arguments_for(call)
|
76
|
+
inline_parameter_names = []
|
77
|
+
extra_inlined_arguments = []
|
78
|
+
|
79
|
+
call.chunks = []
|
80
|
+
call.extra_inlined_arguments = []
|
81
|
+
|
82
|
+
actionword_name = call.is_a?(Hiptest::Nodes::Call) ? call.children[:actionword] : call.children[:actionword_name]
|
83
|
+
call_chunks = actionword_name.split("\"", -1)
|
84
|
+
|
85
|
+
call_chunks.each_slice(2) do |text, inline_parameter_name|
|
86
|
+
call.chunks << {
|
87
|
+
value: text,
|
88
|
+
is_argument: false
|
89
|
+
}
|
90
|
+
|
91
|
+
if all_arguments.has_key?(inline_parameter_name)
|
92
|
+
inline_parameter_names << inline_parameter_name.clone
|
93
|
+
value = all_arguments[inline_parameter_name]
|
94
|
+
inline_parameter_name.replace(value)
|
95
|
+
|
96
|
+
call.chunks << {
|
97
|
+
value: inline_parameter_name,
|
98
|
+
is_argument: true
|
99
|
+
}
|
100
|
+
else
|
101
|
+
call.chunks << {
|
102
|
+
value: inline_parameter_name,
|
103
|
+
is_argument: false
|
104
|
+
} unless inline_parameter_name.nil?
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
missing_parameter_names = all_arguments.keys - inline_parameter_names - @special_params
|
109
|
+
call.extra_inlined_arguments = missing_parameter_names.map do |missing_parameter_name|
|
110
|
+
{
|
111
|
+
value: all_arguments[missing_parameter_name],
|
112
|
+
is_argument: true
|
113
|
+
}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def pattern(actionword)
|
118
|
+
patterned = actionword.chunks.map {|chunk| chunk[:value]}.join("\"")
|
119
|
+
actionword.extra_inlined_parameters.each do |param|
|
120
|
+
patterned += " \"#{param[:value]}\""
|
121
|
+
end
|
122
|
+
|
123
|
+
"^#{patterned.strip}$"
|
124
|
+
end
|
125
|
+
|
126
|
+
def set_actionwords_chunks(actionword)
|
127
|
+
name = actionword.uniq_name
|
128
|
+
actionword_parameters = evaluated_map(actionword.children[:parameters])
|
129
|
+
name_chunks = name.split("\"", -1)
|
130
|
+
inline_parameter_names = []
|
131
|
+
|
132
|
+
actionword.chunks = []
|
133
|
+
actionword.extra_inlined_parameters = []
|
134
|
+
|
135
|
+
name_chunks.each_slice(2) do |text, inline_parameter_name|
|
136
|
+
actionword.chunks << {
|
137
|
+
value: text.gsub(/[.|()\\.+*?\[\]{}^$]/) { |c| "\\#{c}" },
|
138
|
+
is_parameter: false
|
139
|
+
}
|
140
|
+
|
141
|
+
inline_parameter_names << inline_parameter_name if inline_parameter_name
|
142
|
+
if actionword_parameters.has_key?(inline_parameter_name)
|
143
|
+
actionword.chunks << {
|
144
|
+
value: "(.*)",
|
145
|
+
name: inline_parameter_name,
|
146
|
+
is_parameter: true
|
147
|
+
}
|
148
|
+
else
|
149
|
+
actionword.chunks << {
|
150
|
+
value: inline_parameter_name,
|
151
|
+
is_parameter: false
|
152
|
+
} if inline_parameter_name
|
153
|
+
end
|
154
|
+
end
|
155
|
+
missing_parameter_names = actionword_parameters.keys - inline_parameter_names - @special_params
|
156
|
+
|
157
|
+
missing_parameter_names.each do |missing_parameter_name|
|
158
|
+
actionword.extra_inlined_parameters << {
|
159
|
+
value: "(.*)",
|
160
|
+
name: missing_parameter_name,
|
161
|
+
is_parameter: true
|
162
|
+
}
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def order_parameters_by_pattern(actionword)
|
167
|
+
inline_parameter_names = actionword.children[:name].scan(/\"(.*?)\"/).flatten
|
168
|
+
actionword_parameters = {}
|
169
|
+
actionword.children[:parameters].map {|p| actionword_parameters[p.children[:name]] = p}
|
170
|
+
|
171
|
+
missing_parameter_names = actionword_parameters.keys - inline_parameter_names - @special_params
|
172
|
+
[inline_parameter_names, missing_parameter_names, @special_params].flatten.map do |name|
|
173
|
+
actionword_parameters[name]
|
174
|
+
end.compact
|
175
|
+
end
|
176
|
+
|
177
|
+
def all_valued_arguments_for(call)
|
178
|
+
evaluated_call_arguments = evaluated_map(call.children[:arguments])
|
179
|
+
evaluated_actionword_parameters = evaluated_map(get_actionword_parameters(call))
|
180
|
+
names = evaluated_actionword_parameters.keys
|
181
|
+
|
182
|
+
hash_array = names.map { |name|
|
183
|
+
value = evaluated_call_arguments[name] || evaluated_actionword_parameters[name] || ""
|
184
|
+
[name, value]
|
185
|
+
}
|
186
|
+
Hash[hash_array]
|
187
|
+
end
|
188
|
+
|
189
|
+
def get_actionword_parameters(call)
|
190
|
+
actionword = get_actionword(call)
|
191
|
+
actionword && actionword.children[:parameters] || []
|
192
|
+
end
|
193
|
+
|
194
|
+
def get_actionword(call)
|
195
|
+
actionword = @library_indexer.get_index(call.children[:actionword])
|
196
|
+
|
197
|
+
if actionword.nil?
|
198
|
+
actionword = @indexer.get_index(call.children[:actionword])
|
199
|
+
end
|
200
|
+
|
201
|
+
actionword && actionword[:actionword] || nil
|
202
|
+
end
|
203
|
+
|
204
|
+
def evaluated_map(named_values)
|
205
|
+
hash_array = named_values.map do |named_value|
|
206
|
+
name = named_value.children[:name]
|
207
|
+
value = evaluate(named_value.children[:value] || named_value.children[:default])
|
208
|
+
[name, value]
|
209
|
+
end
|
210
|
+
Hash[hash_array]
|
211
|
+
end
|
212
|
+
|
213
|
+
def evaluate(value)
|
214
|
+
if value.nil?
|
215
|
+
nil
|
216
|
+
elsif Hiptest::Nodes::Variable === value
|
217
|
+
"<#{value.children[:name]}>"
|
218
|
+
elsif value.children[:chunks]
|
219
|
+
value.children[:chunks].map {|chunk| evaluate(chunk) }.join('')
|
220
|
+
elsif value.children[:value]
|
221
|
+
value.children[:value]
|
222
|
+
else
|
223
|
+
nil
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
class AnnotationsCounter
|
229
|
+
def initialize
|
230
|
+
@counts_by_actionword = Hash.new {|counts, actionword| counts[actionword] = Hash.new(0) }
|
231
|
+
end
|
232
|
+
|
233
|
+
def actionwords
|
234
|
+
@counts_by_actionword.keys
|
235
|
+
end
|
236
|
+
|
237
|
+
def increment(actionword, annotation)
|
238
|
+
counts = @counts_by_actionword[actionword]
|
239
|
+
counts[annotation] += 1 if annotation
|
240
|
+
end
|
241
|
+
|
242
|
+
def most_used_annotation(actionword)
|
243
|
+
max = @counts_by_actionword[actionword].values.max
|
244
|
+
@counts_by_actionword[actionword].key(max)
|
245
|
+
end
|
246
|
+
|
247
|
+
def all_used_annotations(actionword)
|
248
|
+
@counts_by_actionword[actionword].keys
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'hiptest-publisher/nodes'
|
2
|
+
|
3
|
+
module Hiptest
|
4
|
+
module NodeModifiers
|
5
|
+
class ItemsOrderer
|
6
|
+
def self.add(project, order)
|
7
|
+
self.new(project).order_items(order)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(project)
|
11
|
+
@project = project
|
12
|
+
end
|
13
|
+
|
14
|
+
def order_items(order)
|
15
|
+
if (order == 'order')
|
16
|
+
@project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
|
17
|
+
folder.children[:scenarios].sort_by! {|sc| sc.order_in_parent}
|
18
|
+
folder.children[:subfolders].sort_by! {|f| f.order_in_parent}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if (order == 'alpha')
|
23
|
+
@project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
|
24
|
+
folder.children[:scenarios].sort_by! {|sc| sc.children[:name] }
|
25
|
+
folder.children[:subfolders].sort_by! {|f| f.children[:name] }
|
26
|
+
end
|
27
|
+
|
28
|
+
@project.children[:scenarios].children[:scenarios].sort_by! {|sc| sc.children[:name] }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'hiptest-publisher/nodes_walker'
|
2
|
+
require 'hiptest-publisher/project_grapher'
|
3
|
+
|
4
|
+
module Hiptest
|
5
|
+
module NodeModifiers
|
6
|
+
class ParameterTypeAdder
|
7
|
+
attr_reader :call_types
|
8
|
+
|
9
|
+
def self.add(project)
|
10
|
+
self.new.process(project)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@call_types = CallTypes.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def process(project)
|
18
|
+
gather_scenarios_argument_types(project)
|
19
|
+
gather_actionwords_default_parameters_types(project)
|
20
|
+
|
21
|
+
# To have the most accurate type, the closest calls must be computed
|
22
|
+
# first, and deepest calls must be computed last (because they depend
|
23
|
+
# on previous calls types).
|
24
|
+
distances_index = Hiptest::ProjectGrapher.distances_index(project)
|
25
|
+
distances_index.each_value do |items| # distances_index items are sorted by distance, from closest to deepest
|
26
|
+
items.each do |item|
|
27
|
+
write_parameter_types_to_item(item)
|
28
|
+
gather_call_argument_types(item)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def gather_scenarios_argument_types(project)
|
34
|
+
project.children[:scenarios].children[:scenarios].each do |scenario|
|
35
|
+
@call_types.add_callable_item(scenario.children[:name], Hiptest::Nodes::Scenario)
|
36
|
+
add_arguments_from(scenario.children[:datatable])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def gather_actionwords_default_parameters_types(project)
|
41
|
+
project.children[:actionwords].children[:actionwords].each do |actionword|
|
42
|
+
@call_types.add_callable_item(actionword.children[:name], Hiptest::Nodes::Actionword)
|
43
|
+
actionword.each_sub_nodes(Hiptest::Nodes::Parameter) do |parameter|
|
44
|
+
default = parameter.children[:default]
|
45
|
+
next if default.nil?
|
46
|
+
@call_types.add_argument_type(parameter.children[:name], get_type(default))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def gather_call_argument_types(node)
|
52
|
+
node.each_sub_nodes(Hiptest::Nodes::Call) do |call|
|
53
|
+
actionword_name = call.children[:actionword]
|
54
|
+
|
55
|
+
@call_types.add_callable_item(actionword_name, Hiptest::Nodes::Actionword)
|
56
|
+
add_arguments_from(call, node)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def write_parameter_types_to_item(callable_item)
|
61
|
+
callable_item.each_sub_nodes(Hiptest::Nodes::Parameter) do |parameter|
|
62
|
+
parameter.children[:type] = @call_types.type_of(callable_item.children[:name], parameter.children[:name], callable_item.class)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def add_arguments_from(node, context = nil)
|
67
|
+
node.each_sub_nodes(Hiptest::Nodes::Argument) do |argument|
|
68
|
+
@call_types.add_argument_type(argument.children[:name], get_type(argument.children[:value], context))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def get_type(value, context = nil)
|
75
|
+
case value
|
76
|
+
when Hiptest::Nodes::StringLiteral, Hiptest::Nodes::Template then :String
|
77
|
+
when Hiptest::Nodes::NumericLiteral then value.children[:value].to_s.include?(".") ? :float : :int
|
78
|
+
when Hiptest::Nodes::BooleanLiteral then :bool
|
79
|
+
when Hiptest::Nodes::Variable then get_var_value(value.children[:name], context)
|
80
|
+
else :null
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def get_var_value(name, context)
|
85
|
+
return :null if context.nil? || context.children[:parameters].nil?
|
86
|
+
|
87
|
+
context.children[:parameters].each do |param|
|
88
|
+
if param.children[:name] == name
|
89
|
+
return param.children[:type] || :null
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
return :null
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
class CallTypes
|
98
|
+
def initialize
|
99
|
+
@callable_items = {}
|
100
|
+
@current_callable_item = nil
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_callable_item(item_name, item_type)
|
104
|
+
name = "#{item_type}-#{item_name}"
|
105
|
+
@callable_items[name] ||= {}
|
106
|
+
@current_callable_item = @callable_items[name]
|
107
|
+
end
|
108
|
+
|
109
|
+
def add_argument_type(name, type)
|
110
|
+
@current_callable_item[name] ||= {types: Set.new}
|
111
|
+
@current_callable_item[name][:types] << type
|
112
|
+
end
|
113
|
+
|
114
|
+
def type_of(item_name, parameter_name, item_type)
|
115
|
+
name = "#{item_type}-#{item_name}"
|
116
|
+
callable_item = @callable_items[name]
|
117
|
+
return :String if callable_item.nil?
|
118
|
+
|
119
|
+
parameter = callable_item[parameter_name]
|
120
|
+
|
121
|
+
return :String if parameter.nil?
|
122
|
+
return type_from_types(parameter[:types])
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def type_from_types(types)
|
128
|
+
types = types - [:null]
|
129
|
+
if types.empty?
|
130
|
+
:null
|
131
|
+
elsif types.length == 1
|
132
|
+
types.first
|
133
|
+
elsif types == Set[:float, :int]
|
134
|
+
:float
|
135
|
+
else
|
136
|
+
:String
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'hiptest-publisher/nodes_walker'
|
2
|
+
|
3
|
+
module Hiptest
|
4
|
+
module NodeModifiers
|
5
|
+
class ParentAdder
|
6
|
+
def self.add(project)
|
7
|
+
self.new.process(project)
|
8
|
+
end
|
9
|
+
|
10
|
+
def process(node)
|
11
|
+
node.each_direct_children do |child|
|
12
|
+
child.parent ||= node
|
13
|
+
process(child)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|