Functional Tests Improvements (#5095)

* Rely on laravel transactions instead of refreshing the database dump between functional test runs.  Cuts functional test runtime by 75%.  Also use mysql to seed directly.

* Split functional tests into two groups on travis to reduce overall memory usage.  Any new tests will need to be added to one of these two files before they are run on travis.  running all functional tests simultaneously still works locally.

* Fix name of test in group.
This commit is contained in:
Daniel Meltzer 2018-02-24 15:03:33 -05:00 committed by snipe
parent 0e48837eec
commit d54dda40d3
7 changed files with 26 additions and 6 deletions

View file

@ -51,8 +51,8 @@ before_script:
script:
- ./vendor/bin/codecept run unit
# - ./vendor/bin/codecept run acceptance --env=testing-ci
- ./vendor/bin/codecept run functional --env=functional-travis
#script: ./vendor/bin/codecept run
- ./vendor/bin/codecept run functional --env=functional-travis -g func1
- ./vendor/bin/codecept run functional --env=functional-travis -g func2
- ./vendor/bin/codecept run api --env=functional-travis
after_script:

View file

@ -8,4 +8,5 @@ modules:
Db:
dsn: 'mysql:host=localhost;dbname=snipeit_unit'
user: 'travis'
password: ''
password: ''
populator: 'mysql -u travis snipeit_unit < tests/_data/dump.sql'

View file

@ -18,6 +18,10 @@ modules:
password: ''
dump: tests/_data/dump.sql
populate: true
cleanup: true
populator: 'mysql -u snipeit_laravel snipeittests < tests/_data/dump.sql'
cleanup: false
- REST:
depends: Laravel5
groups:
func1: tests/functional/func-part-1.txt
func2: tests/functional/func-part-2.txt

View file

@ -58,7 +58,7 @@ class CategoriesCest
{
$I->wantTo('Ensure I can delete a category');
$category = factory(App\Models\Category::class)->states('asset-laptop-category')->create([
'name'=>"Test Category"
'name'=>"Deletable Test Category"
]);
$I->sendDelete(route('categories.destroy', $category->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);

View file

@ -59,7 +59,7 @@ class ManufacturersCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a manufacturer');
$manufacturerId = factory(App\Models\Manufacturer::class)->states('microsoft')->create(['name' => "Test Manufacturer"])->id;
$manufacturerId = factory(App\Models\Manufacturer::class)->states('microsoft')->create(['name' => "Deletable Test Manufacturer"])->id;
$I->sendDelete(route('manufacturers.destroy', $manufacturerId), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}

View file

@ -0,0 +1,8 @@
tests/functional/AccessoriesCest.php
tests/functional/AssetModelsCest.php
tests/functional/AssetsCest.php
tests/functional/CategoriesCest.php
tests/functional/CompaniesCest.php
tests/functional/ComponentsCest.php
tests/functional/ConsumablesCest.php
tests/functional/DepreciationsCest.php

View file

@ -0,0 +1,7 @@
tests/functional/GroupsCest.php
tests/functional/LicensesCest.php
tests/functional/LocationsCest.php
tests/functional/ManufacturersCest.php
tests/functional/StatusLabelsCest.php
tests/functional/SuppliersCest.php
tests/functional/UsersCest.php