From 078f7fb20f8e7d6ae39628e9c6ead6d79a8214e9 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sat, 16 Oct 2021 17:48:59 +0800 Subject: [PATCH] change: ensure step name not empty --- step.go | 10 ++++++++-- validate.go | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/step.go b/step.go index 1dc959b2..c73e22ab 100644 --- a/step.go +++ b/step.go @@ -172,7 +172,10 @@ func (s *requestWithOptionalArgs) Extract() *stepRequestExtraction { } func (s *requestWithOptionalArgs) Name() string { - return s.step.Name + if s.step.Name != "" { + return s.step.Name + } + return fmt.Sprintf("%s %s", s.step.Request.Method, s.step.Request.URL) } func (s *requestWithOptionalArgs) Type() string { @@ -199,7 +202,10 @@ func (s *testcaseWithOptionalArgs) Export(names ...string) *testcaseWithOptional } func (s *testcaseWithOptionalArgs) Name() string { - return s.step.Name + if s.step.Name != "" { + return s.step.Name + } + return s.step.TestCase.Config.Name } func (s *testcaseWithOptionalArgs) Type() string { diff --git a/validate.go b/validate.go index d325fe22..abfa226f 100644 --- a/validate.go +++ b/validate.go @@ -10,7 +10,10 @@ type stepRequestValidation struct { } func (s *stepRequestValidation) Name() string { - return s.step.Name + if s.step.Name != "" { + return s.step.Name + } + return fmt.Sprintf("%s %s", s.step.Request.Method, s.step.Request.URL) } func (s *stepRequestValidation) Type() string {