ci: run tests in parallel (#2515)

This commit is contained in:
Alexis Saettler
2019-03-12 23:13:16 +01:00
committed by GitHub
parent 9855544c3e
commit ecc1e2cb33
14 changed files with 57 additions and 72 deletions
+7 -5
View File
@@ -74,7 +74,8 @@ aliases:
name: Run unit tests
command: |
php artisan route:cache
phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/junit/unit/results.xml --coverage-clover ./results/coverage.xml
TESTSUITE=$(echo -e "Api-and-Feature\nUnit" | circleci tests split)
phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/junit/unit/results${CIRCLE_NODE_INDEX}.xml --coverage-clover ./results/coverage${CIRCLE_NODE_INDEX}.xml --testsuite $TESTSUITE
- &psalm
run:
name: Run psalm
@@ -86,7 +87,7 @@ aliases:
- &browser-tests
run:
name: Run browser tests
command: php artisan dusk --log-junit results/junit/dusk/results.xml
command: php artisan dusk --log-junit results/junit/dusk/results3.xml
- &browser-cypress
run:
name: Run browser tests (cypress)
@@ -97,13 +98,13 @@ aliases:
run:
name: Fix coverage
command: |
vendor/bin/phpcov merge --clover=results/coverage2.xml results/coverage/
vendor/bin/phpcov merge --clover=results/coverage3.xml results/coverage/
rm -rf results/coverage
- &fix-coverage2
run:
name: Fix coverage
command: |
vendor/bin/phpcov merge --clover=results/coverage3.xml results/coverage/
vendor/bin/phpcov merge --clover=results/coverage4.xml results/coverage/
rm -rf results/coverage
- &selenium
run:
@@ -208,6 +209,7 @@ jobs:
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: ''
parallelism: 2
steps:
- checkout:
@@ -344,7 +346,7 @@ jobs:
name: Run sonar scanner
command: |
export SONAR_RESULT=./results/results.xml
export SONAR_COVERAGE=./results/coverage.xml,./results/coverage2.xml,./results/coverage3.xml
export SONAR_COVERAGE=$(ls -m ./results/coverage*.xml | sed 's/ //g' | sed ':a;N;$!ba;s/\n//g')
scripts/tests/runsonar.sh
- save_cache:
Binary file not shown.
+4 -10
View File
@@ -9,20 +9,14 @@
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Api Tests">
<testsuite name="Api-and-Feature">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
<testsuite name="Commands Tests">
<directory suffix="Test.php">./tests/Commands</directory>
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Feature Tests">
<directory suffix="Test.php">./tests/Feature</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
@@ -1,6 +1,6 @@
<?php
namespace Tests\Api\Auth;
namespace Tests\Browser\Auth;
use Tests\ApiTestCase;
use App\Models\User\User;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Unit\Commands;
namespace Tests\Commands;
use Tests\TestCase;
use Illuminate\Database\QueryException;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Unit\Commands;
namespace Tests\Commands;
use Mockery as m;
use Tests\TestCase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Unit\Jobs;
namespace Tests\Jobs;
use Carbon\Carbon;
use Tests\TestCase;
@@ -1,6 +1,6 @@
<?php
namespace Tests\Unit\Jobs;
namespace Tests\Jobs;
use Carbon\Carbon;
use Tests\TestCase;
@@ -1,12 +1,12 @@
<?php
namespace Tests\Unit\Controllers;
namespace Tests\Feature;
use Tests\FeatureTestCase;
use App\Models\Account\ActivityTypeCategory;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ActivityTypeCategoriesControllerTest extends FeatureTestCase
class ActivityTypeCategoriesTest extends FeatureTestCase
{
use DatabaseTransactions;
@@ -1,13 +1,13 @@
<?php
namespace Tests\Unit\Controllers;
namespace Tests\Feature;
use Tests\FeatureTestCase;
use App\Models\Account\ActivityType;
use App\Models\Account\ActivityTypeCategory;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ActivityTypesControllerTest extends FeatureTestCase
class ActivityTypesTest extends FeatureTestCase
{
use DatabaseTransactions;
@@ -1,13 +1,13 @@
<?php
namespace Tests\Unit\Controllers\Contact;
namespace Tests\Feature;
use Tests\FeatureTestCase;
use App\Models\Contact\Call;
use App\Models\Contact\Contact;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class CallsControllerTest extends FeatureTestCase
class CallsTest extends FeatureTestCase
{
use DatabaseTransactions;
@@ -1,13 +1,13 @@
<?php
namespace Tests\Unit\Controllers;
namespace Tests\Feature;
use Tests\FeatureTestCase;
use App\Models\Contact\Contact;
use App\Models\Contact\Document;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class DocumentsControllerTest extends FeatureTestCase
class DocumentsTest extends FeatureTestCase
{
use DatabaseTransactions;
+33
View File
@@ -76,4 +76,37 @@ class SettingsTest extends FeatureTestCase
$response->assertSee('Login');
}
public function test_it_updates_the_default_profile_view()
{
$user = $this->signin();
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'life-events',
]);
$response->assertStatus(200);
$this->assertDatabaseHas('users', [
'profile_active_tab' => 'life-events',
'id' => $user->id,
]);
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'notes',
]);
$response->assertStatus(200);
$this->assertDatabaseHas('users', [
'profile_active_tab' => 'notes',
'id' => $user->id,
]);
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'nawak',
]);
$response->assertStatus(200);
}
}
@@ -1,44 +0,0 @@
<?php
namespace Tests\Unit\Controllers;
use Tests\FeatureTestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class SettingsControllerTest extends FeatureTestCase
{
use DatabaseTransactions;
public function test_it_updates_the_default_profile_view()
{
$user = $this->signin();
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'life-events',
]);
$response->assertStatus(200);
$this->assertDatabaseHas('users', [
'profile_active_tab' => 'life-events',
'id' => $user->id,
]);
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'notes',
]);
$response->assertStatus(200);
$this->assertDatabaseHas('users', [
'profile_active_tab' => 'notes',
'id' => $user->id,
]);
$response = $this->json('POST', '/settings/updateDefaultProfileView', [
'name' => 'nawak',
]);
$response->assertStatus(200);
}
}