Problems with codecept and wpbrowser tests
-
I am using WPBrowser (https://wpbrowser.wptestkit.dev/) to test the site I am working on. I have noticed that using SQLite Object Cache can cause my tests to fail*. This is probably as much related to the way that the WPBrowser testing system works as it is with your plugin (and so there may be little you can do about it), but whenever the plugin is installed and activated on my development site, then (as expected) there will be an
object-cache.php
and SQLite files in thewp-content
folder. Even when I tell my tests NOT to activate your plugin, those files still remain in the filesystem, and are therefore used by the testing framework – which leads to failing tests.My planned workarounds are:
- Manually deactivate your plugin in the wp-admin area before running my tests. Not ideal.
- Add some extra code to my testing set-up/start-up routine to delete the
object-cache.php
file before tests run. This is a bit of a hassle, and might cause me grief when I need to test how my system works with your caching plugin enabled.
Would you have any other suggestions on what I could do here? Is there some WP or SQLite Object Cache setting I can set in order to enable/disable object caching during testing?
*How does it cause my tests to fail? I’m not sure how this happens, but it looks like the cache gets loaded with some incorrect data (it looks like options data to me) at the start of the test run, which then gets repeatedly accessed from the cache rather than the database I am testing.
- The topic ‘Problems with codecept and wpbrowser tests’ is closed to new replies.