diff --git a/README.md b/README.md index d2165e48..ce491e83 100644 --- a/README.md +++ b/README.md @@ -504,6 +504,54 @@ testcases: ``` +# FAQ + +## Common errors with quotes + +If you have this kind of error: + +``` +err:unable to parse file "foo.yaml": error converting YAML to JSON: yaml: line 8: did not find expected key +``` + +this is probably because you try to use a json value instead of a string. You should have more details in venom.log file. + +Wrong: + +```yml +... +vars: + body: >- + { + "the-attribute": "the-value" + } +... +steps: +- type: http + body: "{{.body}}" +... +``` + +OK: + + +```yml +... +vars: + body: >- + { + "the-attribute": "the-value" + } +... +steps: +- type: http + body: '{{.body}}' +... +``` + +Note the simple quote on the value of `body`. + + # Use venom in CI Venom can be use on dev environement or your CI server. diff --git a/venom.go b/venom.go index e7253875..7696d765 100644 --- a/venom.go +++ b/venom.go @@ -221,7 +221,7 @@ func (v *Venom) registerUserExecutors(ctx context.Context, name string, ts TestS ux := UserExecutor{Filename: f} if err := yaml.Unmarshal([]byte(content), &ux); err != nil { - return errors.Wrapf(err, "unable to parse file %q", f) + return errors.Wrapf(err, "unable to parse file %q with content %v", f, content) } for k, vr := range varsComputed {