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

[plugin-json] Add patch json file step #1499

Merged
merged 1 commit into from
Mar 23, 2021
Merged

[plugin-json] Add patch json file step #1499

merged 1 commit into from
Mar 23, 2021

Conversation

EDbarvinsky
Copy link
Contributor

@EDbarvinsky EDbarvinsky commented Mar 18, 2021

Closes #1476

Comment on lines 6 to 10
implementation project(':vividus-util')
implementation(group: 'com.jayway.jsonpath', name: 'json-path-assert', version: '2.4.0') {
exclude module: 'hamcrest-library'
}
implementation (group: 'net.javacrumbs.json-unit', name: 'json-unit', version: '2.18.0')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have tried to get rid of this dependencies, but do not succeed. Will discuss tomorrow

import org.vividus.bdd.context.IBddVariableContext;
import org.vividus.bdd.variable.VariableScope;

public class JsonSteps
Copy link
Collaborator

Choose a reason for hiding this comment

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

JsonPatchSteps

}

@When("I patch content from json '$sourceJsonFilePath' with '$patchJsonFilePath' and put patched json to '$scopes'"
+ " variable with name '$pathVariable'")
Copy link
Collaborator

Choose a reason for hiding this comment

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

When I patch JSON `$sourceJson` using `$jsonPatch` and save result to $scopes variable `$variableName`

@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #1499 (c3e6f46) into master (a966eca) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1499   +/-   ##
=========================================
  Coverage     95.55%   95.56%           
- Complexity     4874     4877    +3     
=========================================
  Files           685      687    +2     
  Lines         14083    14102   +19     
  Branches        983      983           
=========================================
+ Hits          13457    13476   +19     
  Misses          493      493           
  Partials        133      133           
Impacted Files Coverage Δ Complexity Δ
...ava/org/vividus/bdd/steps/json/JsonPatchSteps.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...org/vividus/ui/mobile/action/search/AppiumHow.java 100.00% <0.00%> (ø) 1.00% <0.00%> (ø%)
...dus/ui/mobile/action/search/AppiumLocatorType.java 100.00% <0.00%> (ø) 5.00% <0.00%> (ø%)
...rc/main/java/org/vividus/bdd/steps/DebugSteps.java 100.00% <0.00%> (ø) 0.00% <0.00%> (?%)
...dus/bdd/steps/api/JsonResponseValidationSteps.java 96.03% <0.00%> (+0.03%) 50.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a966eca...c3e6f46. Read the comment docs.

@EDbarvinsky EDbarvinsky changed the title [WIP] [plugin-json] Add patch json file step [plugin-json] Add patch json file step Mar 19, 2021
Copy link
Collaborator

@valfirst valfirst left a comment

Choose a reason for hiding this comment

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

Please add:

  • regular docs (see /docs folder)
  • integration tests

settings.gradle Outdated Show resolved Hide resolved
@@ -0,0 +1,25 @@
= Json Plugin
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's use JSON notation everywhere

When I patch JSON `$sourceJson` using `$jsonPatch` and save result to $scopes variable `$variableName`
----

* `$sourceJson` - JSON file to be patched.
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not file, but JSON data

----

* `$sourceJson` - JSON file to be patched.
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902]
Copy link
Collaborator

Choose a reason for hiding this comment

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

not file, similar to the above comment


* `$sourceJson` - JSON file to be patched.
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902]
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The

/**
* Performs patching of a json and save it to the variable
* @param sourceJson json file to be patched
* @param jsonPatch json file with patch actions
Copy link
Collaborator

Choose a reason for hiding this comment

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

please see related comments for the documentation

* `$sourceJson` - JSON file to be patched.
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902]
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes]
* `$variableName` - The variable
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add example of using step

* `$sourceJson` - JSON file to be patched.
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902]
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes]
* `$variableName` - The variable
Copy link
Collaborator

Choose a reason for hiding this comment

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

The variable name

@valfirst valfirst merged commit 12bcaf6 into vividus-framework:master Mar 23, 2021
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.

new step: patch json
4 participants