Skip to content
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

Dynamic variable #71

Merged
merged 5 commits into from
Dec 13, 2022
Merged

Dynamic variable #71

merged 5 commits into from
Dec 13, 2022

Conversation

jhlee-mitre
Copy link
Contributor

@jhlee-mitre jhlee-mitre commented Dec 11, 2022

Summary

Dynamic variable

New behavior

Users can set up dynamic variable as a placeholder for user-defined execution time values for TestScript.variable. Technically dynamic variable will replace value in defaultValue at the beginning of test execution.
There are two ways to set up dynamic variable:

Config.yml

variable : [ARRAY]

Use format

- name1=value1
- name2=value2

Command line argument

bundle exec testscript_engine execution --variable [ARRAY]

Use format
name1=value1 name2=value2

Use quotations if there are spaces.

Testing guidance

Sample TestScript testscript_dynamic_variable is included.
Use the examples below from command line argument.

bundle exec testscript_engine execute --testscript_path "/spec/examples/testscript_unittest" --variable PatientResourceId1=var1changed PatientResourceId2=var2changed --testscript_name testscript_dynamic_variable

Expected result

STARTING TO TEST
         GETTING: http:https://server.fire.ly/Patient/var1changed
         (✓) Executed Operation: [unlabeled]
         (✗) Response: Expected Response equals ["okay"], but found [].
         GETTING: http:https://server.fire.ly/Patient/var2changed
         (✓) Executed Operation: [unlabeled]
         (✗) Response: Expected Response equals ["okay"], but found [].
      FINISHED TEST.

@jhlee-mitre jhlee-mitre self-assigned this Dec 11, 2022
@jhlee-mitre jhlee-mitre linked an issue Dec 11, 2022 that may be closed by this pull request
Copy link
Contributor

@karlnaden karlnaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it works as needed. One small documentation fix and a potential idea for improving whitespace handling, but probably not one to spend time on.

lib/testscript_engine.rb Outdated Show resolved Hide resolved
lib/testscript_engine/cli.rb Outdated Show resolved Hide resolved
@jhlee-mitre jhlee-mitre merged commit 3a13183 into main Dec 13, 2022
@jhlee-mitre jhlee-mitre deleted the add_dynamic_variable branch December 13, 2022 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic variables
2 participants