Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the assertion fails, an error message is generated, and a test report is not generated #1724

Open
soonsolidtest opened this issue Jan 12, 2024 · 1 comment
Labels
pending pending for confirmation

Comments

@soonsolidtest
Copy link

Describe the bug

Please give a brief description of the bug;
When the assertion fails, the test is not considered to have failed, an error message is generated, and a test report is not generated.
attach the running command and the stack information when the error is reported
```
validate:
- eq: ["status_code", 100]

` hrp run resin_test_new.yaml --gen-html-report
`
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0xc0003feb38 addr=0x13721e0 pc=0x17abde0]

goroutine 1 [running]:
main.main.func1()
        /github/workspace/hrp/cmd/cli/main.go:20 +0x6b
panic({0x1936c80?, 0x2203e90?})
        /usr/local/go/src/runtime/panic.go:914 +0x21f
testing.(*common).decorate(0x1010265?, {0xc00001a400, 0x3c5}, 0x0?)
        /usr/local/go/src/testing/testing.go:772 +0xa0
testing.(*common).logDepth(0xc0001031e0, {0xc00001a400, 0x3c5}, 0x3)
        /usr/local/go/src/testing/testing.go:1035 +0x1dd
testing.(*common).log(...)
        /usr/local/go/src/testing/testing.go:1004
testing.(*common).Errorf(0xc0001031e0, {0x1a5e76f?, 0x100de85?}, {0xc00004bb80?, 0x18d9bc0?, 0x301?})
        /usr/local/go/src/testing/testing.go:1068 +0x54
github.com/stretchr/testify/assert.Fail({0x1bcdbc0, 0xc0001031e0}, {0xc00016a060, 0x27}, {0xc0003ff540, 0x1, 0x1})
        /go/pkg/mod/github.com/stretchr/[email protected]/assert/assertions.go:333 +0x350
github.com/stretchr/testify/assert.EqualValues({0x1bcdbc0, 0xc0001031e0}, {0x18d9740, 0x21a6da0}, {0x18d9740, 0x21a70c0}, {0xc0003ff540, 0x1, 0x1})
        /go/pkg/mod/github.com/stretchr/[email protected]/assert/assertions.go:538 +0x1e5
github.com/httprunner/httprunner/v4/hrp/internal/builtin.EqualValues({0x1bcdbc0, 0xc0001031e0}, {0x18d9740, 0x21a70c0}, {0x18d9740, 0x21a6da0}, {0x0?, 0x1927a40?, 0x18?})
        /github/workspace/hrp/internal/builtin/assertion.go:53 +0xa5
github.com/httprunner/httprunner/v4/hrp.(*responseObject).Validate(0xc000154c00, {0xc0002b2d80?, 0x1, 0x8?}, 0x1bcca00?)
        /github/workspace/hrp/response.go:198 +0x336
github.com/httprunner/httprunner/v4/hrp.runStepRequest(0xc00012b320, 0xc0003a8000)
        /github/workspace/hrp/step_request.go:431 +0xeec
github.com/httprunner/httprunner/v4/hrp.(*StepRequestWithOptionalArgs).Run(0xc0002aab60?, 0x1a69af9?)
        /github/workspace/hrp/step_request.go:881 +0x1c
github.com/httprunner/httprunner/v4/hrp.(*SessionRunner).Start(0xc00012b320, 0xc0002c46c0?)
        /github/workspace/hrp/runner.go:577 +0x97a
github.com/httprunner/httprunner/v4/hrp.(*HRPRunner).Run(0xc0002a0050, {0xc00011d510, 0x1, 0x1})
        /github/workspace/hrp/runner.go:247 +0x5a9
github.com/httprunner/httprunner/v4/hrp/cmd.glob..func7(0xc000163000?, {0xc00011d400?, 0x1, 0x1a5ec01?})
        /github/workspace/hrp/cmd/run.go:25 +0x14f
github.com/spf13/cobra.(*Command).execute(0x2217340, {0xc000034260, 0x1, 0x1})
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:872 +0x6aa
github.com/spf13/cobra.(*Command).ExecuteC(0x2216940)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:990 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:918
github.com/httprunner/httprunner/v4/hrp/cmd.Execute()
        /github/workspace/hrp/cmd/root.go:65 +0x13f
main.main()
        /github/workspace/hrp/cmd/cli/main.go:24 +0x30

## Versions

Please complete the following information:

- OS Type: [macOS Monterey, 12.4]
- Python version: [3.9]
- Go version: [1.19.4 darwin/amd64]
- HttpRunner version [ 4.3.6]
@soonsolidtest soonsolidtest added the pending pending for confirmation label Jan 12, 2024
@xgpjmss
Copy link

xgpjmss commented Feb 22, 2024

可以参考这个尝试解决。
#1712 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending pending for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants