Skip to content

Commit

Permalink
feature: added testable examples, updated error strings, updated READ…
Browse files Browse the repository at this point in the history
…ME.md
  • Loading branch information
Paweł Chmielewski authored and pawelWritesCode committed Jun 15, 2022
1 parent fec651b commit 53c3b5b
Show file tree
Hide file tree
Showing 3 changed files with 551 additions and 129 deletions.
140 changes: 70 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![gdutils](https://github.com/pawelWritesCode/gdutils/workflows/gdutils/badge.svg)](https://github.com/pawelWritesCode/gdutils/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/pawelWritesCode/gdutils.svg)](https://pkg.go.dev/github.com/pawelWritesCode/gdutils) ![Coverage](https://img.shields.io/badge/Coverage-65.2%25-brightgreen)
[![gdutils](https://github.com/pawelWritesCode/gdutils/workflows/gdutils/badge.svg)](https://github.com/pawelWritesCode/gdutils/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/pawelWritesCode/gdutils.svg)](https://pkg.go.dev/github.com/pawelWritesCode/gdutils) ![Coverage](https://img.shields.io/badge/Coverage-65.7%25-brightgreen)

# GDUTILS

Expand Down Expand Up @@ -41,73 +41,73 @@ if err := ac.AssertNodeIsType(format.JSON, "$.gifs", types.Array); err != nil {

### Available methods:

| NAME | DESCRIPTION |
|----------------------------------------|:----------------------------------------------------------------------------------------:|
| | |
| **Sending HTTP(s) requests:** | |
| | |
| RequestSendWithBodyAndHeaders | Sends HTTP(s) request with provided body and headers. |
| RequestPrepare | Prepare HTTP(s) request |
| RequestSetHeaders | Sets provided headers for previously prepared request |
| RequestSetForm | Sets provided form for previously prepared request |
| RequestSetCookies | Sets provided cookies for previously prepared request |
| RequestSetBody | Sets body for previously prepared request |
| RequestSend | Sends previously prepared HTTP(s) request |
| | |
| **Random data generation:** | |
| | |
| GenerateRandomInt | Generates random integer from provided range and save it under provided cache key |
| GenerateFloat64 | Generates random float from provided range and save it under provided cache key |
| GeneratorRandomRunes | Creates generator for random strings from provided charset in provided range |
| GeneratorRandomSentence | Creates generator for random sentence from provided charset in provided range |
| GetTimeAndTravel | Accepts time object and move in time by given time interval |
| GenerateTimeAndTravel | Creates current time object and move in time by given time interval |
| | |
| **Preserving data:** | |
| | |
| SaveNode | Saves from last response body JSON node under given cacheKey key |
| SaveHeader | Saves into cache given header value |
| Save | Saves into cache arbitrary passed value |
| | |
| **Debugging:** | |
| | |
| DebugPrintResponseBody | Prints last response from request |
| DebugStart | Starts debugging mode |
| DebugStop | Stops debugging mode |
| | |
| **Flow control:** | |
| | |
| Wait | Stops test execution for provided amount of time |
| | |
| **Assertions:** | |
| | |
| AssertResponseHeaderExists | Checks whether last HTTP(s) response has given header |
| AssertResponseHeaderNotExists | Checks whether last HTTP(s) response doesn't have given header |
| AssertResponseHeaderValueIs | Checks whether last HTTP(s) response has given header with provided value |
| AssertStatusCodeIs | Checks last HTTP(s) response status code |
| AssertStatusCodeIsNot | Checks if last HTTP(s) response status code is not of provided value |
| AssertResponseFormatIs | Checks whether last HTTP(s) response body has given data format |
| AssertResponseFormatIsNot | Checks whether last HTTP(s) response body doesn't have given data format |
| AssertNodeExists | Checks whether last response body contains given key |
| AssertNodeNotExists | Checks whether last response body doesn't contain given key |
| AssertNodesExist | Checks whether last HTTP(s) response body JSON has given nodes |
| AssertNodeIsTypeAndValue | Compares json node value from expression to expected by user |
| AssertNodeIsTypeAndHasOneOfValues | Compares node value from expression to expected by user set of values |
| AsserNodeContainsSubString | Checks whether node value from expression contains given substring |
| AsserNodeNotContainsSubString | Checks whether node value from expression doesn't contain given substring |
| AssertNodeIsType | Checks whether node from last HTTP(s) response body is of provided type |
| AssertNodeIsNotType | Checks whether node from last HTTP(s) response body is not of provided type |
| AssertNodeMatchesRegExp | Checks whether last HTTP(s) response body JSON node matches regExp |
| AssertNodeNotMatchesRegExp | Checks whether last HTTP(s) response body JSON node doesn't match regExp |
| AssertNodeSliceLengthIs | checks whether given key is slice and has given length |
| AssertNodeSliceLengthIsNot | checks whether given key is slice and doesn't have given length |
| AssertResponseMatchesSchemaByReference | Validates last HTTP(s) response body against provided in reference JSON schema |
| AssertResponseMatchesSchemaByString | Validates last HTTP(s) response body against provided JSON schema |
| AssertNodeMatchesSchemaByString | Validates last HTTP(s) response body JSON node against provided JSON schema |
| AssertNodeMatchesSchemaByReference | Validates last HTTP(s) response body JSON node against provided in reference JSON schema |
| AssertTimeBetweenRequestAndResponseIs | Asserts that last HTTP(s) request-response time is <= than expected |
| AssertResponseCookieExists | Checks whether last HTTP(s) response has given cookie |
| AssertResponseCookieNotExists | Checks whether last HTTP(s) response doesn't have given cookie |
| AssertResponseCookieValueIs | Checks whether last HTTP(s) response has given cookie of given value |
| AssertResponseCookieValueMatchesRegExp | Checks whether last HTTP(s) response has given cookie matching provided regExp |
| NAME | DESCRIPTION |
|-------------------------------------------|:----------------------------------------------------------------------------------------:|
| | |
| **Sending HTTP(s) requests:** | |
| | |
| RequestSendWithBodyAndHeaders | Sends HTTP(s) request with provided body and headers. |
| RequestPrepare | Prepare HTTP(s) request |
| RequestSetHeaders | Sets provided headers for previously prepared request |
| RequestSetForm | Sets provided form for previously prepared request |
| RequestSetCookies | Sets provided cookies for previously prepared request |
| RequestSetBody | Sets body for previously prepared request |
| RequestSend | Sends previously prepared HTTP(s) request |
| | |
| **Random data generation:** | |
| | |
| GenerateRandomInt | Generates random integer from provided range and save it under provided cache key |
| GenerateFloat64 | Generates random float from provided range and save it under provided cache key |
| GeneratorRandomRunes | Creates generator for random strings from provided charset in provided range |
| GeneratorRandomSentence | Creates generator for random sentence from provided charset in provided range |
| GetTimeAndTravel | Accepts time object and move in time by given time interval |
| GenerateTimeAndTravel | Creates current time object and move in time by given time interval |
| | |
| **Preserving data:** | |
| | |
| SaveNode | Saves from last response body JSON node under given cacheKey key |
| SaveHeader | Saves into cache given header value |
| Save | Saves into cache arbitrary passed value |
| | |
| **Debugging:** | |
| | |
| DebugPrintResponseBody | Prints last response from request |
| DebugStart | Starts debugging mode |
| DebugStop | Stops debugging mode |
| | |
| **Flow control:** | |
| | |
| Wait | Stops test execution for provided amount of time |
| | |
| **Assertions:** | |
| | |
| AssertResponseHeaderExists | Checks whether last HTTP(s) response has given header |
| AssertResponseHeaderNotExists | Checks whether last HTTP(s) response doesn't have given header |
| AssertResponseHeaderValueIs | Checks whether last HTTP(s) response has given header with provided value |
| AssertStatusCodeIs | Checks last HTTP(s) response status code |
| AssertStatusCodeIsNot | Checks if last HTTP(s) response status code is not of provided value |
| AssertResponseFormatIs | Checks whether last HTTP(s) response body has given data format |
| AssertResponseFormatIsNot | Checks whether last HTTP(s) response body doesn't have given data format |
| AssertNodeExists | Checks whether last response body contains given key |
| AssertNodeNotExists | Checks whether last response body doesn't contain given key |
| AssertNodesExist | Checks whether last HTTP(s) response body JSON has given nodes |
| AssertNodeIsTypeAndValue | Compares json node value from expression to expected by user |
| AssertNodeIsTypeAndHasOneOfValues | Compares node value from expression to expected by user set of values |
| AssertNodeContainsSubString | Checks whether node value from expression contains given substring |
| AssertNodeNotContainsSubString | Checks whether node value from expression doesn't contain given substring |
| AssertNodeIsType | Checks whether node from last HTTP(s) response body is of provided type |
| AssertNodeIsNotType | Checks whether node from last HTTP(s) response body is not of provided type |
| AssertNodeMatchesRegExp | Checks whether last HTTP(s) response body JSON node matches regExp |
| AssertNodeNotMatchesRegExp | Checks whether last HTTP(s) response body JSON node doesn't match regExp |
| AssertNodeSliceLengthIs | checks whether given key is slice and has given length |
| AssertNodeSliceLengthIsNot | checks whether given key is slice and doesn't have given length |
| AssertResponseMatchesSchemaByReference | Validates last HTTP(s) response body against provided in reference JSON schema |
| AssertResponseMatchesSchemaByString | Validates last HTTP(s) response body against provided JSON schema |
| AssertNodeMatchesSchemaByString | Validates last HTTP(s) response body JSON node against provided JSON schema |
| AssertNodeMatchesSchemaByReference | Validates last HTTP(s) response body JSON node against provided in reference JSON schema |
| AssertTimeBetweenRequestAndResponseIs | Asserts that last HTTP(s) request-response time is <= than expected |
| AssertResponseCookieExists | Checks whether last HTTP(s) response has given cookie |
| AssertResponseCookieNotExists | Checks whether last HTTP(s) response doesn't have given cookie |
| AssertResponseCookieValueIs | Checks whether last HTTP(s) response has given cookie of given value |
| AssertResponseCookieValueMatchesRegExp | Checks whether last HTTP(s) response has given cookie matching provided regExp |
| AssertResponseCookieValueNotMatchesRegExp | Checks whether last HTTP(s) response has given cookie is not matching provided regExp |
Loading

0 comments on commit 53c3b5b

Please # to comment.