-
-
Notifications
You must be signed in to change notification settings - Fork 399
About Motivation
Automated testing of REST APIs or SOAP APIs in a declarative fashion is still difficult in Java compared to the OSS frameworks provided by other programming languages like Python, JavaScript. These languages provide YAML or JSON or Fluent API interfaces or DSLs for easily writing test scenarios.
Zerocode brings similar simplicity to Java to validate a REST APIs/SOAP APIs in a declarative and configurable way.
Zerocode intends to solve many other testing challenges such as:
- Running tests in parallel
- Generating load/stress on the target server
- Writing tests using YAML, JSON or Java/Kotlin Fluent APIs
- Switching environments are configurable programmatically
- Running tests in a containerized way such as Docker
- Firing tests against multiple hosts in Microservices deployments
The motivation for the inception of Zerocode
has roots in the country's one of the largest Digital Transformation Project
which posed tough challenges to testing approach due to
- A large number of microservices being used to achieve various
workflows
based on REST APIs/JSON Payload - A large number of
data pipelines
to ingest various legacy system's data into the project’sBig Data
store. - REST APIs to be tested in
isolation
as well asintegrated
- Tests to be run in
parallel
to reduce feeedback time during the Build Pipeline - Small SIT and Large SIT should have their respective regression packs
- Performance testing to be done by developers themselves
- Data streams APIs should be validated easily
Over several brainstorming sessions, automation testers and developers came to a common conclusion to write tests
- Using enable Fluent APIs/DSLs
- That will allow anyone to change and maintain the tests easily
- Avoid writing boilerplate or glue code
- Large numbers of tests can be well organized for env specific regression packs
- Configurable for multiple environments (LAPTOP, DEV/DIT/CI, SIT, UAT, PRE-PROD etc)
The outcome of the sessions was to consider a steps based
scenario build-up approach with JUnit, like Cucumber/JBehave/Pyresttest where the underlying test and test data is picked from a referenced JSON file
or Text File
instead of a feature
file.
JSON is well recognized widely supported by all IDEs
and hence could prove to be a good approach.
In fact, many folks were already practicing this kind of approach in a similar manner in their respective Govt, Media, Banking and Retail projects, but was never unified so that the approach could be reused to address wide variety of testing problems and benefit more and more testers and developers across the program/industries.
After the implementation of the agreed approach we found that we were successfully able to achieve the following:
- Multiple
Jenkins Pipeline
integrations was seamless - Tests were simple,
human readable JSON/Java Fluent
files - Plugging in Custom HTTP Client was quick and easy
-
Test reports
were apt and to the point, easily searchable - Parallel running was declarative and easily configuration
The above approach helped the program in a big way.
Then in recent years Zerocode
has redesigned the DSLs and unified the approaches with feedback from the OpenSource community, by adding much more real-life testing features to make it easy and efficient.
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...