This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
API functional tests coverage
Valeriy Naida edited this page Dec 19, 2018
·
20 revisions
Pay attention:
-
xdebux
must be installed -
{MagentoInstanceDirectory}/var/coverage
and{MagentoInstanceDirectory}/var/coverage/reports
should be created manually
- Modify
/pub/index.php
of a tested instance
<?php
/**
* Public alias for the application entry point
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\Filesystem\DirectoryList;
try {
require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
Autoload error</h3>
</div>
<p>{$e->getMessage()}</p>
</div>
HTML;
exit(1);
}
$coverage = new \SebastianBergmann\CodeCoverage\CodeCoverage;
$coverage->filter()->addDirectoryToWhitelist('../app/code/Magento/*GraphQl');
$id = md5(mt_rand());
$coverage->start($id);
$params = $_SERVER;
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = array_replace_recursive(
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] ?? [],
[
DirectoryList::PUB => [DirectoryList::URL_PATH => ''],
DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'],
DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'],
DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload'],
]
);
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);
$coverage->stop();
$writer = new \SebastianBergmann\CodeCoverage\Report\PHP();
$writer->process($coverage, '../var/coverage/reports/' . $id . '.cov');
-
Run tests on a local machine. Should be run only tests from
dev/tests/api-functional/testsuite/Magento/GraphQl/*
. As result will be generated coverage reports in '../var/coverage/reports/*' for each requests. -
Run
php phpcov.phar merge ./reports --html=./html
for merging all of reports in one in HTML format
- Roadmap
- ZenHub task board (requires GitHub sign-in)
- Weekly calls:
- Thursday, 15:00 UTC
- Video conference link - https://bluejeans.com/180764326
- Recordings - https://goo.gl/5Q7QAw
- Slack: #graphql (Use http://tinyurl.com/engcom-slack to register)