diff options
-rw-r--r-- | non-puppet/qtmetrics2/index.php | 45 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/scripts/ajax.js | 15 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/Database.php | 62 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/Factory.php | 38 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/Testfunction.php | 49 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/test/DatabaseTest.php | 57 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/test/FactoryTest.php | 13 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/src/test/TestfunctionTest.php | 72 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/templates/about.html | 4 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/templates/home.html | 7 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/templates/testfunctions_bpass.html | 112 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/templates/testfunctions_bpass_data.html | 194 | ||||
-rw-r--r-- | non-puppet/qtmetrics2/templates/testset_testfunctions.html | 25 |
13 files changed, 636 insertions, 57 deletions
diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php index 76465d4..9726ec4 100644 --- a/non-puppet/qtmetrics2/index.php +++ b/non-puppet/qtmetrics2/index.php @@ -34,7 +34,7 @@ /** * Qt Metrics API - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -73,6 +73,7 @@ $app->get('/', function() use($app) 'topRoute' => Slim\Slim::getInstance()->urlFor('top'), 'flakyRoute' => Slim\Slim::getInstance()->urlFor('flaky'), 'topTestfunctionsRoute' => Slim\Slim::getInstance()->urlFor('toptestfunctions'), + 'bpassedTestfunctionsRoute' => Slim\Slim::getInstance()->urlFor('bpassedtestfunctions'), 'masterProject' => $ini['master_build_project'], 'masterState' => $ini['master_build_state'], 'branches' => Factory::db()->getBranches(), @@ -473,6 +474,48 @@ $app->get('/data/test/toptestfunctions', function() use($app) 'lastDays' => $ini['top_failures_last_days'], 'sinceDate' => $since, 'testfunctions' => Factory::createTestfunctions( + Factory::LIST_FAILURES, + $ini['master_build_project'], + $ini['master_build_state']) // managed as objects + )); +}); + +/** + * UI route: /test/bpassedtestfunctions (GET) + */ + +$app->get('/test/bpassedtestfunctions', function() use($app) +{ + $ini = Factory::conf(); + $dbStatus = Factory::db()->getDbRefreshStatus(); + $days = intval($ini['blacklisted_pass_last_days']) - 1; + $since = Factory::getSinceDate($days); + $breadcrumb = array( + array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) + ); + $app->render('testfunctions_bpass.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), + 'dbStatus' => $dbStatus, + 'refreshed' => $dbStatus['refreshed'] . ' (GMT)', + 'breadcrumb' => $breadcrumb, + 'lastDays' => $ini['blacklisted_pass_last_days'], + 'sinceDate' => $since, + 'masterProject' => $ini['master_build_project'], + 'masterState' => $ini['master_build_state'] + )); +})->name('bpassedtestfunctions'); + +$app->get('/data/test/bpassedtestfunctions', function() use($app) +{ + $ini = Factory::conf(); + $days = intval($ini['blacklisted_pass_last_days']) - 1; + $since = Factory::getSinceDate($days); + $app->render('testfunctions_bpass_data.html', array( + 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset', + 'lastDays' => $ini['blacklisted_pass_last_days'], + 'sinceDate' => $since, + 'testfunctions' => Factory::createTestfunctions( + Factory::LIST_BPASSES, $ini['master_build_project'], $ini['master_build_state']) // managed as objects )); diff --git a/non-puppet/qtmetrics2/scripts/ajax.js b/non-puppet/qtmetrics2/scripts/ajax.js index db12ac5..1f75dfa 100644 --- a/non-puppet/qtmetrics2/scripts/ajax.js +++ b/non-puppet/qtmetrics2/scripts/ajax.js @@ -34,7 +34,7 @@ /** * Ajax route calls - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -113,4 +113,17 @@ $(function () { }); } + // Blacklisted passed testfunctions + if ($.inArray('testfunctions_blacklisted_passed_data', divs) > -1) { + $.ajax({ + url: "data/test/bpassedtestfunctions", + dataType: "html", + cache: true + }) + .done(function( html ) { + console.log(this.url + " done"); + $('#testfunctions_blacklisted_passed_data').html(html); + }); + } + }); diff --git a/non-puppet/qtmetrics2/src/Database.php b/non-puppet/qtmetrics2/src/Database.php index 5b76d7e..a7d5aff 100644 --- a/non-puppet/qtmetrics2/src/Database.php +++ b/non-puppet/qtmetrics2/src/Database.php @@ -34,7 +34,7 @@ /** * Database class - * @since 20-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -815,6 +815,62 @@ class Database { } /** + * Get counts of blacklisted passed testfunctions in specified builds since specified date + * Only the testfunctions that are blacklisted, are only passed and have been run since the specified date are listed + * @param string $runProject + * @param string $runState + * @param string $date + * @return array (string name, string testset, string project, string conf, int bpassed, int btotal) + */ + public function getTestfunctionsBlacklistedPassedCounts($runProject, $runState, $date) + { + $result = array(); + $query = $this->db->prepare(" + SELECT + testfunction.name AS testfunction, + testset.name AS testset, + project.name AS project, + conf.name AS conf, + COUNT(CASE WHEN testfunction_run.result IN ('bpass', 'bxfail') THEN testfunction_run.result END) AS bpassed, + COUNT(CASE WHEN testfunction_run.result LIKE '%' THEN testfunction_run.result END) AS btotal + FROM testfunction_run + INNER JOIN testfunction ON testfunction_run.testfunction_id = testfunction.id + INNER JOIN testset_run ON testfunction_run.testset_run_id = testset_run.id + INNER JOIN testset ON testset_run.testset_id = testset.id + INNER JOIN project ON testset.project_id = project.id + INNER JOIN conf_run ON testset_run.conf_run_id = conf_run.id + INNER JOIN conf ON conf_run.conf_id = conf.id + INNER JOIN project_run ON conf_run.project_run_id = project_run.id + INNER JOIN branch ON project_run.branch_id = branch.id + INNER JOIN state ON project_run.state_id = state.id + WHERE + project_run.project_id = (SELECT id FROM project WHERE name = ?) AND + project_run.state_id = (SELECT id FROM state WHERE name = ?) AND + project_run.timestamp >= ? AND + branch.archived = 0 + GROUP BY testfunction.name, testset.name, project.name, conf.name + ORDER BY project.name, testset.name, testfunction.name, conf.name; + "); + $query->bindParam(1, $runProject); + $query->bindParam(2, $runState); + $query->bindParam(3, $date); + $query->execute(); + while($row = $query->fetch(PDO::FETCH_ASSOC)) { + if ($row['bpassed'] === $row['btotal']) { // return only those where only bpasses + $result[] = array( + 'name' => $row['testfunction'], + 'testset' => $row['testset'], + 'project' => $row['project'], + 'conf' => $row['conf'], + 'bpassed' => $row['bpassed'], + 'btotal' => $row['btotal'] + ); + } + } + return $result; + } + + /** * Get project run data by branch * @param string $runProject * @param string $runState @@ -1225,7 +1281,7 @@ class Database { /** * Get results for failed and skipped testfunctions in specified configuration builds and project by branch - * Only the fail/skip and xpass/xfail results are listed + * Only the fail/skip and xpass/xfail and bpass results are listed * @param string $testset * @param string $testsetProject * @param string $conf @@ -1254,7 +1310,7 @@ class Database { INNER JOIN project_run ON conf_run.project_run_id = project_run.id INNER JOIN branch ON project_run.branch_id = branch.id WHERE - (testfunction_run.result LIKE '%fail' OR testfunction_run.result LIKE '%skip' OR testfunction_run.result LIKE '%x%') AND + (testfunction_run.result LIKE '%fail' OR testfunction_run.result LIKE '%skip' OR testfunction_run.result LIKE '%x%' OR testfunction_run.result LIKE 'b%') AND testset.name = ? AND project.name = ? AND conf.name = ? AND diff --git a/non-puppet/qtmetrics2/src/Factory.php b/non-puppet/qtmetrics2/src/Factory.php index 34c8655..bb4e7c5 100644 --- a/non-puppet/qtmetrics2/src/Factory.php +++ b/non-puppet/qtmetrics2/src/Factory.php @@ -34,7 +34,7 @@ /** * Factory class - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -57,6 +57,7 @@ class Factory { */ const LIST_FAILURES = 1; const LIST_FLAKY = 2; + const LIST_BPASSES = 3; /** * Configuration settings as specified in the ini file. @@ -280,24 +281,39 @@ class Factory { } /** - * Create Testfunction objects for those in database + * Create Testfunction objects for those in database (with either failed or bpassed counts) * List is limited by date (since) and length, and for specified builds only + * @param int $listType * @param string $runProject * @param string $runState * @return array Testfunction objects */ - public static function createTestfunctions($runProject, $runState) + public static function createTestfunctions($listType, $runProject, $runState) { $objects = array(); $ini = self::conf(); - $days = intval($ini['top_failures_last_days']) - 1; - $since = self::getSinceDate($days); - $limit = intval($ini['top_failures_n']); - $dbEntries = self::db()->getTestfunctionsResultCounts($runProject, $runState, $since, $limit); - foreach($dbEntries as $entry) { - $obj = new Testfunction($entry['name'], $entry['testset'], $entry['project']); - $obj->setResultCounts($entry['passed'], $entry['failed'], $entry['skipped']); - $objects[] = $obj; + // Failure result list (from specified builds only) + if ($listType === self::LIST_FAILURES) { + $days = intval($ini['top_failures_last_days']) - 1; + $since = self::getSinceDate($days); + $limit = intval($ini['top_failures_n']); + $dbEntries = self::db()->getTestfunctionsResultCounts($runProject, $runState, $since, $limit); + foreach($dbEntries as $entry) { + $obj = new Testfunction($entry['name'], $entry['testset'], $entry['project'], null); + $obj->setResultCounts($entry['passed'], $entry['failed'], $entry['skipped']); + $objects[] = $obj; + } + } + // Blacklisted passed list (from specified builds only) + if ($listType === self::LIST_BPASSES) { + $days = intval($ini['blacklisted_pass_last_days']) - 1; + $since = self::getSinceDate($days); + $dbEntries = self::db()->getTestfunctionsBlacklistedPassedCounts($runProject, $runState, $since); + foreach($dbEntries as $entry) { + $obj = new Testfunction($entry['name'], $entry['testset'], $entry['project'], $entry['conf']); + $obj->setBlacklistedCounts($entry['bpassed'], $entry['btotal']); + $objects[] = $obj; + } } return $objects; } diff --git a/non-puppet/qtmetrics2/src/Testfunction.php b/non-puppet/qtmetrics2/src/Testfunction.php index 696e938..8dc167b 100644 --- a/non-puppet/qtmetrics2/src/Testfunction.php +++ b/non-puppet/qtmetrics2/src/Testfunction.php @@ -34,7 +34,7 @@ /** * Test function class - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -52,7 +52,7 @@ class Testfunction { private $name; /** - * testset name the testfunction belongs to. + * Testset name the testfunction belongs to. * @var string */ private $testsetName; @@ -64,23 +64,37 @@ class Testfunction { private $testsetProjectName; /** + * Configuration name. + * @var string + */ + private $confName; + + /** * Count of testfunction results in the Project builds run since the last n days (all configurations). * @var array (int passed, int failed, int skipped) */ private $resultCounts; /** + * Count of testfunction blacklisted results in the Project builds run since the last n days (all configurations). + * @var array (int bpassed, int btotal) + */ + private $blacklistedCounts; + + /** * Testfunction constructor. * @param string $name * @param string $testsetName * @param string $testsetProjectName */ - public function __construct($name, $testsetName, $testsetProjectName) + public function __construct($name, $testsetName, $testsetProjectName, $confName) { $this->name = $name; $this->testsetName = $testsetName; $this->testsetProjectName = $testsetProjectName; + $this->confName = $confName; $this->resultCounts = array('passed' => null, 'failed' => null, 'skipped' => null); // not initially set + $this->blacklistedCounts = array('bpassed' => null, 'btotal' => null); // not initially set } /** @@ -123,6 +137,15 @@ class Testfunction { } /** + * Get conf name. + * @return string + */ + public function getConfName() + { + return $this->confName; + } + + /** * Get count of testfunction results in latest Project builds (all configurations, specified builds only). * @return array (int passed, int failed, int skipped) */ @@ -132,7 +155,7 @@ class Testfunction { } /** - * Set count of testset results in latest Project builds (all configurations, specified builds only). + * Set count of testfunction results in latest Project builds (all configurations, specified builds only). */ public function setResultCounts($passed, $failed, $skipped) { @@ -140,6 +163,24 @@ class Testfunction { return; } + /** + * Get count of testfunction blacklisted results in latest Project builds (all configurations, specified builds only). + * @return array (int bpassed, int btotal) + */ + public function getBlacklistedCounts() + { + return $this->blacklistedCounts; + } + + /** + * Set count of testfunction blacklisted results in latest Project builds (all configurations, specified builds only). + */ + public function setBlacklistedCounts($bpassed, $btotal) + { + $this->blacklistedCounts = array('bpassed' => $bpassed, 'btotal' => $btotal); + return; + } + } ?> diff --git a/non-puppet/qtmetrics2/src/test/DatabaseTest.php b/non-puppet/qtmetrics2/src/test/DatabaseTest.php index 9feb61c..74e5cfa 100644 --- a/non-puppet/qtmetrics2/src/test/DatabaseTest.php +++ b/non-puppet/qtmetrics2/src/test/DatabaseTest.php @@ -38,7 +38,7 @@ require_once(__DIR__.'/../Factory.php'); * Database unit test class * Some of the tests require the test data as inserted into database with qtmetrics_insert.sql * @example To run (in qtmetrics root directory): php <path-to-phpunit>/phpunit.phar ./src/test - * @since 20-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -639,6 +639,45 @@ class DatabaseTest extends PHPUnit_Framework_TestCase } /** + * Test getTestfunctionsBlacklistedPassedCounts + * @dataProvider testGetTestfunctionsBlacklistedPassedCountsData + */ + public function testGetTestfunctionsBlacklistedPassedCounts($runProject, $runState, $date, $exp_testfunction, $exp_excluded_testfunction, $exp_testfunction_count_min, $exp_bpassed_min) + { + $testfunctions = array(); + $bpassed = 0; + $db = Factory::db(); + $result = $db->getTestfunctionsBlacklistedPassedCounts($runProject, $runState, $date); + foreach($result as $row) { + $this->assertArrayHasKey('name', $row); + $this->assertArrayHasKey('testset', $row); + $this->assertArrayHasKey('project', $row); + $this->assertArrayHasKey('conf', $row); + $this->assertArrayHasKey('bpassed', $row); + $this->assertArrayHasKey('btotal', $row); + $this->assertEquals($row['btotal'], $row['bpassed']); + $testfunctions[] = $row['name']; + $bpassed += $row['bpassed']; + } + $this->assertGreaterThanOrEqual($exp_testfunction_count_min, count($testfunctions)); + if ($exp_testfunction_count_min > 0) { + $this->assertNotEmpty($result); + $this->assertContains($exp_testfunction, $testfunctions); + $this->assertNotContains($exp_excluded_testfunction, $testfunctions); + $this->assertGreaterThanOrEqual($exp_bpassed_min, $bpassed); + } + } + public function testGetTestfunctionsBlacklistedPassedCountsData() + { + return array( + array('Qt5', 'state', '2013-05-01', 'lastResortFont', 'resetFont', 1, 1), // in test data lastResortFont has bpassed and resetFont doesn't + array('Qt5', 'state', '2013-05-01', 'lastResortFont', 'styleName', 1, 1), // in test data lastResortFont has bpassed and styleName has bskipped as well + array('Qt5', 'state', '2013-05-29', '', '', 0, 0), + array('Qt5', 'state', '2999-05-29', '', '', 0, 0) + ); + } + + /** * Test getProjectBuildsByBranch * @dataProvider testGetProjectBuildsByBranchData */ @@ -1036,9 +1075,10 @@ class DatabaseTest extends PHPUnit_Framework_TestCase * Test getTestfunctionConfResultsByBranch * @dataProvider testGetTestfunctionConfResultsByBranchData */ - public function testGetTestfunctionConfResultsByBranch($testset, $testsetProject, $conf, $runProject, $runState, $exp_branch, $exp_testfunction, $exp_key, $has_data) + public function testGetTestfunctionConfResultsByBranch($testset, $testsetProject, $conf, $runProject, $runState, $exp_branch, $exp_testfunction, $exp_result, $exp_key, $has_data) { $branches = array(); + $results = array(); $keys = array(); $testfunctions = array(); $db = Factory::db(); @@ -1051,12 +1091,14 @@ class DatabaseTest extends PHPUnit_Framework_TestCase $this->assertArrayHasKey('timestamp', $row); $this->assertArrayHasKey('duration', $row); $branches[] = $row['branch']; + $results[] = $row['result']; $keys[] = $row['buildKey']; $testfunctions[] = $row['testfunction']; } if ($has_data) { $this->assertNotEmpty($result); $this->assertContains($exp_branch, $branches); + $this->assertContains($exp_result, $results); $this->assertContains($exp_key, $keys); $this->assertContains($exp_testfunction, $testfunctions); } else { @@ -1066,11 +1108,12 @@ class DatabaseTest extends PHPUnit_Framework_TestCase public function testGetTestfunctionConfResultsByBranchData() { return array( - array('tst_qfont', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'exactMatch', '1348', 1), // fail - array('tst_qfont', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'lastResortFont', '1348', 1), // skip - array('tst_networkselftest', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'smbServer', '1348', 1), // skip - array('tst_qftp', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', '', '', '', 0), // no fail or skip - array('tst_qfont', 'qtbase', 'invalid', 'Qt5', 'state', '', '', '', 0) + array('tst_qfont', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'exactMatch', 'fail', '1348', 1), + array('tst_qfont', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'lastResortFont', 'skip', '1348', 1), + array('tst_qfont', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'lastResortFont', 'bpass', '1346', 1), + array('tst_networkselftest', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', 'stable', 'smbServer', 'skip', '1348', 1), + array('tst_qftp', 'qtbase', 'macx-clang_developer-build_OSX_10.8', 'Qt5', 'state', '', '', '', '', 0), // no fail or skip + array('tst_qfont', 'qtbase', 'invalid', 'Qt5', 'state', '', '', '', '', 0) ); } diff --git a/non-puppet/qtmetrics2/src/test/FactoryTest.php b/non-puppet/qtmetrics2/src/test/FactoryTest.php index a84315b..78408a5 100644 --- a/non-puppet/qtmetrics2/src/test/FactoryTest.php +++ b/non-puppet/qtmetrics2/src/test/FactoryTest.php @@ -37,7 +37,7 @@ require_once(__DIR__.'/../Factory.php'); /** * Factory unit test class * @example To run (in qtmetrics root directory): php <path-to-phpunit>/phpunit.phar ./src/test - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -285,9 +285,9 @@ class FactoryTest extends PHPUnit_Framework_TestCase * Test createTestfunctions * @dataProvider testCreateTestfunctionsData */ - public function testCreateTestfunctions($runProject, $runState) + public function testCreateTestfunctions($listType, $runProject, $runState) { - $testfunctions = Factory::createTestfunctions($runProject, $runState); + $testfunctions = Factory::createTestfunctions($listType, $runProject, $runState); foreach($testfunctions as $testfunction) { $this->assertTrue($testfunction instanceof Testfunction); $result = $testfunction->getResultCounts(); @@ -295,12 +295,17 @@ class FactoryTest extends PHPUnit_Framework_TestCase $this->assertArrayHasKey('passed', $result); $this->assertArrayHasKey('failed', $result); $this->assertArrayHasKey('skipped', $result); + $blacklisted = $testfunction->getBlacklistedCounts(); + $this->assertNotNull($blacklisted); + $this->assertArrayHasKey('bpassed', $blacklisted); + $this->assertArrayHasKey('btotal', $blacklisted); } } public function testCreateTestfunctionsData() { return array( - array('Qt5', 'state') + array(Factory::LIST_FAILURES, 'Qt5', 'state'), + array(Factory::LIST_BPASSES, 'Qt5', 'state') ); } diff --git a/non-puppet/qtmetrics2/src/test/TestfunctionTest.php b/non-puppet/qtmetrics2/src/test/TestfunctionTest.php index 2fdbb05..55a6d5c 100644 --- a/non-puppet/qtmetrics2/src/test/TestfunctionTest.php +++ b/non-puppet/qtmetrics2/src/test/TestfunctionTest.php @@ -37,7 +37,7 @@ require_once(__DIR__.'/../Factory.php'); /** * Testfunction unit test class * @example To run (in qtmetrics root directory): php <path-to-phpunit>/phpunit.phar ./src/test - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -45,23 +45,39 @@ class TestfunctionTest extends PHPUnit_Framework_TestCase { /** - * Test getName, getShortName, getTestsetName, getTestsetProjectName + * Test getName, getShortName, getTestsetName, getTestsetProjectName, getConfName * @dataProvider testGetNameData */ - public function testGetName($name, $shortName, $testset, $project) + public function testGetName($name, $shortName, $testset, $project, $conf) { - $testfunction = new Testfunction($name, $testset, $project); + $testfunction = new Testfunction($name, $testset, $project, $conf); $this->assertEquals($name, $testfunction->getName()); $this->assertEquals($shortName, $testfunction->getShortName()); $this->assertEquals($testset, $testfunction->getTestsetName()); $this->assertEquals($project, $testfunction->getTestsetProjectName()); + $this->assertEquals($conf, $testfunction->getConfName()); } public function testGetNameData() { return array( - array('cleanupTestCase', 'cleanupTestCase', 'tst_qftp', 'QtBase'), - array('my_testfunction', 'my_testfunction', 'my_testset', 'my_project'), - array('my_long_testfunction_name_that_has_over_50_letters_in_it', 'my_long_testfunction_name_that_has_over_...s_in_it', 'my_testset', 'my_project') + array( + 'cleanupTestCase', + 'cleanupTestCase', + 'tst_qftp', + 'QtBase', + 'macx-clang_developer-build_OSX_10.8'), + array( + 'my_testfunction', + 'my_testfunction', + 'my_testset', + 'my_project', + 'my_conf'), + array( + 'my_long_testfunction_name_that_has_over_50_letters_in_it', + 'my_long_testfunction_name_that_has_over_...s_in_it', + 'my_testset', + 'my_project', + 'my_conf') ); } @@ -69,9 +85,10 @@ class TestfunctionTest extends PHPUnit_Framework_TestCase * Test setResultCounts and getResultCounts * @dataProvider testGetResultCountsData */ - public function testGetTestsetResultCounts($name, $testset, $project, $passed, $failed, $skipped) + public function testGetTestsetResultCounts($name, $testset, $project, $conf, $passed, $failed, $skipped) { - $testfunction = new Testfunction($name, $testset, $project); + $testfunction = new Testfunction($name, $testset, $project, $conf); + $this->assertTrue($testfunction instanceof Testfunction); // Counts not set $result = $testfunction->getResultCounts(); $this->assertArrayHasKey('passed', $result); @@ -93,9 +110,40 @@ class TestfunctionTest extends PHPUnit_Framework_TestCase public function testGetResultCountsData() { return array( - array('cleanupTestCase', 'tst_qftp', 'QtBase', 1, 2, 3), - array('cleanupTestCase', 'tst_qftp', 'Qt5', 123456, 654321, 111222), - array('my_testfunction', 'my_testfunction', 'my_project', 7, 14, 7) + array('cleanupTestCase', 'tst_qftp', 'QtBase', 'macx-clang_developer-build_OSX_10.8', 1, 2, 3), + array('cleanupTestCase', 'tst_qftp', 'Qt5', 'macx-clang_developer-build_OSX_10.8', 123456, 654321, 111222), + array('my_testfunction', 'my_testfunction', 'my_project', 'my_conf', 7, 14, 7) + ); + } + + /** + * Test setBlacklistedCounts and getBlacklistedCounts + * @dataProvider testGetBlacklistedCountsData + */ + public function testGetBlacklistedCounts($name, $testset, $project, $conf, $bpassed, $btotal) + { + $testfunction = new Testfunction($name, $testset, $project, $conf); + $this->assertTrue($testfunction instanceof Testfunction); + // Counts not set + $result = $testfunction->getBlacklistedCounts(); + $this->assertArrayHasKey('bpassed', $result); + $this->assertArrayHasKey('btotal', $result); + $this->assertNull($result['bpassed']); + $this->assertNull($result['btotal']); + // Counts set + $testfunction->setBlacklistedCounts($bpassed, $btotal); + $result = $testfunction->getBlacklistedCounts(); + $this->assertArrayHasKey('bpassed', $result); + $this->assertArrayHasKey('btotal', $result); + $this->assertEquals($bpassed, $result['bpassed']); + $this->assertEquals($btotal, $result['btotal']); + } + public function testGetBlacklistedCountsData() + { + return array( + array('cleanupTestCase', 'tst_qftp', 'QtBase', 'macx-clang_developer-build_OSX_10.8', 1, 2), + array('cleanupTestCase', 'tst_qftp', 'Qt5', 'macx-clang_developer-build_OSX_10.8', 123456, 654321), + array('my_testfunction', 'my_testfunction', 'my_project', 'my_conf', 7, 14) ); } diff --git a/non-puppet/qtmetrics2/templates/about.html b/non-puppet/qtmetrics2/templates/about.html index bef8584..5611348 100644 --- a/non-puppet/qtmetrics2/templates/about.html +++ b/non-puppet/qtmetrics2/templates/about.html @@ -34,7 +34,7 @@ /** * About window content - * @since 20-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -52,4 +52,4 @@ and the global Qt developer community are the target audience. For detailed desc <p>See the <strong><a href="https://wiki.qt.io/Qt_Metrics_2_Backlog" target="_blank">backlog</a></strong> for development items currently identified or in progress.</p> -<p><small>Version 0.30 (20-Sep-2015)</small></p> +<p><small>Version 0.31 (21-Sep-2015)</small></p> diff --git a/non-puppet/qtmetrics2/templates/home.html b/non-puppet/qtmetrics2/templates/home.html index 24119e0..185e257 100644 --- a/non-puppet/qtmetrics2/templates/home.html +++ b/non-puppet/qtmetrics2/templates/home.html @@ -34,7 +34,7 @@ /** * Home page - * @since 18-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -133,6 +133,11 @@ <a class="btn btn-primary btn-xs" href="{{ flakyRoute }}" role="button">flaky</a> <a class="btn btn-primary btn-xs" href="{{ topTestfunctionsRoute }}" role="button">test functions</a> </div> +<br> +<p>See blacklisted tests where tagging could be removed:</p> +<div> +<a class="btn btn-primary btn-xs" href="{{ bpassedTestfunctionsRoute }}" role="button">test functions</a> +</div> </div> {# .col-md... #} </div> {# .row #} diff --git a/non-puppet/qtmetrics2/templates/testfunctions_bpass.html b/non-puppet/qtmetrics2/templates/testfunctions_bpass.html new file mode 100644 index 0000000..1dc5394 --- /dev/null +++ b/non-puppet/qtmetrics2/templates/testfunctions_bpass.html @@ -0,0 +1,112 @@ +{# +############################################################################# +## +## Copyright (C) 2015 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Quality Assurance module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +/** + * Blacklisted passes (testfunctions) page + * @since 21-09-2015 + * @author Juha Sippola + */ + +#} + +{% include "header.html" %} + +<ol class="breadcrumb"> +{% for link in breadcrumb %} +<li><a href="{{ link.link }}">{{ link.name }}</a></li> +{% endfor %} +<li class="active">blacklisted test function passes</li> +</ol> + +<div class="container-fluid"> +<div class="row"> + +<div class="col-sm-12 col-md-12 main"> + +{##### Title #####} + +<h1 class="page-header"> +Test Function Blacklisted Passes +<button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> +<span class="glyphicon glyphicon-info-sign"></span> +</button> +<small>{{ refreshed }}</small> +</h1> + +{##### Info well #####} + +<div class="collapse" id="info"> +<div class="well infoWell"> +<span class="glyphicon glyphicon-info-sign"></span> <strong>Test Function Blacklisted Passes</strong><br> +<ul> +<li>Lists the test functions in <strong>{{ masterProject }} {{ masterState }}</strong> builds where tagged +as blacklisted but have not failed or skipped during the last {{ lastDays }} days.</li> +<li>In these cases the blacklisted tag could maybe be removed in the CI so that the test function would be +tested normally in the future builds.</li> +<li><strong>Summary</strong> shows the count of test functions in each testset (any configuration or branch) +with blacklisted passes</li> +<li><strong>Blacklisted Passes</strong> shows the list of test functions with blacklisted passes by testset +and configuration. The testset link opens a page where the test functions are listed by branch.</li> +</ul> +</div> +</div> + +{##### List #####} + +<div id="testfunctions_blacklisted_passed_data"> +<div class="panel panel-primary"> +<div class="panel-heading"> +<h4 class="panel-title bold">Blacklisted Passes <small>(last {{ lastDays }} days since {{ sinceDate }})</small></h4> +</div> +</div> +<div class="progress data_loading"> +<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"> +</div> +</div> +<div class="alert alert-warning" role="alert"> +<span class="glyphicon glyphicon-time"></span> <strong>Please wait:</strong> Extracting the data will be ready in less than a minute! +</div> +</div> {# testfunctions_blacklisted_passed_data #} + +</div> {# .col... #} +</div> {# .row #} +</div> {# .container-fluid #} + +{% include "footer.html" %} + +{# Local scripts for this page #} +<script src="scripts/ajax.js"></script> +<script src="scripts/tooltip.js"></script> + +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/testfunctions_bpass_data.html b/non-puppet/qtmetrics2/templates/testfunctions_bpass_data.html new file mode 100644 index 0000000..117db0d --- /dev/null +++ b/non-puppet/qtmetrics2/templates/testfunctions_bpass_data.html @@ -0,0 +1,194 @@ +{# +############################################################################# +## +## Copyright (C) 2015 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Quality Assurance module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +/** + * Blacklisted passes (testfunctions) data + * @since 21-09-2015 + * @author Juha Sippola + */ + +#} + +{# Failed/passed bar area size in px #} +{% set BAR_AREA = 120 %} + +{# testfunctions as Testfunction objects +/** + * @var Testfunction[] testfunctions + */ +#} + +{##### Summary #####} + +<div class="panel panel-primary"> +<div class="panel-heading"> +<h4 class="panel-title bold">Summary <small>(last {{ lastDays }} days since {{ sinceDate }})</small></h4> +</div> +<div class="panel-body"> +<div class="table-responsive"> +<table class="table table-striped"> +<thead> +<tr> +<th>testset</th> +<th>project</th> +<th class="leftBorder center">count</th> +<th class="showInLargeDisplay"></th> +</tr> +</thead> +<tbody> +{# Calculate max result count for the bar #} +{% set prevTestsetName = '' %} +{% set prevProjectName = '' %} +{% set testfunctionCount = 0 %} +{% set maxCount = 1 %} +{% for testfunction in testfunctions %} +{% if (testfunction.getTestsetName == prevTestsetName) and (testfunction.getTestsetProjectName == prevProjectName) %} +{% set testfunctionCount = testfunctionCount + 1 %} +{% else %} +{% if testfunctionCount > maxCount %} +{% set maxCount = testfunctionCount %} +{% endif %} +{% set testfunctionCount = 1 %} +{% endif %} +{% set prevTestsetName = testfunction.getTestsetName %} +{% set prevProjectName = testfunction.getTestsetProjectName %} +{% endfor %} + +{# Print testsets #} +{% set prevTestsetName = '' %} +{% set prevProjectName = '' %} +{% set testfunctionCount = 0 %} +{% set bar = 0 %} +{% for testfunction in testfunctions %} + +{# First row #} +{% if prevTestsetName == '' %} +<tr> +<td>{{ testfunction.getTestsetName }}</td> +<td>{{ testfunction.getTestsetProjectName }}</td> +{% set testfunctionCount = 1 %} + +{# Same testset: Increase the counter #} +{% elseif (testfunction.getTestsetName == prevTestsetName) and (testfunction.getTestsetProjectName == prevProjectName) %} +{% set testfunctionCount = testfunctionCount + 1 %} + +{# New testset: Print count for previous one and start new row #} +{% else %} +{% set bar = ((BAR_AREA/maxCount) * testfunctionCount)|round(0, 'floor') %} +{% if (testfunctionCount > 0) and (bar == 0) %} +{% set bar = 1 %} +{% endif %} +<td class="leftBorder center">{{ testfunctionCount }}</td> +<td class="center showInLargeDisplay"> +<div> +<div class="floatLeft blueBackground" style="width: {{ bar }}px"> </div> +</div> +</td> +</tr> +<tr> +<td>{{ testfunction.getTestsetName }}</td> +<td>{{ testfunction.getTestsetProjectName }}</td> +{% set testfunctionCount = 1 %} +{% endif %} +{% set prevTestsetName = testfunction.getTestsetName %} +{% set prevProjectName = testfunction.getTestsetProjectName %} +{% endfor %}{# testfunction #} + +{# Print count for last one #} +{% if testfunctionCount > 0 %} +{% set bar = ((BAR_AREA/maxCount) * testfunctionCount)|round(0, 'floor') %} +{% if (testfunctionCount > 0) and (bar == 0) %} +{% set bar = 1 %} +{% endif %} +<td class="leftBorder center">{{ testfunctionCount }}</td> +<td class="center showInLargeDisplay"> +<div> +<div class="floatLeft blueBackground" style="width: {{ bar }}px"> </div> +</div> +</td> + +</tr> +{% endif %} +</tbody> +</table> +</div> {# .table-responsive #} +</div> {# .panel-body #} +</div> {# .panel... #} + +{##### List #####} + +<div class="panel panel-primary"> +<div class="panel-heading"> +<h4 class="panel-title bold">Blacklisted Passes <small>(last {{ lastDays }} days since {{ sinceDate }})</small></h4> +</div> +<div class="panel-body"> +<div class="table-responsive"> +<table class="table table-striped"> +<thead> +<tr> +<th>test function</th> +<th>testset</th> +<th class="showInLargeDisplay">project</th> +<th class="showInLargeDisplay">configuration</th> +</tr> +</thead> +<tbody> + +{# Print testfunctions #} +{% for testfunction in testfunctions %} +<tr> +{# Testfunction name #} +{% if testfunction.getName|length > constant('Testfunction::SHORT_NAME_LENGTH') %} +<td><span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ testfunction.getName }}">{{ testfunction.getShortName }}</span></td> +{% else %} +<td>{{ testfunction.getName }}</td> +{% endif %} + +{# Testset name #} +{% set link = testsetRoute ~ '/' ~ testfunction.getTestsetName|url_encode ~ '/' ~ testfunction.getTestsetProjectName|url_encode ~ '/' ~ testfunction.getConfName|url_encode %} +<td><a href="{{ link }}">{{ testfunction.getTestsetName }}</a></td> + +{# Project name #} +<td class="showInLargeDisplay">{{ testfunction.getTestsetProjectName }}</td> + +{# Conf name #} +<td class="showInLargeDisplay">{{ testfunction.getConfName }}</td> + +</tr> +{% endfor %}{# testfunction #} +</tbody> +</table> +</div> {# .table-responsive #} +</div> {# .panel-body #} +</div> {# .panel... #} diff --git a/non-puppet/qtmetrics2/templates/testset_testfunctions.html b/non-puppet/qtmetrics2/templates/testset_testfunctions.html index 04b989d..d2ee081 100644 --- a/non-puppet/qtmetrics2/templates/testset_testfunctions.html +++ b/non-puppet/qtmetrics2/templates/testset_testfunctions.html @@ -34,7 +34,7 @@ /** * Testset page (list of test functions) - * @since 17-09-2015 + * @since 21-09-2015 * @author Juha Sippola */ @@ -102,7 +102,8 @@ <li>results: <span class="glyphicon glyphicon-remove red"></span> = {{ constant('TestfunctionRun::RESULT_FAILURE') }}, <span class="glyphicon glyphicon-ok-sign red"></span> = {{ constant('TestfunctionRun::RESULT_SUCCESS_UNEXPECTED') }}, <span class="glyphicon glyphicon-remove-sign green"></span> = {{ constant('TestfunctionRun::RESULT_FAILURE_EXPECTED') }}, -<span class="glyphicon glyphicon-ban-circle gray"></span> = {{ constant('TestfunctionRun::RESULT_SKIP') }}</li> +<span class="glyphicon glyphicon-ban-circle gray"></span> = {{ constant('TestfunctionRun::RESULT_SKIP') }}, +<span class="glyphicon glyphicon-ok green"></span> = {{ constant('TestfunctionRun::RESULT_SUCCESS') }} (blacklisted only)</li> </ul> </li> <li>Details on the runs are available as tooltip on result icon</li> @@ -116,7 +117,7 @@ <div class="panel panel-primary"> <div class="panel-heading"> -<h4 class="panel-title bold">Test Function Results in Branches <small>(failures and skipped only)</small></h4> +<h4 class="panel-title bold">Test Function Results in Branches <small>(failures, skipped or blacklisted only)</small></h4> </div> </div> @@ -247,21 +248,23 @@ {% if key > buildKeyIndexPrinted and not buildKeyFound %} {% if buildKey == run.getBuildKey %} {# Print result #} -{% if run.getResult == constant('TestfunctionRun::RESULT_FAILURE') %} -{% set resultIcon = 'glyphicon glyphicon-remove red' %} +{% if run.getResult == constant('TestfunctionRun::RESULT_SUCCESS') %} +{% set resultIcon = 'glyphicon glyphicon-ok green' %} +{% elseif run.getResult == constant('TestfunctionRun::RESULT_FAILURE') %} +{% set resultIcon = 'glyphicon glyphicon-remove red' %} {% elseif run.getResult == constant('TestfunctionRun::RESULT_FAILURE_EXPECTED') %} -{% set resultIcon = 'glyphicon glyphicon-remove-sign green' %} +{% set resultIcon = 'glyphicon glyphicon-remove-sign green' %} {% elseif run.getResult == constant('TestfunctionRun::RESULT_SUCCESS_UNEXPECTED') %} -{% set resultIcon = 'glyphicon glyphicon-ok-sign red' %} +{% set resultIcon = 'glyphicon glyphicon-ok-sign red' %} {% elseif run.getResult == constant('TestfunctionRun::RESULT_SKIP') %} -{% set resultIcon = 'glyphicon glyphicon-ban-circle gray' %} +{% set resultIcon = 'glyphicon glyphicon-ban-circle gray' %} {% else %} -{% set resultIcon = '' %} +{% set resultIcon = '' %} {% endif %} {% if (run.getDuration / 10) > 60 %} -{% set durationFormatted = ' (00:' ~ ((run.getDuration/10)|round)|date("i:s") ~ ')' %} +{% set durationFormatted = ' (00:' ~ ((run.getDuration/10)|round)|date("i:s") ~ ')' %} {% else %} -{% set durationFormatted = '' %} +{% set durationFormatted = '' %} {% endif %} {% if run.getChildren %} {% set testrowResult = '(in test rows)' %} |