From 0fa0839cabed767b0394ba134b9e0e22b9765000 Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Thu, 30 May 2024 15:07:34 +0000
Subject: [PATCH 1/6] [issue-75] brought the first part of corrections
---
README.MD | 218 ++++++++++++++++++++++++++++++------------------------
1 file changed, 123 insertions(+), 95 deletions(-)
diff --git a/README.MD b/README.MD
index b189135..4abb9a9 100644
--- a/README.MD
+++ b/README.MD
@@ -4,12 +4,14 @@
# CUTE — create your tests easily
-HTTP and REST API testing for Go.
+HTTP and REST API testing for Go using Allure reports.
-Three steps for testing your HTTP service:
-1) Create request and write assets
-2) Run tests
-3) Check allure
+## Features
+
+- Expressive and intuitive syntax.
+- Built-in JSON support.
+- Custom asserts.
+- One step to BDD.
---
@@ -36,6 +38,11 @@ Three steps for testing your HTTP service:
3. [Errors](#assert_errors)
7. [Global Environment Keys](#global_env_keys)
+## Workflow
+1. Create a request and write assets.
+2. Run tests.
+3. Check Allure reports.
+
## Installation
```bash
@@ -46,38 +53,35 @@ Three steps for testing your HTTP service:
- Go 1.17+
-## Features
-
-- Full integration with Allure
-- Expressive and intuitive syntax
-- Built-in JSON support
-- Custom asserts
-- One step to BDD
## Demo
-1) Install allure
-```bash
- brew install allure
- ```
-2) Run example
+Run example.
```bash
make example
```
+To view detailed test reports, install Allure framework. It's optional.
+
+[Learn more about Allure reports](https://github.com/allure-framework)
+
+```bash
+ brew install allure
+ ```
+
+Run Allure.
-3) Run allure
```bash
allure serve ./examples/allure-results
```
-## Examples
+## Test examples
-See [examples](examples) directory for featured examples.
+See [Examples](examples) directory for featured examples.
-## Single test
+### Single-step test
-See an example of creating a single test. \
-For a result with **allure information** you can use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/blob/master/README_en.md#pkgprovidert).
+Allows implementing single-request tests. See full example in the [Examples](examples) directory.
+To view an Allure report, use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/blob/master/README_en.md#pkgprovidert).
```go
import (
@@ -109,20 +113,78 @@ func TestExample(t *testing.T) {
ExecuteTest(context.Background(), t)
}
```
+
+ Allure report
-See full example [here](examples/single_test.go)
+![img.png](.images/simple.png)
-**Allure:**
+
-![img.png](.images/simple.png)
+
+## Multi-step test
+
+Allows implementing several requests within one test.
+
+```go
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "testing"
+
+ "github.com/ozontech/cute"
+)
+
+func Test_TwoSteps(t *testing.T) {
+ responseCode := 0
+
+ // First step
+ cute.NewTestBuilder().
+ Title("Test with two requests and parse body.").
+ Tag("two_steps").
+ Create().
+ RequestBuilder(
+ cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
+ cute.WithMethod(http.MethodGet),
+ ).
+ ExpectStatus(http.StatusOK).
+ NextTest().
+
+ // Execute after first step and parse response code
+ AfterTestExecute(func(response *http.Response, errors []error) error {
+ responseCode = response.StatusCode
+
+ return nil
+ }).
+
+ // Second step
+ Create().
+ RequestBuilder(
+ cute.WithURI("https://jsonplaceholder.typicode.com/posts/2/comments"),
+ cute.WithMethod(http.MethodDelete),
+ ).
+ ExecuteTest(context.Background(), t)
+
+ fmt.Println("Response code from first request", responseCode)
+}
+```
+See full in the [Examples](examples/two_step_test.go) directory.
+
+
+ Allure report
+
+![multistep_test.png](.images/multistep_test.png)
+
+
## Suite
-Suite provides a structure in which you can describe tests by grouping them into test suites. This can be useful if you have a lot of different tests and it is difficult to navigate through them without having additional "layers nesting levels" of test calls.
+Suite provides a structure for describing tests by organizing them into test suites. It's helpful if you have a large number of different tests and find it difficult to browse through them without using additional layer nesting levels of test calls.
-You can read about `Allure.Suite` [here](https://github.com/ozontech/allure-go#suite)
+[Learn more about suite with Allure reports](https://github.com/ozontech/allure-go#suite)
-1) Declare a structure with `suite.Suite` and `*cute.HTTPTestMaker`
+
+1. Declare a structure with `suite.Suite` and `*cute.HTTPTestMaker`.
```go
import (
@@ -152,7 +214,7 @@ func (i *ExampleSuite) BeforeAll(t provider.T) {
}
```
-2) Declare test
+2. Declare a test.
```go
import (
@@ -164,7 +226,7 @@ func TestExampleTest(t *testing.T) {
}
```
-3) Just relax and describe tests
+3. Describe tests.
```go
import (
@@ -217,70 +279,18 @@ func (i *ExampleSuite) TestExample_OneStep(t provider.T) {
ExecuteTest(context.Background(), t)
}
```
-See full example [here](examples/suite)
+See full example in the [Examples](examples/suite) directory.
-**Allure:**
+
+ Allure report
![one_step.png](.images/one_step.png)
-
-## Multi-step test
-
-```go
-import (
- "context"
- "fmt"
- "net/http"
- "testing"
-
- "github.com/ozontech/cute"
-)
-
-func Test_TwoSteps(t *testing.T) {
- responseCode := 0
-
- // First step.
- cute.NewTestBuilder().
- Title("Test with two requests and parse body.").
- Tag("two_steps").
- Create().
- RequestBuilder(
- cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
- cute.WithMethod(http.MethodGet),
- ).
- ExpectStatus(http.StatusOK).
- NextTest().
-
- // Execute after first step and parse response code
- AfterTestExecute(func(response *http.Response, errors []error) error {
- responseCode = response.StatusCode
-
- return nil
- }).
-
- // Second step
- Create().
- RequestBuilder(
- cute.WithURI("https://jsonplaceholder.typicode.com/posts/2/comments"),
- cute.WithMethod(http.MethodDelete),
- ).
- ExecuteTest(context.Background(), t)
-
- fmt.Println("Response code from first request", responseCode)
-}
-```
-See full example [here](examples/two_step_test.go)
-
-**Allure:**
-
-![multistep_test.png](.images/multistep_test.png)
-
+
## Table tests
-One step to table tests...
-
-You have 2 ways to create table test. These ways have same allure reports.
+You can create a table test in 2 ways. They'll have the same Allure reports.
### Builder table tests
@@ -388,11 +398,14 @@ func Test_Execute_Array(t *testing.T) {
}
```
-See full example [here](examples/table_test/table_test.go)
+See full example in the [Examples](examples/table_test/table_test.go) directory.
+
+
+ Allure report
**Common allure for all table tests:**
-Report has **2 different** tests/suites:
+The report has 2 different tests or suites:
![table_tests_execute_array.png](.images/table_tests_execute_array.png)
@@ -400,9 +413,12 @@ Report has **2 different** tests/suites:
![table_tests_execute_array_test_1.png](.images/table_tests_execute_array_test_1.png)
+
+
## Asserts
-You can create your own asserts or use ready-made asserts from the package asserts
+You can create your own asserts or use ready-made from the package asserts.
+
### JSON asserts:
@@ -434,10 +450,13 @@ There are three ways to validate a JSON Schema. It all depends on where you have
- `ExpectJSONSchemaByte([]byte)` - is a function for compares a JSON schema from an array of bytes.
- `ExpectJSONSchemaFile(string)` - is a function for compares a JSON schema from a file or remote resource.
-**Allure:**
+
+ Allure report
![img.png](.images/json_schema.png)
+
+
## Custom asserts
You can implement [3 type of asserts](assert.go):
@@ -511,10 +530,13 @@ func customAssertBodySuite() cute.AssertBodyT {
```
-**Allure:**
+
+ Allure report
![custom_assert.png](.images/custom_assert.png)
+
+
### Assert errors
You can use method `errors.NewAssertError` from package [errors](errors/error.go):
@@ -556,10 +578,13 @@ type WithFields interface {
}
```
-**Allure:**
+
+ Allure report
![assert_error.png](.images/assert_error.png)
+
+
#### Optional assert
If assert returns optional error step will be **failed** but test will be success.
@@ -591,10 +616,13 @@ type OptionalError interface {
}
```
-**Allure:**
+
+ Allure report
![optional_error.png](.images/optional_error.png)
+
+
## Global Environment Keys
From 05a80506d6a4ab1c031b297a5c25f506be736e3b Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Fri, 31 May 2024 12:37:16 +0000
Subject: [PATCH 2/6] [issue-75] brought another part
---
README.MD | 177 +++++++++++++++++++++++++++++-------------------------
1 file changed, 95 insertions(+), 82 deletions(-)
diff --git a/README.MD b/README.MD
index 4abb9a9..3a69b15 100644
--- a/README.MD
+++ b/README.MD
@@ -15,28 +15,29 @@ HTTP and REST API testing for Go using Allure reports.
---
-## Head of contents:
-
-1. [Head of contents](#head-of-contents)
-2. [Installation](#installation)
-3. [Features](#features)
-4. [Demo](#demo)
-5. [Examples](#examples)
- 1. [Single test with Allure](#example_single_test)
- 2. [Suite tests](#example_suite_test)
- 3. [Multi-step test](#example_multi_step_test)
- 4. [Table tests](#example_table_tests)
- 1. [Builder](#example_table_tests_builder)
- 2. [Array](#example_table_tests_builder)
-6. [Asserts](#asserts)
- 1. [JSON asserts](#asserts_json)
- 2. [Headers asserts](#asserts_headers)
- 3. [JSON schema](#assert_json_schema)
- 4. [Custom asserts](#asserts_custom)
- 1. [Base](#asserts_custom_base)
- 2. [T](#asserts_custom_t)
- 3. [Errors](#assert_errors)
-7. [Global Environment Keys](#global_env_keys)
+## Head of contents
+
+- [Features](#features)
+- [Workflow](#workflow)
+- [Installation](#installation)
+- [Requirements](#requirements)
+- [Demo](#demo)
+- [Test examples](#test-examples)
+ - [Single test](#single-step-test)
+ - [Multi-step test](#multi-step-test)
+ - [Suite tests](#suite)
+ - [Table tests](#table-tests)
+- [Asserts](#asserts)
+ - [Ready-made asserts](#ready-made-asserts)
+ - [JSON asserts](#asserts_json)
+ - [Headers asserts](#asserts_headers)
+ - [JSON schema](#assert_json_schema)
+ - [Custom asserts](#asserts_custom)
+ - [Base](#asserts_custom_base)
+ - [T](#asserts_custom_t)
+ - [Errors](#assert_errors)
+- [Global Environment Keys](#global_env_keys)
+
## Workflow
1. Create a request and write assets.
@@ -76,11 +77,11 @@ Run Allure.
## Test examples
-See [Examples](examples) directory for featured examples.
+See [**Examples**](examples) directory for featured examples.
-### Single-step test
+###
-Allows implementing single-request tests. See full example in the [Examples](examples) directory.
+Allows implementing single-request tests. See full example in the [**Examples**](examples) directory.
To view an Allure report, use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/blob/master/README_en.md#pkgprovidert).
```go
@@ -121,7 +122,7 @@ func TestExample(t *testing.T) {
-## Multi-step test
+###
Allows implementing several requests within one test.
@@ -168,7 +169,7 @@ func Test_TwoSteps(t *testing.T) {
fmt.Println("Response code from first request", responseCode)
}
```
-See full in the [Examples](examples/two_step_test.go) directory.
+See full in the [**Examples**](examples/two_step_test.go) directory.
Allure report
@@ -177,7 +178,7 @@ See full in the [Examples](examples/two_step_test.go) directory.
-## Suite
+###
Suite provides a structure for describing tests by organizing them into test suites. It's helpful if you have a large number of different tests and find it difficult to browse through them without using additional layer nesting levels of test calls.
@@ -279,7 +280,7 @@ func (i *ExampleSuite) TestExample_OneStep(t provider.T) {
ExecuteTest(context.Background(), t)
}
```
-See full example in the [Examples](examples/suite) directory.
+See full example in the [**Examples**](examples/suite) directory.
Allure report
@@ -288,11 +289,11 @@ See full example in the [Examples](examples/suite) directory.
-## Table tests
+##
You can create a table test in 2 ways. They'll have the same Allure reports.
-### Builder table tests
+###
```go
import (
@@ -351,8 +352,7 @@ func Test_Table_Array(t *testing.T) {
}
```
-
-### Array tests
+###
```go
func Test_Execute_Array(t *testing.T) {
@@ -398,57 +398,64 @@ func Test_Execute_Array(t *testing.T) {
}
```
-See full example in the [Examples](examples/table_test/table_test.go) directory.
+See full example in the [**Examples**](examples/table_test/table_test.go) directory.
Allure report
-**Common allure for all table tests:**
-
-The report has 2 different tests or suites:
+Common report for all table tests:
![table_tests_execute_array.png](.images/table_tests_execute_array.png)
-**Main report:**
+Main report:
![table_tests_execute_array_test_1.png](.images/table_tests_execute_array_test_1.png)
-## Asserts
+
You can create your own asserts or use ready-made from the package asserts.
+### Ready-made asserts
+
+####
+
-### JSON asserts:
+- `Equal` is a function to assert that a JSONPath expression matches the given value.
+- `NotEqual` is a function to check that a JSONPath expression value isn't equal to the given value.
+- `Length` is a function to assert that value is the expected length.
+ - `GreaterThan` is a function to assert that value is greater than the given length.
+ - `GreaterOrEqualThan` is a function to assert that value is greater or equal to the given length.
+ - `LessThan` is a function to assert that value is less than the given length.
+ - `LessOrEqualThan` is a function to assert that value is less or equal to the given length.
+- `Present` is a function to assert that value is present. Value can be 0 or null.
+- `NotEmpty` is a function to assert that value is present and not empty. Value can't be 0 or null.
+- `NotPresent` is a function to assert that value isn't present.
+- `Diff` is a function to compare two JSONs.
+- `Contains` is a function to assert that a JSONPath expression extracts a value in an array.
+- `EqualJSON` is a function to check that a JSON path expression value is equal to given JSON.
+- `NotEqualJSON` is a function to check that a JSONPath expression value isn't equal to given JSON.
+- `GetValueFromJSON` is a function for getting a value from a JSON.
-You can find implementation [here](asserts/json/json.go)
+[Learn more about expressions](https://goessner.net/articles/JsonPath/)
-- `Equal` is a function to assert that a jsonpath expression matches the given value
-- `NotEqual` is a function to check that jsonpath expression value is not equal to the given value
-- `Length` is a function to assert that value is the expected length
-- `GreaterThan` is a function to assert that value is greater than the given length
-- `GreaterOrEqualThan` is a function to assert that value is greater or equal than the given length
-- `LessThan` is a function to assert that value is less than the given length
-- `LessOrEqualThan` is a function to assert that value is less or equal than the given length
-- `Present` is a function to assert that value is present (value can be 0 or null)
-- `NotEmpty` is a function to assert that value is present and not empty (value can't be 0 or null)
-- `NotPresent` is a function to assert that value is not present
+[Learn more about asserts implementation](https://github.com/ozontech/cute/blob/master/asserts/json/json.go)
-### Headers asserts:
+####
-See implementation [here](asserts/headers/headers.go)
+- `Present` is a function to assert that header is present.
+- `NotPresent` is a function to assert that header isn't present.
-- `Present` is a function to assert that header is present
-- `NotPresent` is a function to assert that header is not present
+[Learn more about asserts implementation](asserts/headers/headers.go)
-### JSON schema validations:
+####
-There are three ways to validate a JSON Schema. It all depends on where you have it.
+You can validate a JSON schema in 3 ways. Choose a way depending on JSON schema location.
-- `ExpectJSONSchemaString(string)` - is a function for compares a JSON schema from a string.
-- `ExpectJSONSchemaByte([]byte)` - is a function for compares a JSON schema from an array of bytes.
-- `ExpectJSONSchemaFile(string)` - is a function for compares a JSON schema from a file or remote resource.
+- `ExpectJSONSchemaString(string)` is a function for validating a JSON schema from a string.
+- `ExpectJSONSchemaByte([]byte)` is a function for validating a JSON schema from an array of bytes.
+- `ExpectJSONSchemaFile(string)` is a function for validating a JSON schema from a file or remote resource.
Allure report
@@ -457,11 +464,11 @@ There are three ways to validate a JSON Schema. It all depends on where you have
-## Custom asserts
+###
You can implement [3 type of asserts](assert.go):
-### Base
+####
Types for creating custom assertions.
@@ -471,7 +478,7 @@ Types for creating custom assertions.
type AssertResponse func(response *http.Response) error
```
-**Example:**
+Example:
```go
func customAssertBody() cute.AssertBody {
@@ -485,11 +492,14 @@ func customAssertBody() cute.AssertBody {
}
```
-### T
+####
+
+Used for creating custom asserts via Allure Actions](https://github.com/ozontech/allure-go#suite) and [testing.TB](https://pkg.go.dev/testing#TB).
+You can:
-Types for creating custom assertions using Allure [Actions](https://github.com/ozontech/allure-go#suite) and [testing.TB](https://pkg.go.dev/testing#TB). \
-You can log some information to Allure. \
-Also you can log error on Allure yourself or just return error.
+- log information to Allure,
+- log error on Allure yourself,
+- return an error.
```go
type AssertBodyT func(t cute.T, body []byte) error
@@ -497,7 +507,7 @@ Also you can log error on Allure yourself or just return error.
type AssertResponseT func(t cute.T, response *http.Response) error
```
-**Example with T:**
+Example with T:
```go
func customAssertBodyT() cute.AssertBodyT {
@@ -508,7 +518,8 @@ func customAssertBodyT() cute.AssertBodyT {
}
```
-**Example with step creations:**
+Example with creating steps:
+
```go
func customAssertBodySuite() cute.AssertBodyT {
return func(t cute.T, bytes []byte) error {
@@ -537,11 +548,12 @@ func customAssertBodySuite() cute.AssertBodyT {
-### Assert errors
+####
-You can use method `errors.NewAssertError` from package [errors](errors/error.go):
+You can use `errors.NewAssertError` method from [errors](errors/error.go) package.
Example:
+
```go
import (
"github.com/ozontech/cute"
@@ -558,9 +570,9 @@ func customAssertBodyWithCustomError() cute.AssertBody {
}
}
```
-If you'd like to create a pretty **error in your custom** assert you should implement error with [interfaces](errors/error.go):
+To create a pretty-error in your custom assert, implement it with [interfaces](errors/error.go):
-##### With name
+- Name.
```go
type WithNameError interface {
@@ -569,7 +581,7 @@ type WithNameError interface {
}
```
-#### With parameters for allure step
+- Parameters for Allure step.
```go
type WithFields interface {
@@ -586,9 +598,10 @@ type WithFields interface {
#### Optional assert
-If assert returns optional error step will be **failed** but test will be success.
-You can use method `errors.NewOptionalError(error)` from package [errors](errors/error.go):
+If assert returns an optional error, step fails but the test is successful.
+
+You can use `errors.NewOptionalError(error)` method from [errors](errors/error.go) package.
```go
import (
@@ -607,7 +620,7 @@ func customAssertBodyWithCustomError() cute.AssertBody {
}
```
-To create optional error you should implement error with interface
+To create optional error, implement error with interface:
```go
type OptionalError interface {
@@ -623,13 +636,13 @@ type OptionalError interface {
-## Global Environment Keys
+##
| Key | Meaning | Default |
|---|---------------------------------------------------------------|-------------------------|
-|`ALLURE_OUTPUT_PATH`| Path to output allure results | `.` (Folder with tests) |
-|`ALLURE_OUTPUT_FOLDER`| Name result folder | `/allure-results` |
-|`ALLURE_ISSUE_PATTERN`| Url pattepn to issue. **Must contain `%s`** | |
-|`ALLURE_TESTCASE_PATTERN`| URL pattern to TestCase. **Must contain `%s`**. | |
+|`ALLURE_OUTPUT_PATH`| Path to output allure results. | `.` (Folder with tests) |
+|`ALLURE_OUTPUT_FOLDER`| Name result folder. | `/allure-results` |
+|`ALLURE_ISSUE_PATTERN`| Url pattepn to issue. Must contain `%s`. | |
+|`ALLURE_TESTCASE_PATTERN`| URL pattern to TestCase. Must contain `%s`. | |
|`ALLURE_LAUNCH_TAGS`| Default tags for all tests. Tags must be separated by commas. | |
From 7bda8d16b814b5ff17b64fffbefa2a7f968ebaa9 Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Mon, 3 Jun 2024 13:48:31 +0000
Subject: [PATCH 3/6] [issue-75] readmi fix of links
---
README.MD | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/README.MD b/README.MD
index 3a69b15..33f4a41 100644
--- a/README.MD
+++ b/README.MD
@@ -12,6 +12,7 @@ HTTP and REST API testing for Go using Allure reports.
- Built-in JSON support.
- Custom asserts.
- One step to BDD.
+- Allure reports.
---
@@ -67,7 +68,7 @@ To view detailed test reports, install Allure framework. It's optional.
```bash
brew install allure
- ```
+```
Run Allure.
@@ -79,7 +80,7 @@ Run Allure.
See [**Examples**](examples) directory for featured examples.
-###
+###
Allows implementing single-request tests. See full example in the [**Examples**](examples) directory.
To view an Allure report, use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/blob/master/README_en.md#pkgprovidert).
@@ -122,7 +123,7 @@ func TestExample(t *testing.T) {
-###
+###
Allows implementing several requests within one test.
@@ -642,7 +643,7 @@ type OptionalError interface {
| Key | Meaning | Default |
|---|---------------------------------------------------------------|-------------------------|
|`ALLURE_OUTPUT_PATH`| Path to output allure results. | `.` (Folder with tests) |
-|`ALLURE_OUTPUT_FOLDER`| Name result folder. | `/allure-results` |
+|`ALLURE_OUTPUT_FOLDER`| Name of result folder. | `/allure-results` |
|`ALLURE_ISSUE_PATTERN`| Url pattepn to issue. Must contain `%s`. | |
|`ALLURE_TESTCASE_PATTERN`| URL pattern to TestCase. Must contain `%s`. | |
|`ALLURE_LAUNCH_TAGS`| Default tags for all tests. Tags must be separated by commas. | |
From 538fdc6093382a8d10a182691e690f691cddbcf6 Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Mon, 3 Jun 2024 14:02:12 +0000
Subject: [PATCH 4/6] [issue-75] link fix pt2
---
README.MD | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/README.MD b/README.MD
index 33f4a41..9718af0 100644
--- a/README.MD
+++ b/README.MD
@@ -30,14 +30,14 @@ HTTP and REST API testing for Go using Allure reports.
- [Table tests](#table-tests)
- [Asserts](#asserts)
- [Ready-made asserts](#ready-made-asserts)
- - [JSON asserts](#asserts_json)
- - [Headers asserts](#asserts_headers)
- - [JSON schema](#assert_json_schema)
- - [Custom asserts](#asserts_custom)
- - [Base](#asserts_custom_base)
- - [T](#asserts_custom_t)
- - [Errors](#assert_errors)
-- [Global Environment Keys](#global_env_keys)
+ - [JSON asserts](#json-asserts)
+ - [Headers asserts](#headers-asserts)
+ - [JSON schema](#json-schema-validations)
+ - [Custom asserts](#custom-asserts)
+ - [Base](#base)
+ - [T](#t)
+ - [Errors](#assert-errors)
+- [Global Environment Keys](#global-environment-keys)
## Workflow
@@ -59,7 +59,7 @@ HTTP and REST API testing for Go using Allure reports.
## Demo
Run example.
- ```bash
+```bash
make example
```
To view detailed test reports, install Allure framework. It's optional.
@@ -179,7 +179,7 @@ See full in the [**Examples**](examples/two_step_test.go) directory.
-###
+###
Suite provides a structure for describing tests by organizing them into test suites. It's helpful if you have a large number of different tests and find it difficult to browse through them without using additional layer nesting levels of test calls.
@@ -290,11 +290,11 @@ See full example in the [**Examples**](examples/suite) directory.
-##
+##
You can create a table test in 2 ways. They'll have the same Allure reports.
-###
+### Builder table tests
```go
import (
@@ -353,7 +353,7 @@ func Test_Table_Array(t *testing.T) {
}
```
-###
+### Array tests
```go
func Test_Execute_Array(t *testing.T) {
@@ -420,7 +420,7 @@ You can create your own asserts or use ready-made from the package asserts.
### Ready-made asserts
-####
+####
- `Equal` is a function to assert that a JSONPath expression matches the given value.
@@ -443,14 +443,14 @@ You can create your own asserts or use ready-made from the package asserts.
[Learn more about asserts implementation](https://github.com/ozontech/cute/blob/master/asserts/json/json.go)
-####
+####
- `Present` is a function to assert that header is present.
- `NotPresent` is a function to assert that header isn't present.
[Learn more about asserts implementation](asserts/headers/headers.go)
-####
+####
You can validate a JSON schema in 3 ways. Choose a way depending on JSON schema location.
@@ -465,11 +465,11 @@ You can validate a JSON schema in 3 ways. Choose a way depending on JSON schema
-###
+###
You can implement [3 type of asserts](assert.go):
-####
+#### Base
Types for creating custom assertions.
@@ -493,7 +493,7 @@ func customAssertBody() cute.AssertBody {
}
```
-####
+#### T
Used for creating custom asserts via Allure Actions](https://github.com/ozontech/allure-go#suite) and [testing.TB](https://pkg.go.dev/testing#TB).
You can:
@@ -549,7 +549,7 @@ func customAssertBodySuite() cute.AssertBodyT {
-####
+####
You can use `errors.NewAssertError` method from [errors](errors/error.go) package.
From 456c138cae78145a5475f446bcd21fb26ff78157 Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Mon, 3 Jun 2024 14:13:34 +0000
Subject: [PATCH 5/6] [issue-75] links fix pt3
---
README.MD | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.MD b/README.MD
index 9718af0..01576c2 100644
--- a/README.MD
+++ b/README.MD
@@ -83,7 +83,7 @@ See [**Examples**](examples) directory for featured examples.
###
Allows implementing single-request tests. See full example in the [**Examples**](examples) directory.
-To view an Allure report, use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/blob/master/README_en.md#pkgprovidert).
+To view an Allure report, use `testing.T` or `provider.T` from [allure-go](https://github.com/ozontech/allure-go/tree/master?tab=readme-ov-file).
```go
import (
@@ -495,7 +495,7 @@ func customAssertBody() cute.AssertBody {
#### T
-Used for creating custom asserts via Allure Actions](https://github.com/ozontech/allure-go#suite) and [testing.TB](https://pkg.go.dev/testing#TB).
+Used for creating custom asserts via [Allure Actions](https://github.com/ozontech/allure-go#suite) and [testing.TB](https://pkg.go.dev/testing#TB).
You can:
- log information to Allure,
@@ -637,7 +637,7 @@ type OptionalError interface {
-##
+## Global Environment Keys
| Key | Meaning | Default |
From 76edcf57e2aacc9fee51776f1092456cbf1c6677 Mon Sep 17 00:00:00 2001
From: kkatryunix <167317761+kkatryunix@users.noreply.github.com>
Date: Mon, 3 Jun 2024 14:45:53 +0000
Subject: [PATCH 6/6] [issue-75] global env keys link fix
---
README.MD | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.MD b/README.MD
index 01576c2..d378727 100644
--- a/README.MD
+++ b/README.MD
@@ -637,7 +637,7 @@ type OptionalError interface {
-## Global Environment Keys
+##
| Key | Meaning | Default |