-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Database hosts #241
Comments
I've also just run into this issue. I have three test classes operating on the same database table (i.e. seeding, inserting, and asserting data), and I've tried a dozen combinations of setUp/tearDown/setUpBeforeClass/tearDownAfterClass, to little success. As an example... <?php
namespace Tests\Browser;
use Facebook\WebDriver\WebDriverBy;
use Lmc\Steward\Test\AbstractTestCase;
use Shinka\Atoms\Constants;
use Shinka\Atoms\Tests\BrowserAddOnTestCase;
use Shinka\Atoms\Tests\TestCase;
class AtomsIndexTest extends AbstractTestCase
{
use TestCase, BrowserAddOnTestCase;
private const COUNT = 5;
/**
* Creates database tables.
*/
public static function setUpBeforeClass() : void
{
require_once __DIR__ . '/../bootstrap.php';
self::install();
}
/**
* Drops database tables.
*/
public static function tearDownAfterClass() : void
{
self::uninstall();
}
/**
* Seeds atoms table.
*/
public function setUp() : void
{
$this->seedAtoms(self::COUNT);
}
/**
* Truncates atoms table.
*/
public function tearDown() : void
{
$this->emptyTable(Constants::$table);
}
/**
* @test
*/
public function it_gets_index() : void
{
$this->wd->get('http://xen.test/admin.php?atoms/');
$this->login();
}
/**
* @test
* Fails because another testcase has also seeded and hasn't been torn down yet, so
* expected count is doubled
*/
public function it_lists_atoms() : void
{
$this->wd->get('http://xen.test/admin.php?atoms/');
$this->login();
$rows = $this->findMultipleByClass('dataList-row');
/** @todo figure out why table isn't emptying -- probably something to do with running in parallel */
$this->assertCount(self::COUNT, $rows);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our selenium tests are designed to run on an empty schema, with their own setup and tear down scripts (to ensure any data is reset in each run).
We have over 100 tests and 5000 assertions, when running in parallel, the tests cause unique constraints / failures in the DB when two tests use the same table.
Is it possible to pass through ENV variables to each node, to specify a separate DB hosts for each parallel stack.
Or even better, spread the parallel tests to a docker swarm?
The text was updated successfully, but these errors were encountered: