Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
authorjapps authored Jan 22, 2024
2 parents 171628a + dcb1afe commit a759a19
Show file tree
Hide file tree
Showing 130 changed files with 2,374 additions and 357 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: authorjapps # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: https://paypal.me/authorjapps # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Build

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setting up JDK8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Downloading docker-compose files
run: wget https://raw.githubusercontent.com/authorjapps/zerocode-docker-factory/master/compose/kafka-schema-registry.yml
- name: Running Kafka
run: docker-compose -f kafka-schema-registry.yml up -d && sleep 10
- name: Building and testing the changes
run: mvn clean test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ package.properties
.project
.settings

*/target
*/target
.vscode
2 changes: 1 addition & 1 deletion .travis.yml → .travis_NOT_IN_USE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
#Still docker images are pulled every time. We need to cahche it for best practice.
before_install:
- wget https://raw.githubusercontent.com/authorjapps/zerocode-docker-factory/master/compose/kafka-schema-registry.yml
- docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN
- if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_TOKEN" ] ; then docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN; fi
- docker-compose -f kafka-schema-registry.yml up -d

#Just compile and run tests, also print version at the beginning.
Expand Down
58 changes: 52 additions & 6 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ mvn -pl core clean test
```

## With tests executed(kafka)
Some of the tests require a running Kafka (and some related components like kafka-rest, and kafka-schema-registry).
Some tests require a running Kafka (and some related components like kafka-rest, and kafka-schema-registry).

In the [zerocode-docker-factory repository](https://github.com/authorjapps/zerocode-docker-factory/) ([direct download link](https://raw.githubusercontent.com/authorjapps/zerocode-docker-factory/master/compose/kafka-schema-registry.yml))
you'll find 'kafka-schema-registry.yml', a docker-compose file that provides these components.

Download the file, and run(or `cd to the docker` dir and run)
Download the file, and run(or `cd to the docker/compose` dir and run)
```
docker-compose -f kafka-schema-registry.yml up -d
Expand All @@ -43,7 +40,10 @@ We have provided other compose-files just in-case anyone has to experiment tests
single-node or multi-node cluster(s) independently.
```

Then you can run
In the [zerocode-docker-factory repository](https://github.com/authorjapps/zerocode-docker-factory/) ([direct download link](https://raw.githubusercontent.com/authorjapps/zerocode-docker-factory/master/compose/kafka-schema-registry.yml))
you'll find 'kafka-schema-registry.yml', a docker-compose file that provides these components.

Then you can run:
```
mvn clean install <---- To build and install all the modules
Expand All @@ -61,3 +61,49 @@ As explained above, in the root/parent folder, please issue the below command(th
```
mvn clean install <---- To build and install all the modules
```

## Compiling in ARM Processors
You might get the following error when you do a "mvn clean install -DskipTests"

```java
[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]

//
// more details >>
//
[INFO] ZeroCode TDD Parent ................................ SUCCESS [ 0.504 s]
[INFO] Zerocode TDD Core .................................. SUCCESS [ 2.365 s]
[INFO] Zerocode Http Testing With Simple YAML and JSON DSL SUCCESS [ 0.413 s]
[INFO] Zerocode Kafka Testing With Simple YAML and JSON DSL FAILURE [ 0.507 s]
[INFO] Zerocode JUnit5 Jupiter Load Testing ............... SKIPPED
[INFO] Zerocode Automated Testing Maven Archetype ......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.858 s
[INFO] Finished at: 2023-12-16T10:31:44Z
[INFO] ------------------------------------------------------------------------
[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]

```

### Fix:
Go to --> .../zerocode/kafka-testing/pom.xml --> Comment the following line:

```shell
<!--
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
...
</plugin>-->
```
Then execute ""mvn clean install -DskipTests"" --> It should be SUCCESS.

Raise an Issue if you want to locally execute the tests involving "protos" and you aren't able to do it.

Visit here for more details:
- https://github.com/os72/protoc-jar-maven-plugin?tab=readme-ov-file
- https://github.com/os72/protoc-jar/issues/93
4 changes: 4 additions & 0 deletions ISSUES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## How To Raise Issues Correctly
Visit this [link](https://github.com/authorjapps/zerocode/wiki/Guidelines-for-raising-issues#right-way)

Visit this [page](https://github.com/authorjapps/zerocode/wiki/Guidelines-for-raising-issues) to learn more in a context.
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# ![Zerocode Logo](https://user-images.githubusercontent.com/12598420/86005149-287ee480-ba0c-11ea-91a0-d0811f15be75.png)

Automated API testing has never been so easy
<img width="135" height="120" alt="Zerocode" src="https://user-images.githubusercontent.com/12598420/51964581-e5a78e80-245e-11e9-9400-72c4c02ac555.png"> Zerocode
===
Automated API, Kafka and Micro-services testing has never been so easy


[![API](https://img.shields.io/badge/api-automation-blue)](https://github.com/authorjapps/zerocode/wiki/What-is-Zerocode-Testing)
[![Performance Testing](https://img.shields.io/badge/performance-testing-ff69b4.svg)](https://github.com/authorjapps/zerocode/wiki/Load-or-Performance-Testing-(IDE-based))
[![Twitter Follow](https://img.shields.io/twitter/follow/Zerocodeio.svg)](https://twitter.com/Zerocodeio)


**Latest release:🏹** [![Maven](https://maven-badges.herokuapp.com/maven-central/org.jsmart/zerocode-tdd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jsmart/zerocode-tdd/) <br/>
**Continuous Integration:** [![Build Status](https://travis-ci.org/authorjapps/zerocode.svg?branch=master)](https://travis-ci.org/authorjapps/zerocode) <br/>
**CI Testing:** ![example workflow](https://github.com/authorjapps/zerocode/actions/workflows/main.yml/badge.svg)
<br/>
**Issue Discussions:** [Slack](https://join.slack.com/t/zerocode-workspace/shared_invite/enQtNzYxMDAwNTQ3MjY1LTA2YmJjODJhNzQ4ZjBiYTQwZDBmZmNkNmExYjA3ZDk2OGFiZWFmNWJlNGRkOTdiMDQ4ZmQyNzcyNzVjNWQ4ODQ) <br/>
**Mailing List:** [Mailing List](https://groups.google.com/forum/#!forum/zerocode-automation) <br/>
**License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) <br/>
**LinkedIn:** [Zerocode](https://www.linkedin.com/company/49160481)

Zerocode Open Source makes it easy to create, change, orchestrate and maintain automated tests with the absolute minimum overhead for [REST](https://knowledge.zerocode.io/en/knowledge/automation-of-user-journey-create-update-and-get-employee-rest-apis), [SOAP](https://knowledge.zerocode.io/en/knowledge/soap-testing-automation-with-xml-input), [Kafka Real Time Data Streams](https://knowledge.zerocode.io/knowledge/kafka-testing-introduction) and much more. Tests created in Zerocode Open Source can be easily shared between teams for reviewing, editing, and versioning. The platform incorporates the best feedback and suggestions from the community to make it incredibly powerful, and we’re seeing rapid adoption across the developer/tester community

Quick Links
Zerocode makes it easy to create and maintain automated tests with absolute minimum overhead for [REST](https://github.com/authorjapps/zerocode/wiki/User-journey:-Create,-Update-and-GET-Employee-Details),[SOAP](https://github.com/authorjapps/zerocode/blob/master/README.md#soap-method-invocation-example-with-xml-input), [Kafka Real Time Data Streams](https://github.com/authorjapps/zerocode/wiki/Kafka-Testing-Introduction) and much more.
It has the best of best ideas and practices from the community to keep it super simple, and the adoption is rapidly growing among the developers & testers community.

Documentation
===
To get started with Zerocode Open Source and its features, visit
+ [Zerocode Documentation](https://knowledge.zerocode.io/knowledge)
+ [Quick Start guide](https://knowledge.zerocode.io/en/knowledge/zerocode-quick-start-guide)
+ [Release frequency](https://github.com/authorjapps/zerocode/wiki/Zerocode-release-frequency-and-schedule)
For a quick introduction to Zerocode and its features, visit the
+ [Zerocode TDD Doc Site](https://zerocode-tdd-docs.pages.dev)

IDE Support By
===
[<img width="135" height="120" alt="Jetbrains IDE" src="images/jetbrains.svg">](https://www.jetbrains.com/idea/)


Maven Dependency
===
Expand All @@ -33,11 +37,11 @@ Maven Dependency

Introduction
===
Zerocode Open Source is a lightweight, simple and extensible framework for writing test intentions in a simple JSON or YAML format that facilitates both declarative configuration and automation.
Zerocode is a modern lightweight, simple and extensible open-source framework for writing test intentions in simple JSON or YAML format that facilitates both declarative configuration and automation.

Put simply, Zerocode is a sollution for all API Development pain points. The objective is to bring simplicity to API automation. The framework provides a unified solution to manage response validations, target API invocations, perform load/stress testing and perform security testing using a the simple domain specific languages (DSL) JSON and YAML.
Put simply, Zerocode alleviates pain and brings simplicity to modern API automation. The framework manages the response validations, target API invocations, load/stress testing and security testing in a unified way using simple YAML/JSON/Fluent steps, aka DSL.

For example, if your REST API URL `https://localhost:8080/api/v1/customers/123` with `GET` method and `"Content-Type": "application/json"` returns the following payload and a `http` status code `200(OK)` ,
For example, if your REST API URL `https://localhost:8080/api/v1/customers/123` with `GET` method and `"Content-Type": "application/json"` returns the following payload and a `http` status code `200(OK)` ,
```javaScript
Response:
{
Expand All @@ -52,7 +56,9 @@ Response:
}
```

then, Zerocode Open Source can be easily used to validate API using as follows:
then, we can easily validate the above API using `Zerocode` like below.

+ Using YAML described as below,

> _The beauty here is, we can use the payload/headers structure for validation as it is without any manipulation or use a flat JSON path to skip the hassles of the entire object hierarchies._
Expand All @@ -75,7 +81,7 @@ validators:
- field: "$.status"
value: 200
- field: "$.body.type"
value: Premium High Value
value: Premium Visa
- field: "$.body.addresses[0].line1"
value: 10 Random St
```
Expand Down Expand Up @@ -104,7 +110,7 @@ Using JSON
},
{
"field": "$.body.type",
"value": "Premium High Value"
"value": "Premium Visa"
},
{
"field": "$.body.addresses[0].line1",
Expand Down Expand Up @@ -136,7 +142,7 @@ verify:
- application/json; charset=utf-8
body:
id: 123
type: Premium High Value
type: Premium Visa
addresses:
- type: Billing
line1: 10 Random St
Expand Down Expand Up @@ -167,7 +173,7 @@ Using JSON
},
"body": {
"id": 123,
"type": "Premium High Value",
"type": "Premium Visa",
"addresses": [
{
"type": "Billing",
Expand All @@ -180,18 +186,18 @@ Using JSON
}
```

The test can then be run simply by pointing to the above JSON/YAML file from a Junit `@Test` method.
and run it simply by pointing to the above JSON/YAML file from a JUnit `@Test` method.

```java
@Test
@Scenario("test_customer_get_api.yml")
public void getCustomer_happyCase(){
// No code goes here
// No code goes here. This remains empty.
}
```

The bottom line is that Zerocode Open Source makes automated API testing declarative and simple. If you’d like to learn more, visit the [quick-start guide](https://knowledge.zerocode.io/en/knowledge/zerocode-quick-start-guide) to get started testing - fast!
Looks simple n easy? Why not give it a try? Visit the [quick-start guide](https://github.com/authorjapps/zerocode/wiki/Getting-Started) or [user's guide](https://github.com/authorjapps/zerocode/wiki#developer-guide) for more insight.

Zerocode Open Source is used by many companies such as Vocalink, HSBC, HomeOffice(Gov) and [many others](https://knowledge.zerocode.io/knowledge/smart-projects-using-zerocode) to achieve an accurate production drop of their microservices. Learn more about [Validators Vs Matchers](https://knowledge.zerocode.io/knowledge/validators-and-matchers) here.
Zerocode is used by many companies such as Vocalink, HSBC, HomeOffice(Gov) and [many others](https://github.com/authorjapps/zerocode/wiki#smart-projects-using-zerocode) to achieve accurate production drop of their microservices. Learn more about [Validators Vs Matchers](https://github.com/authorjapps/zerocode/wiki/Validators-and-Matchers) here.

Happy testing!
Happy Testing! <g-emoji class="g-emoji" alias="panda_face" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f43c.png">🐼</g-emoji>
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-time-machine
theme: jekyll-theme-hacker
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>zerocode-tdd-parent</artifactId>
<groupId>org.jsmart</groupId>
<version>1.3.27-SNAPSHOT</version>
<version>1.3.36-SNAPSHOT</version>
</parent>

<artifactId>zerocode-tdd</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static String prettyXml(String input) {

final String formattedXml = prettyXmlWithIndentType(input, 2);

LOGGER.info("\n--------------------- Pretty XML -------------------------\n"
LOGGER.debug("\n--------------------- Pretty XML -------------------------\n"
+ formattedXml +
"\n------------------------- * -----------------------------\n");

Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/jsmart/zerocode/core/AddService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class AddService {
private static final Logger logger = LoggerFactory.getLogger(AddService.class);

public int add(int i, int i1) {
logger.info("i= " + i + ", j= " + i1);
logger.debug("i= " + i + ", j= " + i1);
return i + i1;
}

Expand All @@ -17,12 +17,12 @@ public Integer square(Integer number) {
}

public Integer squareMyNumber(MyNumber myNumber) {
logger.info("Calculating Square of " + myNumber.getNumber());
logger.debug("Calculating Square of " + myNumber.getNumber());
return myNumber.getNumber() * myNumber.getNumber();
}

public Integer anInteger() {
logger.info("Returning a number ");
logger.debug("Returning a number ");

return 30;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.jsmart.zerocode.core.engine.preprocessor.ZeroCodeExternalFileProcessorImpl;
import org.jsmart.zerocode.core.engine.preprocessor.ZeroCodeParameterizedProcessor;
import org.jsmart.zerocode.core.engine.preprocessor.ZeroCodeParameterizedProcessorImpl;
import org.jsmart.zerocode.core.engine.sorter.ZeroCodeSorter;
import org.jsmart.zerocode.core.engine.sorter.ZeroCodeSorterImpl;
import org.jsmart.zerocode.core.engine.validators.ZeroCodeValidator;
import org.jsmart.zerocode.core.engine.validators.ZeroCodeValidatorImpl;
import org.jsmart.zerocode.core.report.ZeroCodeReportGenerator;
Expand Down Expand Up @@ -65,6 +67,7 @@ public void configure() {
bind(ZeroCodeReportGenerator.class).to(ZeroCodeReportGeneratorImpl.class);
bind(ZeroCodeExternalFileProcessor.class).to(ZeroCodeExternalFileProcessorImpl.class);
bind(ZeroCodeParameterizedProcessor.class).to(ZeroCodeParameterizedProcessorImpl.class);
bind(ZeroCodeSorter.class).to(ZeroCodeSorterImpl.class);

// ------------------------------------------------
// Bind properties for localhost, CI, DIT, SIT etc
Expand All @@ -89,7 +92,7 @@ public Properties getProperties(String host) {
checkAndLoadOldProperties(properties);

} catch (Exception e) {
LOGGER.info("###Oops!Exception### while reading target env file: " + host + ". Have you mentioned env details?");
LOGGER.warning("###Oops!Exception### while reading target env file: " + host + ". Have you mentioned env details?");
throw new RuntimeException("could not read the target-env properties file --" + host + "-- from the classpath.");
}

Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/org/jsmart/zerocode/core/domain/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Step {
private final String url;
private final JsonNode request;
private final List<Validator> validators;
private final JsonNode sort;
private final JsonNode assertions;
private final String verifyMode;
private final JsonNode verify;
Expand Down Expand Up @@ -67,6 +68,10 @@ public List<Validator> getValidators() {
return validators;
}

public JsonNode getSort() {
return sort;
}

public JsonNode getAssertions() {
return assertions;
}
Expand Down Expand Up @@ -138,6 +143,7 @@ public Step(
@JsonProperty("url") String url,
@JsonProperty("request") JsonNode request,
@JsonProperty("validators") List<Validator> validators,
@JsonProperty("sort") JsonNode sort,
@JsonProperty("assertions") JsonNode assertions,
@JsonProperty("verify") JsonNode verify,
@JsonProperty("verifyMode") String verifyMode,
Expand All @@ -151,6 +157,7 @@ public Step(
this.method = method != null? method : operation;
this.request = request;
this.url = url;
this.sort = sort;
this.assertions = assertions.isNull() ? verify : assertions;
this.verify = verify;
this.ignoreStep = ignoreStep;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public static void attachSystemInfo() {
final String javaVersion = systemProperties.get("java.version");
final String javaVendor = systemProperties.get("java.vendor");

LOGGER.info("Where were the tests fired? Ans: OS:{}, Architecture:{}, Java:{}, Vendor:{}",
LOGGER.debug("System Info: OS:{}, Architecture:{}, Java:{}, Vendor:{}",
osName, osArchitecture, javaVersion, javaVendor);

LOGGER.debug("Where were the tests fired? Ans: OS:{}, Architecture:{}, Java:{}, Vendor:{}",
osName, osArchitecture, javaVersion, javaVendor);

extentReports.setSystemInfo("OS : ", osName);
Expand Down
Loading

0 comments on commit a759a19

Please sign in to comment.