-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration #69
Configuration #69
Conversation
Keep testscripts validated to execute under ./TestScripts
Some issues:
|
Good start
|
All good comments. I will keep moving on with them. |
All the suggestions were incorporated. Refer to the documentation below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
command line arguments failing for me right now:
knaden@MM272557-PC testscript-engine % bundle exec bin/testscript_engine --interactive
Could not find command "__interactive".
Deprecation warning: Thor exit with status 0 on errors. To keep this behavior, you must define `exit_on_failure?` in `TestScriptEngine::CLI::MyCLI`
You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
bundler: failed to load command: bin/testscript_engine (bin/testscript_engine)
/Users/knaden/Documents/Inferno/source/testscript-engine/lib/testscript_engine/cli.rb:38:in `start': undefined method `[]' for nil:NilClass (NoMethodError)
from bin/testscript_engine:4:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `<main>'
I re-added the option key work as is in the examples and got further, but didn't see the server from the config file as the default as I expected and then ran into an error
knaden@MM272557-PC testscript-engine % bundle exec bin/testscript_engine option --interactive
Hello from the TestScriptEngine! The configuration is as follows:
SERVER UNDER TEST: []
LOAD NON-FHIR FIXTURES: []
TESTSCRIPT INPUT DIRECTORY or FILE: [/Users/knaden/Documents/Inferno/source/testscript-engine/TestScripts]
TESTREPORT OUTPUT DIRECTORY: [/Users/knaden/Documents/Inferno/source/testscript-engine/TestReports]
Would you like to modify this configuration? [Y/N] N
STARTING TO LOAD INPUT
bundler: failed to load command: bin/testscript_engine (bin/testscript_engine)
<internal:dir>:43:in `[]': no implicit conversion of nil into String (TypeError)
from /Users/knaden/Documents/Inferno/source/testscript-engine/lib/testscript_engine.rb:58:in `load_input'
from /Users/knaden/Documents/Inferno/source/testscript-engine/lib/testscript_engine/output/message_handler.rb:95:in `load_input'
from /Users/knaden/Documents/Inferno/source/testscript-engine/lib/testscript_engine/cli.rb:72:in `start'
from bin/testscript_engine:4:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `<main>'
Trying without interactive mode, the --runnable
flag still doesn't seem to work:
bundle exec bin/testscript_engine option --runnable Gravityclinicalcaresdoh_Stu2_Sdohcccondition_Must_support_element_Condition_category.json
ERROR: "testscript_engine option" was called with arguments ["--runnable", "Gravityclinicalcaresdoh_Stu2_Sdohcccondition_Must_support_element_Condition_category.json"]
Usage: "testscript_engine option [OPTIONS]"
Deprecation warning: Thor exit with status 0 on errors. To keep this behavior, you must define `exit_on_failure?` in `TestScriptEngine::CLI::MyCLI`
You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
bundler: failed to load command: bin/testscript_engine (bin/testscript_engine)
/Users/knaden/Documents/Inferno/source/testscript-engine/lib/testscript_engine/cli.rb:38:in `start': undefined method `[]' for nil:NilClass (NoMethodError)
from bin/testscript_engine:4:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/knaden/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `load'
from /Users/knaden/.asdf/installs/ruby/3.0.1/bin/bundle:23:in `<main>'
Several thoughts:
- The need for the work
option
within the command confuses me. Is there a reason it is needed? - An expanded execution example of running with command line inputs would be helpful
Short answer for the "option" question: It's a method name in Thor.
In my case, "option" is "hello".. It's hard to avoid the prefix. I believe Inferno has similar; console, migrate, etc. |
I would choose something like |
Good idea. Let me take time to reorganize arguments.. |
I have two issues:
|
My thoughts on your questions:
That said, I also think we shouldn't let getting this perfect get in the way of moving on to other features, so I'd recommend leaving them separated out for now and focus on making sure the functionality works as implemented. Looks like you may be making more fixes, but things I've noticed when trying it
|
--> I like the idea. Thanks!
--> How do you assume to set "system default"? It was hard coded previously. I didn't like it and thought system default equals "config.xml". I believe you consider "config.xml" isn't system default, maybe that was the miscommunication.
--> Oh, I only committed README for review. I wanted to finalize code change once it shed the light. Sorry about confusion. |
FYI, TestScript.name is supposed to be computer friendly as opposed to TestScript.title is human readable. Our TestScripts examples are not like that. I don't think name like below can be used as argument/properties. Will need to reorganize TestScript examples.
|
Yep, system defaults would be hard-coded. They won't be appropriate for everything, but for some:
|
You can test with command below: System configuration
Configuration file
CLI with a specific testscript name
Interactive mode
One remaining issue: It's slow to make multiple "selected" runnables execute. Somehow the current code set the variable |
Haven't done a close review of the code, but the execution patterns that are most important to me appear to work correctly:
I think fine to defer multiple testscript_names until later. Recommend that this be merged in and continue with other features. We can iterate on this feature to improve it later as we get experience. |
Great, I will merge this. Will create a backlog item for multiple testscript names to come back later. |
Add configuration
Overview
Ease of execution of the TestScript-engine requires specifying details of the execution as a part of the execution command and/or configuration file instead of via interactive prompts.
Requirements
Proposed Approach
Add a YAML file to document the baseline configuration as below. The engine reads the file at the very beginning of execution.
User has an option to change the YAML based configuration when executing the engine using "parameters". All the configuration items in the YAML are supported with same naming convention. For example,
server_url
in YAML is same parameter name.Test scenario for YAML - 1
In YAML, change server address:
server_url: localhost
Then run the engine without options
bundle exec bin/testscript_engine
Expected to see the server address changed.
Test scenario for YAML - 2
In YAML, interactive mode is off default. Change by:
interactive: true
Then run the engine without options
bundle exec bin/testscript_engine
Expected to run interactive mode.
Test scenario for Thor
In YAML, interactive mode is off default. Run the engine with option to run on interactive mode by:
bundle exec bin/testscript_engine option --interactive
Since Thor supersedes YAML, expected to run interactive mode.