API testing with Karate Pact Broker, Pact - GregLinthicum/From-Logistic-Regression-to-Long-short-term-memory-RNN GitHub Wiki
Before you dive:
Remember: As a general rule, creating the contract by hand - that is, manually crafting a JSON document according to the pact specification - is an anti-pattern in Pact.
Meaning, you really need to rely on writing Test Cases in Pact and letting Pact issue automatically generated JSON file. Otherwise you expose your work to end up as a deprecated version of JSON Pact, that requires manual corrections upon every version change.
Contract testing with Pact, Pact Broker and ChatGPT ( OpenAI ).pdf part #1
Contract testing with Pact, Pact Broker and ChatGPT ( OpenAI ).pdf part #2
CODE: ChatGPT_generated_Masker_customised004.py
DATA in: JSON (Contract (line 107-to-145)
DATA out: JSON article_regex_demo-REGEX-ized.json
IntelliJ + Java + Gradle + Pact Broker on local Windows 10 Pro ( 2024-01 )
Make sure that you have Windows 10 Pro ( might cost you $100 to upgrade from Home) , or Windows 11.
-
Download Community version of IDEA IntelliJ IDEA, install it.
-
Download Desktop Docker Docker Desktop 4.26.1
-
From DOS CMD, or from PowerShell run 'netstat' to get initial idea about ports used already
-
In windows search type Docker. This will start a docker. Takes a minute or so.
-
From DOS CMD, or from PowerShell run 'docker version'. Expect something like the output below:
PS C:\Users\Greg> docker version Client: Cloud integration: v1.0.35+desktop.5 Version: 24.0.7 API version: 1.43 Go version: go1.20.10 Git commit: afdd53b Built: Thu Oct 26 09:08:44 2023 OS/Arch: windows/amd64 Context: default
Server: Docker Desktop 4.26.1 (131620) Engine: Version: 24.0.7 API version: 1.43 (minimum version 1.12) Go version: go1.20.10 Git commit: 311b9ff Built: Thu Oct 26 09:08:02 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.25 GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f runc: Version: 1.1.10 GitCommit: v1.1.10-0-g18a0cb0 docker-init: Version: 0.19.0 GitCommit: de40ad0 PS C:\Users\Greg>
-
Download the third party ready sample project from a reputable source on GitHub
-
In CMD cd to where your project is. run docker compose : >docker-compose -f docker-compose-pactbroker.yml up
-
At this time you should be able to see the container in the Docker:
-
Open InteliJ, select existing project and navigate to the set of directories you downloaded from GitHub
-
Gradle might complain that JDK is not installed on your machine ( mine was pretty virgin ). Navigate to Oracle distributions of Java JDK and download JDK Development Kit 21.0.1 downloads
JetBrains Rider + C# + Pact Broker + netcoreapp3.1 + Microsoft.NET.Test.Sdk16.6.0 ( 2024-01 )
DevMentors video accompanied by this GitHub; be aware that DevMentors implemented and promote here the library they created, Pactify, that is declaratively, creating the same pacts as Pact itself.
-
Assuming docker already installed. Start docker itself
-
Start composing dockers by running 'docker-compose' command for each yml file in the folder Pacco-master/compose
Some compositions might fail. you need to debug. But overall they work for me. Looks something like that: docker-compose
Karate
Karate provides the true writing test scenarios in Gherkin. I mean, contrary to what you do in other frameworks, that is write code in Java, C# or whatever language of your choice and only invoke your functions from Gherkin lines ( that improves readability, but only readability) , in Karate you actually do NOT code to implement Gherkin. In Karate you use a second layer of keywords ( yellow in VSCode), specialized in API testing, but already implemented for you. This approach falls into category of DSL, Domain Specific Language. You are not locked. Karate DSL can be extended.
I do not hesitate to recommend this course Performance tests are recommended to be performed by Gatling
The instructor dives into Docker and Performance testing with Gatling -- mvn clean test-compile gatling:test -- just my cheat sheet for syntax. Note as well, that karate is polyglotal, as most modern Frameworks; that is one can directly invoke JS or Java functions directly from Gherkin, but as well via plugins Karate project can benefit from other languages, for example from Scala when integrated with Gatling.
inject( atOnceUsers(1),
nothingFor(8 seconds),
constantUsersPerSec(4) during (20 seconds),
nothingFor(8 seconds),
constantUsersPerSec(5) during (20 seconds),
nothingFor(8 seconds),
rampUsersPerSec(1) to 10 during (30 seconds),
nothingFor(15 seconds),
rampUsersPerSec(1) to 15 during (120 seconds),
nothingFor(15 seconds),
constantUsersPerSec(1) during (5 seconds)
).protocols(protocol)
Multiple ramping schedules within one performance test execution allow to quickly diagnose dependencies between number of users, user activity velocity and non-failure abilities of the server under test.
DevOps Quality Engineering
Shift Left - Pipelines - GitOPS - CI/CD, Recommended Pipelines forThe term “Shift Left” was first coined by Dan Ashby in 2011.
Not even 9 minutes to do build, deploy, test
Recent activities
Kubernetes
Lesson #188 Running Kubernetes Cluster on Desktop PC
Lesson #191 got access via Cluster's Load Balancer IP
Lesson #199 Declarative deployment from deployment.yaml file
Lesson #234 splitting a Pod into two Pods_within the same_Cluster
Lesson #234 new external IP requested from the Minikube and POSTMAN is happy
Lesson 237 React application runs in the Docker, still not in the Minicube
..