September 2017
Intermediate to advanced
244 pages
6h 44m
English
We can either write test cases in a structural approach or we can write it in class. Both ways are fine, I recommend class, so you can take advantage of your OOP concepts, if you want at some point. So let's create a file for that:
composer exec codecept generate:cest api CreatePost
This will create a class in tests/api/CreatePostCest.php with content similar to:
<?phpclass CreatePostCest{ public function _before(ApiTester $I) { } public function _after(ApiTester $I) { } // tests public function tryToTest(ApiTester $I) { }}
The _before() method is here so that you can write any code, which you want to execute before your test cases and the _after() method is there to execute after your test cases. The next method ...
Read now
Unlock full access