Giter Site home page Giter Site logo

ozontech / cute Goto Github PK

View Code? Open in Web Editor NEW
180.0 5.0 17.0 1.11 MB

Library for simply creating HTTP tests in Go with Allure reports.

License: Apache License 2.0

Makefile 1.28% Go 98.72%
allure go golang http-testing qa qaautomation qatools testing testing-tools assertions http rest

cute's Introduction

cute

CUTE — create your tests easily

HTTP and REST API testing for Go.

Three steps for testing your HTTP service:

  1. Create request and write assets
  2. Run tests
  3. Check allure

Head of contents:

  1. Head of contents
  2. Installation
  3. Features
  4. Demo
  5. Examples
    1. Single test with Allure
    2. Suite tests
    3. Multi-step test
    4. Table tests
      1. Builder
      2. Array
  6. Asserts
    1. JSON asserts
    2. Headers asserts
    3. JSON schema
    4. Custom asserts
      1. Base
      2. T
      3. Errors
  7. Global Environment Keys

Installation

  go get -u github.com/ozontech/cute

Requirements

  • 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
  brew install allure
  1. Run example
 make example
  1. Run allure
  allure serve ./examples/allure-results

Examples

See examples directory for featured examples.

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.

import (
    "context"
    "net/http"
    "path"
    "testing"
    "time"

    "github.com/ozontech/cute"
    "github.com/ozontech/cute/asserts/json"
)

func TestExample(t *testing.T) {
    cute.NewTestBuilder().
        Title("Title").
        Description("some_description").
        Create().
        RequestBuilder(
            cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
            cute.WithMethod(http.MethodGet),
        ).
        ExpectExecuteTimeout(10*time.Second).
        ExpectStatus(http.StatusOK).
        AssertBody(
            json.Equal("$[0].email", "[email protected]"),
            json.Present("$[1].name"),
        ).
        ExecuteTest(context.Background(), t)
}

See full example here

Allure:

img.png

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.

You can read about Allure.Suite here

  1. Declare a structure with suite.Suite and *cute.HTTPTestMaker
import (
    "github.com/ozontech/cute"
    "github.com/ozontech/allure-go/pkg/framework/provider"
    "github.com/ozontech/allure-go/pkg/framework/suite"
)

type ExampleSuite struct {
    suite.Suite
    host *url.URL

    testMaker *cute.HTTPTestMaker
}

func (i *ExampleSuite) BeforeAll(t provider.T) {
    // Prepare http test builder
    i.testMaker = cute.NewHTTPTestMaker()

    // Preparing host
    host, err := url.Parse("https://jsonplaceholder.typicode.com/")
    if err != nil {
        t.Fatalf("could not parse url, error %v", err)
    }

    i.host = host
}
  1. Declare test
import (
    "github.com/ozontech/allure-go/pkg/framework/suite"
)

func TestExampleTest(t *testing.T) {
    suite.RunSuite(t, new(ExampleSuite))
}
  1. Just relax and describe tests
import (
    "github.com/ozontech/cute"
    "github.com/ozontech/cute/asserts/headers"
    "github.com/ozontech/cute/asserts/json"
)

func (i *ExampleSuite) TestExample_OneStep(t provider.T) {
    var (
        testBuilder = i.testMaker.NewTestBuilder()
    )
    
    u, _ := url.Parse(i.host.String())
    u.Path = path.Join(u.Path, "/posts/1/comments")
    
    testBuilder.
        Title("TestExample_OneStep").
        Tags("one_step", "some_local_tag", "json").
        Create().
        StepName("Example GET json request").
        RequestBuilder(
            cute.WithHeaders(map[string][]string{
                "some_header":       []string{"something"},
                "some_array_header": []string{"1", "2", "3", "some_thing"},
            }),
            cute.WithURL(u),
            cute.WithMethod(http.MethodGet),
        ).
        ExpectExecuteTimeout(10*time.Second).
        ExpectJSONSchemaFile("file://./resources/example_valid_request.json").
        ExpectStatus(http.StatusOK).
        AssertBody(
            json.Equal("$[0].email", "[email protected]"),
            json.Present("$[1].name"),
            json.NotPresent("$[1].some_not_present"),
            json.GreaterThan("$", 3),
            json.Length("$", 5),
            json.LessThan("$", 100),
            json.NotEqual("$[3].name", "kekekekeke"),
        ).
        OptionalAssertBody(
            json.GreaterThan("$", 3),
            json.Length("$", 5),
            json.LessThan("$", 100),
        ).
        AssertHeaders(
            headers.Present("Content-Type"),
        ).
        ExecuteTest(context.Background(), t)
}

See full example here

Allure:

one_step.png

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

Allure:

multistep_test.png

One step to table tests...

You have 2 ways to create table test. These ways have same allure reports.

import (
    "context"
    "fmt"
    "net/http"
    "testing"

    "github.com/ozontech/cute"
)

func Test_Table_Array(t *testing.T) {
    tests := []*cute.Test{
        {
            Name:       "test_1",
            Middleware: nil,
            Request: &cute.Request{
                Builders: []cute.RequestBuilder{
                    cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
                    cute.WithMethod(http.MethodPost),
                },
            },
            Expect: &cute.Expect{
                Code: 200,
            },
        },
        {
            Name:       "test_2",
            Middleware: nil,
            Request: &cute.Request{
                Builders: []cute.RequestBuilder{
                    cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
                    cute.WithMethod(http.MethodGet),
                },
            },
            Expect: &cute.Expect{
                Code: 200,
                AssertBody: []cute.AssertBody{
                    json.Equal("$[0].email", "[email protected]"),
                    json.Present("$[1].name"),
                    func(body []byte) error {
                        return errors.NewAssertError("example error", "example message", nil, nil)
                    },
                },
            },
        },
    }

    cute.NewTestBuilder().
        Title("Example table test").
        Tag("table_test").
        Description("Execute array tests").
        CreateTableTest().
        PutTests(tests...).
        ExecuteTest(context.Background(), t)
}
func Test_Execute_Array(t *testing.T) {
    tests := []*cute.Test{
        {
            Name:       "test_1",
            Middleware: nil,
            Request: &cute.Request{
                Builders: []cute.RequestBuilder{
                    cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
                    cute.WithMethod(http.MethodPost),
                },
            },
            Expect: &cute.Expect{
                Code: 200,
            },
        },
        {
            Name:       "test_2",
            Middleware: nil,
            Request: &cute.Request{
                Builders: []cute.RequestBuilder{
                    cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
                    cute.WithMethod(http.MethodGet),
                },
            },
            Expect: &cute.Expect{
                Code: 200,
                AssertBody: []cute.AssertBody{
                    json.Equal("$[0].email", "[email protected]"),
                    json.Present("$[1].name"),
                    func(body []byte) error {
                        return errors.NewAssertError("example error", "example message", nil, nil)
                    },
                },
            },
        },
    }

    for _, test := range tests {
        test.Execute(context.Background(), t)
    }
}

See full example here

Common allure for all table tests:

Report has 2 different tests/suites:

table_tests_execute_array.png

Main report:

table_tests_execute_array_test_1.png

You can create your own asserts or use ready-made asserts from the package asserts

You can find implementation here

  • 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

See implementation here

  • Present is a function to assert that header is present
  • NotPresent is a function to assert that header is not present

There are three ways to validate a JSON Schema. It all depends on where you have it.

  • 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.

Allure:

img.png

You can implement 3 type of asserts:

Types for creating custom assertions.

    type AssertBody func(body []byte) error
    type AssertHeaders func(headers http.Header) error
    type AssertResponse func(response *http.Response) error

Example:

func customAssertBody() cute.AssertBody {
    return func(bytes []byte) error {
        if len(bytes) == 0 {
            return errors.New("response body is empty")
        }
        
        return nil
    }
}

Types for creating custom assertions using Allure Actions and testing.TB.
You can log some information to Allure.
Also you can log error on Allure yourself or just return error.

    type AssertBodyT func(t cute.T, body []byte) error
    type AssertHeadersT func(t cute.T, headers http.Header) error
    type AssertResponseT func(t cute.T, response *http.Response) error

Example with T:

func customAssertBodyT() cute.AssertBodyT {
    return func(t cute.T, bytes []byte) error {
        require.GreaterOrEqual(t, len(bytes), 100)
        return nil
    }
}

Example with step creations:

func customAssertBodySuite() cute.AssertBodyT {
    return func(t cute.T, bytes []byte) error {
        step := allure.NewSimpleStep("Custom assert step")
        defer func() {
            t.Step(step)
        }()

        if len(bytes) == 0 {
            step.Status = allure.Failed
            step.Attachment(allure.NewAttachment("Error", allure.Text, []byte("response body is empty")))

            return nil
        }

        return nil
    }
}

Allure:

custom_assert.png

You can use method errors.NewAssertError from package errors:

Example:

import (
    "github.com/ozontech/cute"
    "github.com/ozontech/cute/errors"
)

func customAssertBodyWithCustomError() cute.AssertBody {
    return func(bytes []byte) error {
        if len(bytes) == 0 {
            return errors.NewAssertError("customAssertBodyWithCustomError", "body must be not empty", "len is 0", "len more 0")
        }

        return nil
    }
}

If you'd like to create a pretty error in your custom assert you should implement error with interfaces:

With name
type WithNameError interface {
    GetName() string
    SetName(string)
}

With parameters for allure step

type WithFields interface {
    GetFields() map[string]interface{}
    PutFields(map[string]interface{})
}

Allure:

assert_error.png

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:

import (
    "github.com/ozontech/cute"
    "github.com/ozontech/cute/errors"
)

func customAssertBodyWithCustomError() cute.AssertBody {
    return func(bytes []byte) error {
        if len(bytes) == 0 {
            return errors.NewOptionalError("body is empty")
        }

        return nil
    }
}

To create optional error you should implement error with interface

type OptionalError interface {
    IsOptional() bool
    SetOptional(bool)
}

Allure:

optional_error.png

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_LAUNCH_TAGS Default tags for all tests. Tags must be separated by commas.

cute's People

Contributors

alinaleena avatar apologiz avatar denisqsound avatar jejutic avatar shalimski avatar siller174 avatar sotanodroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cute's Issues

[v0.1.1] ValidateJSONSchema returns only 1 error, but should return several errors.

ValidateJSONSchema returns only 1 error, but should return several errors.

	body := []byte(`
	{
		"firstName": "Boris",
		"lastName": "Britva",
		"age": "1"
	}
	`)

       jsSchemaString = `
	{
	  "$id": "https://example.com/person.schema.json",
	  "$schema": "https://json-schema.org/draft/2020-12/schema",
	  "title": "Person",
	  "type": "object",
	  "properties": {
	    "firstName": {
	      "type": "string"
	    },
	    "lastName": {
	      "type": "integer"
	    },
	    "age": {
	      "type": "integer"
	    }
	  }
	}

[Refactoring] Refactor Expect methods

Reimplement these methods like Require and Assert, e.g. ExpectJSONSchemaString => AssertJSONSchemaString and RequireJSONSchemaString

func (qt *cute) ExpectExecuteTimeout(t time.Duration) ExpectHTTPBuilder {
	qt.tests[qt.countTests].Expect.ExecuteTime = t

	return qt
}

func (qt *cute) ExpectStatus(code int) ExpectHTTPBuilder {
	qt.tests[qt.countTests].Expect.Code = code

	return qt
}

func (qt *cute) ExpectJSONSchemaString(schema string) ExpectHTTPBuilder {
	qt.tests[qt.countTests].Expect.JSONSchema.String = schema

	return qt
}

func (qt *cute) ExpectJSONSchemaByte(schema []byte) ExpectHTTPBuilder {
	qt.tests[qt.countTests].Expect.JSONSchema.Byte = schema

	return qt
}

func (qt *cute) ExpectJSONSchemaFile(filePath string) ExpectHTTPBuilder {
	qt.tests[qt.countTests].Expect.JSONSchema.File = filePath

	return qt
}

Fix cuteErrors.NewAssertError function

Прошу исправить функцию cuteErrors.NewAssertError

сейчас если передавать параметры actual interface{} и expected interface{}, то в ответе они не возвращаются (и в результате теста тоже)

пример:
image

Possibility to not fail the test during retries

cute/roundtripper.go

Lines 103 to 108 in 9389b60

return cuteErrors.NewAssertError(
"Assert response code",
fmt.Sprintf("Response code expect %v, but was %v", it.Expect.Code, resp.StatusCode),
resp.StatusCode,
it.Expect.Code)
}

Would it be possible to have a way to configure this part to return optional error.

For example, here:

cute/test.go

Lines 56 to 58 in 9389b60

Count int
Delay time.Duration
}

type RequestRepeatPolitic struct {
        Count int
        OptionalError bool
        Delay time.Duration
}

Add an OptionalError bool that, if defined to true, will return cuteErrors.NewOptionalError instead of cuteErrors.NewAssertError
If the count has reached its last index, then switch back cuteErrors.NewAssertError and ultimately fail the test

add error types

Error typing is necessary to separate possible status code errors from others.

Добавить жесткий assert для статус кода

Тест продолжает исполняться даже если ExpectStatus(http.StatusOK) падает.
Ожидаешь 200, а получаешь 500, но тест шагает дальше.
Хотелось бы иметь жесткую проверку.

problem with ExpectJSONSchemaFile

reproduction steps:

  1. create json local file, example:
    { "name" : "Elton", "adult" : true }
  2. use ExpectJSONSchemaFile in my test
  3. in response has json like this:
    { "name" : "Ivan", "adult" : false }

expected result:
my test will have a fallen status, because name ≠ Elton and adult ≠ true

actual result:
my test is passed

If ExpectJSONSchemaFile only validate response by json schema, but not checking value, please add something like this for check json character by character

add log management

Logging becomes uninformative when using paralleltest. We can solve the problem by using short logs or by disabling them.
Example: step: <name_step>(<status_code>)
Perhaps a mini log constructor would solve the problem?

Please, think about additional assert types

Currently we have next asserts:

  • Contains
  • Equal
  • NotEqual
  • Length
  • GreaterThan
  • LessThan
  • Present
  • NotPresent

Please, think to add next assert types:

  • GreaterEqual
  • LessEqual
  • AssertArray

retries for failed tests

please add retries for failed tests within one suite. It would be nice to add something like t.retry tags or something like that

Can't read json_path syntax in AssertBody

code:
OptionalAssertBody( json.Equal("$.entries[?(@.role == 'HR-партнер')].event", "Анкета согласована"), ).
error:
test.go:178: [OPTIONAL ERROR] evaluating '$.entries[?(@.role == 'Сторонняя система проверки СБ')].event' resulted in error: 'parsing error: $.entries[?(@.role == 'Сторонняя система проверки СБ')].event :1:23 - 1:54 could not parse string: invalid syntax'

This syntax is corresponds to the library JsonPath, but using this in 0.1.8 make error

go: github.com/ohler55/[email protected]: invalid version: unknown revision v1.12.9

The module requests a dependency that apparently no longer exists, because the last tag that is in the specified repository is 1.15.0 (but it is available at https://pkg.go.dev/github.com/ohler55/[email protected])

.../go list -modfile=.../go.mod -m -json -mod=mod all #gosetup
go: github.com/ohler55/[email protected]: invalid version: unknown revision v1.12.9

It only helps to forcibly specify a newer version 1.21.1

require (
    ...
    github.com/ozontech/cute v0.1.14
    ...
)

require (
    ...
    github.com/ohler55/ojg v1.21.0 // indirect
    ...
)

Suggestion to correct mistakes in "about" section

Hey, fellow ozon developers 👋
I suggest, you may update the text of "about" section of this repository and correct mistakes in the use of English:

Library for simply creates HTTP tests in Go with Allure reports. ->
Library for simply creating HTTP tests in Go with Allure reports.

It would be much better English 🙂
Cheers ✌️

Logs in console

We need to be able to output logs to the console when running locally, or instructions on how to add them

Update allure-go v0.6.18

Update to

github.com/ozontech/allure-go/pkg/allure v0.6.4
github.com/ozontech/allure-go/pkg/framework v0.6.18
github.com/ozontech/allure-go v0.6.18

Fix cuteErrors.NewAssertError function

Прошу исправить функцию cuteErrors.NewAssertError, сейчас если в ней указывать параметры actual interface{}, expected interface{}, то они не выводятся в ответе (и в результе выполнения теста)

New release

So.... Time to change something.

  1. Update linter
  2. Update allure-go
  3. Support new allure labels
func (it *cute) Titlef(format string, args ...interface{}) AllureBuilder 
func (it *cute) Descriptionf(format string, args ...interface{}) AllureBuilder 
func (it *cute) Stage(stage string) AllureBuilder 
func (it *cute) Stagef(format string, args ...interface{}) AllureBuilder 
func (it *cute) Layer(value string) AllureBuilder 
func (it *cute) TmsLink(tmsLink string) AllureBuilder 
func (it *cute) TmsLinks(tmsLinks ...string) AllureBuilder
  1. Support provider.StepCtx
func TestInsideStep(t *testing.T) {
	runner.Run(t, "Single test with allure-go Runner", func(t provider.T) {

		t.WithNewStep("First step", func(sCtx provider.StepCtx) {
			sCtx.NewStep("Inside first step")
		})

		t.WithNewStep("Step name", func(sCtx provider.StepCtx) {
			u, _ := url.Parse("https://jsonplaceholder.typicode.com/posts/1/comments")

			cute.NewTestBuilder().
				Title("Super simple test").
				Tags("simple", "suite", "some_local_tag", "json").
				Parallel().
				Create().
				RequestBuilder(
					cute.WithHeaders(map[string][]string{
						"some_header": []string{"something"},
					}),
					cute.WithURL(u),
					cute.WithMethod(http.MethodPost),
				).
				ExpectExecuteTimeout(10*time.Second).
				ExpectStatus(http.StatusCreated).
				ExecuteTest(context.Background(), sCtx) // <---- Execute test with provider.StepCtx
		})
	})

}
  1. Remove EnableHardValidation
  2. Fix bug with custom http.Client
  3. Implement new library for jsonPath

Add assert for json respone

Response fields data usually differ for different requests, but it would be nice to have ability to check full body data with one check. It will also help to avoid huge amount of asserts in test case.

require and assert

Usually in test framework for hard and soft checks use Require and Assert word. Now you can turn on all checks to hard or soft mode.
Please, fix it

Misleading documentation in the README

Readme file contains misleading information about Suite cases.

Provided example does not work:

func (i *ExampleSuite) BeforeAll(t provider.T) {
    // Prepare http test builder
    i.testMaker = cute.NewHTTPTestMakerSuite()

    // Preparing host
    host, err := url.Parse("https://jsonplaceholder.typicode.com/")
    if err != nil {
        t.Fatalf("could not parse url, error %v", err)
    }

    i.host = host
}

Package cute contains no NewHTTPTestMakerSuite, instead it has NewHTTPTestMaker.

Please update current documentation on suites

Не прокидывается httpClient и jsonMarshaler для табличный тестов

Проблема возникает при создании тестов по инструкции: https://github.com/ozontech/cute?tab=readme-ov-file#table-tests
Создаётся []*cute.Test, с приватными полями httpClient и jsonMarshaler, которые дальше по коду нигде не прокидываются.

При вызове

cute/test.go

Line 434 in 9c6558e

body, err = it.jsonMarshaler.Marshal(o.bodyMarshal)

появляется panic: runtime error: invalid memory address or nil pointer dereference, что немного не приятно...

Not correct allure report in multi step tests

If use multi step feature in Suite:


func (i *ExampleSuite) TestExample_TwoSteps(t provider.T) {
	var (
		testBuilder = i.testMaker.NewTestBuilder()
	)

	testBuilder.
		Title("TestExample_TwoSteps").
		Tags("TestExample_TwoSteps", "some_tag").
		Parallel().
		CreateWithStep().

		// CreateWithStep first step

		StepName("Creat entry /posts/1").
		Request(req).
		ExpectExecuteTimeout(10*time.Second).
		ExpectStatus(http.StatusCreated).
		AssertBody(
			// Custom assert body
			examples.CustomAssertBody(),
		).
		ExecuteTest(context.Background(), t).

		// CreateWithStep second step for delete

		NextTestWithStep().
		StepName("Delete entry").
		RequestBuilder(
			cute.WithURL(u),
			cute.WithMethod(http.MethodDelete),
			cute.WithHeaders(map[string][]string{
				"some_auth_token": []string{fmt.Sprint(11111)},
			}),
		).
		ExecuteTest(context.Background(), t)
}

Result:
image

But if create test is't in suite


func TestExampleSingleTes_Witouttitle(t *testing.T) {
	cute.NewTestBuilder().
		Title("TestExample123123123132112313").
		Tags("TestExample_TwoSteps", "some_tag").
		CreateWithStep().
		StepName("Create entry"). // Создание 1 шага
		RequestBuilder(
			cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
			cute.WithMethod(http.MethodPost),
		).
		ExpectStatus(http.StatusMultiStatus).
		AssertBody(
			// Custom assert body
			CustomAssertBody(),
		).
		ExecuteTest(context.Background(), t).
		NextTestWithStep().
		StepName("Delete entry"). // Создание 2 шага
		RequestBuilder(
			cute.WithURI("https://jsonplaceholder.typicode.com/posts/1/comments"),
			cute.WithMethod(http.MethodDelete),
		).
		ExecuteTest(context.Background(), t)
}

First step will not create in allure report.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.