diff --git a/README.md b/README.md
index 19d82ec7..81654d25 100644
--- a/README.md
+++ b/README.md
@@ -313,4 +313,4 @@ func TestCaseDemo(t *testing.T) {
[examples]: https://github.com/httprunner/hrp/blob/main/examples/
[CHANGELOG]: docs/CHANGELOG.md
[pushgateway]: https://github.com/prometheus/pushgateway
-[survey]: https://wenjuan.feishu.cn/m?t=sVRvigY12Szi-gbbo
+[survey]: https://wj.qq.com/s2/9699514/0d19/
diff --git a/internal/report/template.html b/internal/report/template.html
index 978f2154..4bff6c65 100644
--- a/internal/report/template.html
+++ b/internal/report/template.html
@@ -235,6 +235,7 @@
×
Name: {{ .Name }}
+ {{- if .Data}}
Request:
-
+ {{- end }}
diff --git a/runner.go b/runner.go
index 836dfbd5..b3830d48 100644
--- a/runner.go
+++ b/runner.go
@@ -225,23 +225,25 @@ func (r *caseRunner) run() error {
r.startTime = time.Now()
for index := range r.TestCase.TestSteps {
- stepData, err := r.runStep(index, config)
- if err != nil {
- if r.hrpRunner.failfast {
- return errors.Wrap(err, "abort running due to failfast setting")
+ stepDataObj, err := r.runStep(index, config)
+ if stepDataObj == nil {
+ stepDataObj = &stepData{
+ Name: r.TestCase.TestSteps[index].Name(),
+ Success: false,
}
}
- if stepData != nil {
- if err != nil {
- stepData.Attachment = err.Error()
- }
- r.summary.Records = append(r.summary.Records, stepData)
- r.summary.Success = r.summary.Success && stepData.Success
- r.summary.Stat.Total += 1
- if stepData.Success {
- r.summary.Stat.Successes += 1
- } else {
- r.summary.Stat.Failures += 1
+ r.summary.Records = append(r.summary.Records, stepDataObj)
+ r.summary.Success = r.summary.Success && stepDataObj.Success
+ r.summary.Stat.Total += 1
+ if stepDataObj.Success {
+ r.summary.Stat.Successes += 1
+ } else {
+ r.summary.Stat.Failures += 1
+ }
+ if err != nil {
+ stepDataObj.Attachment = err.Error()
+ if r.hrpRunner.failfast {
+ return errors.Wrap(err, "abort running due to failfast setting")
}
}
}
@@ -602,6 +604,7 @@ func (r *caseRunner) runStepRequest(step *TStep) (stepResult *stepData, err erro
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
+ Close: true, // prevent the connection from being re-used
}
// prepare request headers
diff --git a/runner_test.go b/runner_test.go
index 4b79dfc0..2a7fce74 100644
--- a/runner_test.go
+++ b/runner_test.go
@@ -123,6 +123,19 @@ func TestInitRendezvous(t *testing.T) {
func TestGenHTMLReport(t *testing.T) {
summary := newOutSummary()
+ caseSummary1 := newSummary()
+ caseSummary2 := newSummary()
+ stepResult1 := &stepData{}
+ stepResult2 := &stepData{
+ Name: "Test",
+ StepType: stepTypeRequest,
+ Success: false,
+ ContentSize: 0,
+ Attachment: "err",
+ }
+ caseSummary1.Records = []*stepData{stepResult1, stepResult2, nil}
+ summary.appendCaseSummary(caseSummary1)
+ summary.appendCaseSummary(caseSummary2)
err := genHTMLReport(summary)
if err != nil {
t.Error(err)