B
B
BonBon Slick2018-09-09 23:11:40
Continuous Integration
BonBon Slick, 2018-09-09 23:11:40

How to properly set up Bitbucket Pipeline for CI especially Functional Tests?

I'm trying to set it up, I've read a bunch of guides, all functional tests are failing.
Used the example
https://confluence.atlassian.com/bitbucket/php-wit...
https://confluence.atlassian.com/bitbucket/laravel...

Time: 4.36 seconds, Memory: 8.00MB
There were 16 failures:
...
2) Tests\Functional\RegistrationTest::RegistrationPage_ValidUrl_PageDisplayed
Expected status code 500 but received 400.
Failed asserting that false is true.
/opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:78
/opt/atlassian/pipelines/agent/build/tests/Functional/RegistrationTest.php:37
3) Tests\Functional\UrlGetAvailabilityTest::WebsiteAvailability_ValidaUrls_SuccessfulResponse with data set #0 ('login')
Can not access url localhost/login
Failed asserting that false is true.
...

Here are the settings
image: php:7-fpm
pipelines:
  default:
  - step:
      script:
      - apt-get update && apt-get install -qy git php7.2-curl php7.2-gd libmcrypt-dev mysql-client zip unzip  php7.2-zip php7.2-gd php7-xmlwriter
      - yes | pecl install mcrypt-1.0.1
      - docker-php-ext-install pdo_mysql
      - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
      - composer install
      - php -r "file_exists('.env') || copy('.env.dist', '.env');"
      - php artisan key:generate
      - php artisan migrate:fresh --seed
      - php artisan serve &
      - sleep 5
      - ./vendor/bin/phpunit
      - curl -vk http://localhost:8000
      services:
      - mysql

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: 'homestead'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: 'homestead'
        MYSQL_PASSWORD: 'secret'

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         colors="true"
         bootstrap="./vendor/autoload.php"
         backupStaticAttributes="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutCoversAnnotation="true"
         beStrictAboutOutputDuringTests="true"
         verbose="true"
         beStrictAboutChangesToGlobalState="true"
         beStrictAboutTodoAnnotatedTests="true"
         stopOnError="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         stopOnRisky="false"
         processIsolation="true"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Functional">
            <directory suffix="Test.php">./tests/Functional</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>
</phpunit>

The usual Unit test works,
$this->assertTrue(true);
but this one doesn't.
$response = $this->get('/');
        $response->assertStatus(200);

https://community.atlassian.com/t5/Bitbucket-quest...
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question