Привет!
Пишу тесты для приложения на mojolicious.
$t->post_ok($url->path('/login/authorize') => form => {password => 'cdcdcd'})
->status_is(200)
->content_type_is('application/json')
->json_is({ error => 1, result => 'bad validation' });
$t->post_ok($url->path('/login/authorize') => form => {password => ''})
->status_is(200)
->content_type_is('application/json')
->json_is({ error => 1, result => 'no param' });
my $tt = $t->post_ok($url->path('/login/authorize') => form => {password => $TEST_USER})
->status_is(200)
->content_type_is('application/json')
->json_has('/result/redirect')
->json_has('/result/token')
->json_is('/error' => 0 );
Интересует вопрос, как реализовать тесты группами. ПО сути тут 3 теста, но на деле получается 14.
ok 1 - POST http://localhost.tk:80/login/authorize?json=
ok 2 - 200 OK
ok 3 - Content-Type: application/json
ok 4 - exact match for JSON Pointer ""
ok 5 - POST http://localhost.tk:80/login/authorize?json=
ok 6 - 200 OK
ok 7 - Content-Type: application/json
ok 8 - exact match for JSON Pointer ""
ok 9 - POST http://localhost:80/login/authorize?json=
ok 10 - 200 OK
ok 11 - Content-Type: application/json
ok 12 - has value for JSON Pointer "/result/redirect"
ok 13 - has value for JSON Pointer "/result/token"
ok 14 - exact match for JSON Pointer "/error"
1..14
Спасибо!