Comments (11)
Is this branch merged with master ?
from zerocode.
Not exactly. This was not a blocker and also it was argued that - the independent-ness
of the test cases and the readability will be lost if allowed this way. Also one has to traverse to n fro
via the IDE to know the payload structure. So it was paused.
Are you looking for load testing ? or stress testing aka performance testing?
Framework recently developed this and enables loading the same test(s) number of times, in a particular interval of time and all these are configurable in a properties file.
from zerocode.
I am doing Functional testing, I am also looking a way where we can parameterize a test using external data source like csv.
Having Json externalize can reduce the size of json, also it will avoid duplicate data, just a thought
from zerocode.
@UmeshIghe , sounds good to reuse the payload from a JSON file, that's why this ticket was for 👍. But as mentioned in the earlier comment , the traversing n independentness
will be lost, that's the trade-off of this approach.
Anyways, we will include this feature in our upcoming release(a week or so - will try). 👍
Please watch n follow our latest news/releases/features etc in Twitter.
Readme section - https://github.com/authorjapps/zerocode#latest-newsreleasesfeatures
Note-
Even now you can achieve this via calling a Java(Pojo), but JSON is better in my opinion in order to copy paste as it is like postman. Let's go for JSON file way.
@macrocks @officiallysameer @dinesh76in, @nirmalchandra and all, let me know your thoughts! Can you pick this tkt?
from zerocode.
Also this makes sense, doesn't it ?
{
"name": "update_address",
"url": "/api/v1/addresses/AD-US-01",
"operation": "PUT",
"request": {
"body": "${JSON.FILE:test_files/address_request.json}"
},
"assertions": {
"status": 200,
"body"{
"id": "AD-US-01"
}
}
}
and if you make a GET call(which of course is necessary to verify the result)
then it should allow to assert from a file
too ?
{
"name": "Get the address",
"url": "/api/v1/addresses/${$.update_address.response.id}",
"operation": "GET",
"request": {
},
"assertions": {
"status": 200,
"body": "${JSON.FILE:test_files/address_response.json}"
}
}
What you think @UmeshIghe @macrocks @nirmalchandra @officiallysameer ?
Better ?
If we are allowing body JSON file, we should allow the response JSON file ?
I am leaving it open for discussion.
from zerocode.
@UmeshIghe @albertosipov .Yes it is a good feature to be pick it as an enhancement. It will help everyone to reuse json in multiple test cases.
from zerocode.
Yeah, also the following too makes sense,
Here, only the 'addresses' part of it is common(not the entire body payload) and can be read from a Json file.
{
"name": "update_addresses",
"url": "/api/v1/addresses/emp_001",
"operation": "PUT",
"request": {
"body": {
"updatedDate": "2018-10-10",
"addresses": "${JSON.FILE:test_files/common_addressses.json}"
}
},
"assertions": {
"status": 200,
"body": {
"addresses": "${JSON.FILE:test_files/common_addressses.json}"
}
}
}
and the common_addressses.json
can be like below,
[
{
"type":"corp-office",
"city":"Texas"
},
{
"type":"hr-office",
"city":"Newark"
}
]
Basically, resolve the JSON.FILE
in request and response(ie assertion) node by deep traversing.
Also JSON.FILE
sounds meaningful than JSON.PAYLOAD.FILE
.
I will update the description if there are no objections from anyone.
@UmeshIghe, are you happy for these implementations?
from zerocode.
fyi - PR raised n under review, PR No- #138
Things pending-
- Update README file
- Add a wiki page for this feature
from zerocode.
Yeah, also the following too makes sense,
Here, only the 'addresses' part of it is common(not the entire body payload) and can be read from a Json file.
{ "name": "update_addresses", "url": "/api/v1/addresses/emp_001", "operation": "PUT", "request": { "body": { "updatedDate": "2018-10-10", "addresses": "${JSON.FILE:test_files/common_addressses.json}" } }, "assertions": { "status": 200, "body": { "addresses": "${JSON.FILE:test_files/common_addressses.json}" } } }
and the
common_addressses.json
can be like below,[ { "type":"corp-office", "city":"Texas" }, { "type":"hr-office", "city":"Newark" } ]
Basically, resolve the
JSON.FILE
in request and response(ie assertion) node by deep traversing.Also
JSON.FILE
sounds meaningful thanJSON.PAYLOAD.FILE
.
I will update the description if there are no objections from anyone.@UmeshIghe, are you happy for these implementations?
Yes , this is also good
from zerocode.
@UmeshIghe , this has been released now, the version is as below.
<!-- https://mvnrepository.com/artifact/org.jsmart/zerocode-rest-bdd -->
<dependency>
<groupId>org.jsmart</groupId>
<artifactId>zerocode-rest-bdd</artifactId>
<version>1.2.8</version>
</dependency>
We will update the release notes and README file with examples soon.
In the mean time, you can pick the handy examples from our HelloWorld
repo(as shown below) :
Here is a sample test-case with external file as JSON content.
{
"scenarioName": "POST API - File json as response content - Reuse body",
"steps": [
{
"name": "create_emp",
"url": "/api/v1/employees",
"operation": "POST",
"request": {
"body" : "${JSON.FILE:reusable_content/request/request_body.json}"
},
"assertions": {
"status": 201
}
},
{
"name": "get_user_details",
"url": "/api/v1/employees/${$.create_emp.response.body.id}",
"operation": "GET",
"request": {
},
"assertions": {
"status": 200,
"body" : "${JSON.FILE:reusable_content/response/response_body.json}"
}
}
]
}
Wiki page for this feature-
https://github.com/authorjapps/zerocode/wiki/External-JSON-file-as-reusable-content
from zerocode.
Hello mate @UmeshIghe, When u get chance, can you say Hello in gitter chat room please? 🙏
Gitter link: https://gitter.im/zerocode-testing/help-and-usage
Sounds like you are doing something interesting and will be nice if you publish a small write-up/article as a blog.
from zerocode.
Related Issues (20)
- [Report] Allow multiple authors and multiple categories HOT 1
- Kafka seekTImestamp should also support timestamp in `2024-01-29T19:35:21.959` format HOT 6
- Static java method invocation in step HOT 7
- Option to retry from a previous step on failure of step HOT 13
- Release with Lombok dependency (with a RC version)
- Support for multiple parameters in the Java method invocation Step HOT 6
- [BUG] seekTo throws NPE when no offset found for a timestamp
- [TECH-DEBT] Add an Integration test scenario with multi partition topic to reproduce NPE for seekTimestamp feature
- Improvement of seek functionality in kafka consumer HOT 1
- [TECH-DEBT] Move to jackson json provider in JsonPath instead of jsonsmart HOT 4
- [M3][ERROR] Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.11.4:run (default) on project kafka-testing: Error extracting protoc for version 3.11.4: Unsupported platform: protoc-3.11.4-osx-aarch_64.exe -> [Help 1] HOT 4
- Validator does not dig to resolve jsonpath and other type of value placeholders HOT 4
- recordType does not take into account differences between key and value for kafka HOT 3
- possible move to Jackson from Gson for kafka HOT 4
- Crash on Kafka consume when key is string with `recordType: JSON` HOT 4
- Generating Current Timestamp with microsecond with "SSSSSS" - Works but with padding three zeroes HOT 9
- Tokens in csvSource parameter sources computed at usage HOT 9
- Vaue lookup tokens don't work in kakfa JSON value HOT 2
- [Feature Request] Conditional execution of Steps HOT 2
- [Feature Request] gRPC Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zerocode.