N
N
nepster-web2015-08-15 20:31:23
PHP
nepster-web, 2015-08-15 20:31:23

Codeception one file one test?

Began acquaintance with testing (through codeception).
I use the REST API, and in the best TDD methods, I write the test first, then the implementation.
I have a controller, it should have several methods. I wrote a test and an implementation of one method.
The test turned out to be redundant, but I can afford it:

<?php
$I = new ApiTester($scenario);
$I->sendGET('category/children');
$I->seeResponseCodeIs(200);
$I->haveHttpHeader('Content-Type','application/json');
$I->seeResponseIsJson();
//$I->seeResponseContains('"status":1');
$I->seeResponseContainsJson(['status' => 1]);

Now it would not be bad to write 2 tests and a second method, and so the question is, create your own file for each test, even if this test can fit in 5 lines?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-08-15
@nepster-web

you can fit all the tests in one file, it's up to you.
I make a file for the test because it's easier for me to manage them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question