Open karenetheridge opened 1 year ago
in the harness that makes use of this test format, run the tests twice, as we do now - once parsing into HTTP::Request/Response objects, and the other parsing into Mojo::Message::Request/Response objects. Perform any doctoring of the HTTP::Request/Response objects as needed (set missing protocol?)
consider outputting the tests in yaml rather than json, for readability - I think yaml supports a "heredoc" operator?
use this as a guide: https://yaml-multiline.info/
I think I want to use request: |-8
to include the serialized request with indentation (for readability) that will be removed.
$; perl -MYAML=Load -MData::Dumper -wle'print Dumper(Load("---\nhello: foo\nbloop: |-\n mary had a little lamb\n its fleece as white as snow\n\n"))'
$VAR1 = {
'bloop' => 'mary had a little lamb
its fleece as white as snow',
'hello' => 'foo'
};
The $UseBlock option in YAML can do this:
perl -MYAML=Dump -MData::Dumper -wle'$YAML::UseBlock = 1; print Dump({hello=>"foo",bar=>{bloop=>"foo\nbar\n\nblah"}})'
---
bar:
bloop: |-
foo
bar
blah
hello: foo
We can autogenerate this by creating a harness which does some method modifications and then calls do ./t/validate_request.t
:
request()
sub to dump the serialized request for the individual test case,and then when execution is complete, dump the yaml version of the tests.
and then we'll need to write a harness which knows how to read in the test cases and executes them, just as we do via Test::JSON::Schema::Acceptance. If this data format catches on we can publish the harness, and test cases, in Test::OpenAPI::Acceptance.
kinda duped by #77
This is modelled after the pattern used in JSON-Schema-Test-Suite.
each test group consists of:
And of course we should provide a JSON Schema describing this test structure.
Convert all existing request and response tests to this format. If all details from the test are preserved, we can delete the originals.