I want to execute different dump file for different codeception tests. Right now Db dump file is being executed from shell_exec
command in _before
method of AcceptanceHelper
, that executes before each and every acceptance test. Something like suggested here. There are alot of tests in the app. So, the flow is as follows
- tests/acceptance/application/<contains alot of tests related to application>
- tests/acceptance/location/<contains alot of tests related to location>
Both test directories /application/
and /location/
uses same AcceptanceHelper
. So, what i want is a different executable dump file for all of the tests inside /application/
directory than that of /location/
tests.
Think of something like Get current running test name. Let's say application_dump.sql
for all tests inside /application/
directory and location_dump.sql
for all tests inside /location/
directory.
P.S: Using a different suite for application and location is ideally not what i am looking for.
Just to help some one out there. As there was no proper way to achieve this as Get current running test name seems to be still in development.
So, this is how i managed to solve the issue. I have moved shell_exec
commands out of _before
method of AcceptanceHelper
and created a new public method inside AcceptanceHelper
which can be accessed via actor class $I
in each and every acceptance test like so
$I->executeDbDump('application_dump.sql');
$I->executeDbDump('location_dump.sql');
Only drawback using this approach is i have to execute respective executeDbDump
function before each and every test manually. But still seems to be best approach for the issue now.