-
-
Notifications
You must be signed in to change notification settings - Fork 403
Token: Random UUID
- Flavors of UUID
- Usecases of UUID
- Using ${RANDOM.UUID}
- Using ${RANDOM.UUID.FIXED}
- Conclusion
- Available since
UUID stands for a universally unique identifier.
e.g.
8807947f-3082-47fa-a100-e7b1cfbc4c79
Zerocode supports the following flavours of UUID
- RANDOM.UUID
- Random for every scenario and random inside a scenario if used more than once
- RANDOM.UUID.FIXED
- Random for every scenario and fixed inside a scenario if used more than once
The chance that generated UUIDs will duplicate is almost zero. It is used when you dont want some other system to generate unique identifier for you(primary keys in tables for example),or when dealing with multiple components and afraid of generating non unique ids.UUID can solve above problems.
sample step:
{
"name": "uuid",
"url": "/posts",
"operation": "POST",
"request": {
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": {
"posts": [
{
"title": "title1",
"body": "${RANDOM.UUID}",
"userId": "${RANDOM.UUID}"
},
{
"title": "title2",
"body": "${RANDOM.UUID}",
"userId": "${RANDOM.UUID}"
}
]
}
},
"assertions": {
"status": 201
}
},
when RANDOM.UUID
placeholders are replaced with uuids, we get:
request:
{
"headers" : {
"Content-Type" : "application/json;charset=UTF-8"
},
"body" : {
"posts" : [ {
"title" : "title1",
"body" : "a6239590-1f0b-4335-b2c7-946c97a2c2fd",
"userId" : "54858c89-b884-4f8d-96fe-6e1564c3e18d"
}, {
"title" : "title2",
"body" : "31fe7508-5564-466a-a6d1-1ae78f06e445",
"userId" : "1a510358-654c-4005-88c6-7adbee901e44"
} ]
}
}
sample step:
{
"name": "uuid_fixed",
"url": "/posts",
"operation": "POST",
"request": {
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": {
"posts": [
{
"title": "title3",
"body": "${RANDOM.UUID.FIXED}",
"userId": "${RANDOM.UUID.FIXED}"
},
{
"title": "title4",
"body": "${RANDOM.UUID.FIXED}",
"userId": "${RANDOM.UUID.FIXED}"
}
]
}
},
"assertions": {
"status": 201
}
},
After RANDOM.UUID.FIXED
are replaced with fixed uuids, we get
request:
{
"headers" : {
"Content-Type" : "application/json;charset=UTF-8"
},
"body" : {
"posts" : [ {
"title" : "title3",
"body" : "8807947f-3082-47fa-a100-e7b1cfbc4c79",
"userId" : "8807947f-3082-47fa-a100-e7b1cfbc4c79"
}, {
"title" : "title4",
"body" : "8807947f-3082-47fa-a100-e7b1cfbc4c79",
"userId" : "8807947f-3082-47fa-a100-e7b1cfbc4c79"
} ]
}
}
As we can see in case of fixed one, all uuids are the same within the step.
Visit the Zerocode "Hello World" repo for a UUID working example and usage(click)
V 1.3.19
Visit the Zerocode Documentation Site for all things.
-
User's Guide
-
Matchers
-
Zerocode Value Tokens
-
YAML DSL
-
Http Testing
-
Kafka Testing
- Introduction
- Produce, consume proto message
- Produce raw message
- Consume raw message
- Produce JSON message
- Consume JSON message
- Produce and consume XML message
- Kafka - consume the latest message or n latest messages
- Produce avro message
- Consume avro message
- KSQL in action
- Produce multiple records
- Produce from file
- Produce to a partition
- Produce and consume records with headers
- Produce n assert partition ack
- Comsume and dump to file
- commitSync vs commitAsync
- Overriding config inside a test
- Chosing String or Int or Avro Serializer
- Chosing String or Int or Avro Deserializer
- Attaching timestamp during load
- Default timestamp provided by Kafka
- Consume and assert avro schema metadata
- Error handling - produce via avro schema
- Sorting Kafka records consumed
-
DB Testing
-
Kotlin Testing
-
Performance Testing - Load and Stress
- Performance Testing - via awesome JUnit runners
- Load Vs Stress generation on target application
- Run a single test or a scenario in parallel
- Run multiple test scenarios in parallel - Production load simulation
- Dynamically change the payload for every request
- Analytics - Useful report(s) or statistics
-
Parameterized Testing
-
Docker
-
More+
-
Extensions
-
JUnit5 Jupiter Test
-
Questions And Answers(FAQ)
- What is Zerocode testing?
- SSL http https connections supported?
- How to assert array size Greater-Than Lesser-Than etc?
- How to invoke POST api?
- How to assert custom headers of the response?
- How to pass custom security token into the request header?
- When to use JUnit Suite runner and when Zerocode Package runner?
- How to execute DB SQL and assert?
- How to handle Http response other than utf-8 e.g. utf-16 or utf-32 ?
- Random Number Generator Placeholders Usages and Limits
- Automation tests for Zerocode lib itself
- Picking a leaf value from the array matching JSON Path
- Array assertions made easy, incl. size and element finder
-
Read Our Blogs
- Top 16 Open Source API Testing Tools For REST & SOAP Services - joecolantonio (Lists popular tools - Globally)
- OAuth2 Test Automation - DZone 2min Read
- Zero defect APIs - Build Pipe Line - Medium 10 min Read
- Develop ZeroDefect API's with ZeroCode! - Extreme Portal ( A must read for all developers and test engineers) 10min Read
- Performance testing using JUnit and maven - Codeproject 10 min Read
- REST API or SOAP End Point Testing - Codeproject 10min Read
- DZone- MuleSoft API Testing With Zerocode Test Framework - DZone 5min Read
- Testing need not be harder or slower, it should be easier and faster - DZone 5 min Read
- Kotlin Integration Testing simplified via Zerocode - Extreme portal 10 min Read
- and More...