summaryrefslogtreecommitdiffstats
path: root/non-puppet/qtmetrics2
diff options
context:
space:
mode:
authorJuha Sippola <juhasippola@outlook.com>2015-09-21 16:03:00 +0300
committerTony Sarajärvi <tony.sarajarvi@theqtcompany.com>2015-09-23 09:38:58 +0000
commita81a1fef4cf1da8003d5de34b157da9156d5edcb (patch)
treed345c4a02fd79eaa2a9afe420647fa61f6f5a837 /non-puppet/qtmetrics2
parentc9a86e4405086739833100bb166e56c8672ec116 (diff)
Qt Metrics 2 (v0.26): Testfunction link visibility
Show the testfunction link on testset's testfunctions list only if the testfunction has children testrows (to improve the usability). Database design changed so that testfunction_run.result has now separate enum values for calculated testrow results instead of using the same. The availability of children testrows is checked from those new values. The parser changed accordingly. Change-Id: I456ee4c3915b265a629b1e84e2e008f6001a59af Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
Diffstat (limited to 'non-puppet/qtmetrics2')
-rw-r--r--non-puppet/qtmetrics2/src/Factory.php3
-rw-r--r--non-puppet/qtmetrics2/src/TestfunctionRun.php42
-rw-r--r--non-puppet/qtmetrics2/src/TestrowRun.php4
-rw-r--r--non-puppet/qtmetrics2/templates/about.html4
-rw-r--r--non-puppet/qtmetrics2/templates/testset_testfunctions.html22
-rw-r--r--non-puppet/qtmetrics2/testparser.pl12
6 files changed, 68 insertions, 19 deletions
diff --git a/non-puppet/qtmetrics2/src/Factory.php b/non-puppet/qtmetrics2/src/Factory.php
index cabecac..ba3d966 100644
--- a/non-puppet/qtmetrics2/src/Factory.php
+++ b/non-puppet/qtmetrics2/src/Factory.php
@@ -34,7 +34,7 @@
/**
* Factory class
- * @since 09-09-2015
+ * @since 16-09-2015
* @author Juha Sippola
*/
@@ -430,6 +430,7 @@ class Factory {
$conf,
TestfunctionRun::stripResult($entry['result']),
TestfunctionRun::isBlacklisted($entry['result']),
+ TestfunctionRun::hasChildren($entry['result']),
$entry['timestamp'],
$entry['duration']
);
diff --git a/non-puppet/qtmetrics2/src/TestfunctionRun.php b/non-puppet/qtmetrics2/src/TestfunctionRun.php
index 56f95aa..5291109 100644
--- a/non-puppet/qtmetrics2/src/TestfunctionRun.php
+++ b/non-puppet/qtmetrics2/src/TestfunctionRun.php
@@ -34,7 +34,7 @@
/**
* TestfunctionRun class
- * @since 08-09-2015
+ * @since 16-09-2015
* @author Juha Sippola
*/
@@ -51,6 +51,9 @@ class TestfunctionRun extends ProjectRun {
const RESULT_FAILURE = "fail";
const RESULT_FAILURE_EXPECTED = "xfail";
const RESULT_SKIP = "skip";
+ const RESULT_TESTROW_SUCCESS = "tr_pass";
+ const RESULT_TESTROW_FAILURE = "tr_fail";
+ const RESULT_TESTROW_SKIP = "tr_skip";
/**
* If the testfunction name long, a shorter version of the name can be requested
@@ -88,6 +91,12 @@ class TestfunctionRun extends ProjectRun {
private $blacklisted;
/**
+ * Children (true = has children).
+ * @var bool
+ */
+ private $children;
+
+ /**
* TestfunctionRun constructor.
* @param string $name
* @param string $testsetName
@@ -99,16 +108,18 @@ class TestfunctionRun extends ProjectRun {
* @param string $confName
* @param string $result (plain result without any possible flags)
* @param bool $blacklisted (true = blacklisted)
+ * @param bool $children (true = has children)
* @param string $timestamp
* @param int $duration (in deciseconds)
*/
- public function __construct($name, $testsetName, $testsetProjectName, $projectName, $branchName, $stateName, $buildKey, $confName, $result, $blacklisted, $timestamp, $duration) {
+ public function __construct($name, $testsetName, $testsetProjectName, $projectName, $branchName, $stateName, $buildKey, $confName, $result, $blacklisted, $children, $timestamp, $duration) {
parent::__construct($projectName, $branchName, $stateName, $buildKey, $result, $timestamp, $duration);
$this->name = $name;
$this->testsetName = $testsetName;
$this->testsetProjectName = $testsetProjectName;
$this->confName = $confName;
$this->blacklisted = $blacklisted;
+ $this->children = $children;
}
/**
@@ -169,7 +180,16 @@ class TestfunctionRun extends ProjectRun {
}
/**
- * Strip the result from the combined blacklisted-result string
+ * Get indication if children exist.
+ * @return bool (true = has $children)
+ */
+ public function getChildren()
+ {
+ return $this->children;
+ }
+
+ /**
+ * Strip the result in database from the combined blacklisted-result string or testrow-result string
* @param string $resultString
* @return string
*/
@@ -179,6 +199,9 @@ class TestfunctionRun extends ProjectRun {
$resultString = str_replace('bfail', 'fail', $resultString); // remove the possible blacklisted flag
$resultString = str_replace('bx', 'x', $resultString); // remove the possible blacklisted flag
$resultString = str_replace('bskip', 'skip', $resultString); // remove the possible blacklisted flag
+ $resultString = str_replace('tr_pass', 'pass', $resultString); // replace the possible calculated testrow result
+ $resultString = str_replace('tr_fail', 'fail', $resultString); // replace the possible calculated testrow result
+ $resultString = str_replace('tr_skip', 'skip', $resultString); // replace the possible calculated testrow result
return $resultString;
}
@@ -195,6 +218,19 @@ class TestfunctionRun extends ProjectRun {
return $flag;
}
+ /**
+ * Check if the testfunction has children (testrows)
+ * @param string $resultString
+ * @return bool (true = has children)
+ */
+ public static function hasChildren($resultString)
+ {
+ $flag = false;
+ if (strpos($resultString, 'tr_') === 0) // calculated testrow results begin with 'tr_'
+ $flag = true;
+ return $flag;
+ }
+
}
?>
diff --git a/non-puppet/qtmetrics2/src/TestrowRun.php b/non-puppet/qtmetrics2/src/TestrowRun.php
index cda6a1e..87d4c89 100644
--- a/non-puppet/qtmetrics2/src/TestrowRun.php
+++ b/non-puppet/qtmetrics2/src/TestrowRun.php
@@ -34,7 +34,7 @@
/**
* TestrowRun class
- * @since 09-09-2015
+ * @since 16-09-2015
* @author Juha Sippola
*/
@@ -62,7 +62,7 @@ class TestrowRun extends TestfunctionRun {
* @param string $timestamp
*/
public function __construct($name, $testfunctionName, $testsetName, $testsetProjectName, $projectName, $branchName, $stateName, $buildKey, $confName, $result, $blacklisted, $timestamp) {
- parent::__construct($testfunctionName, $testsetName, $testsetProjectName, $projectName, $branchName, $stateName, $buildKey, $confName, $result, $blacklisted, $timestamp, 0);
+ parent::__construct($testfunctionName, $testsetName, $testsetProjectName, $projectName, $branchName, $stateName, $buildKey, $confName, $result, $blacklisted, false, $timestamp, 0);
$this->name = $name;
$this->testfunctionName = $testfunctionName;
}
diff --git a/non-puppet/qtmetrics2/templates/about.html b/non-puppet/qtmetrics2/templates/about.html
index 55de316..39a63d2 100644
--- a/non-puppet/qtmetrics2/templates/about.html
+++ b/non-puppet/qtmetrics2/templates/about.html
@@ -34,7 +34,7 @@
/**
* About window content
- * @since 15-09-2015
+ * @since 16-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.25 (15-Sep-2015)</small></p>
+<p><small>Version 0.26 (16-Sep-2015)</small></p>
diff --git a/non-puppet/qtmetrics2/templates/testset_testfunctions.html b/non-puppet/qtmetrics2/templates/testset_testfunctions.html
index 11bc50f..b15e2d1 100644
--- a/non-puppet/qtmetrics2/templates/testset_testfunctions.html
+++ b/non-puppet/qtmetrics2/templates/testset_testfunctions.html
@@ -34,7 +34,7 @@
/**
* Testfunctions page
- * @since 08-09-2015
+ * @since 16-09-2015
* @author Juha Sippola
*/
@@ -97,6 +97,7 @@
<li><strong>Testfunction Results in Branches</strong> shows the {{ testset.getName }} <strong>failed and skipped</strong> results in configuration
{{ conf }} by branch on <strong>{{ masterProject }} {{ masterState }}</strong> builds
<ul>
+<li>testfunction name has link to list of testrows if testrows are available</li>
<li>flags: <span class="label label-default">b</span> = blacklisted flag set for the testfunction on the latest build shown</li>
<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') }},
@@ -194,14 +195,20 @@
</tr>
{% endif %}
<tr>
-{% set link = testfunctionRoute ~ '/' ~ run.getName|url_encode ~ '/' ~ testset.getName|url_encode ~ '/' ~ testset.getProjectName|url_encode ~ '/' ~ run.getConfName|url_encode %}
-<td><a href="{{ link }}"><small>
+<td><small>
+{% if run.getChildren %}
+{% set link = testfunctionRoute ~ '/' ~ run.getName|url_encode ~ '/' ~ testset.getName|url_encode ~ '/' ~ testset.getProjectName|url_encode ~ '/' ~ run.getConfName|url_encode %}
+<a href="{{ link }}">
+{% endif %}
{% if run.getName|length > constant('TestfunctionRun::SHORT_NAME_LENGTH') %}
<span class="clickOnTouch" data-toggle="tooltip" data-placement="top" title="{{ run.getName }}">{{ run.getShortName }}</span>
{% else %}
{{ run.getName }}
{% endif %}
-</small></a></td>
+{% if run.getChildren %}
+</a>
+{% endif %}
+</small></td>
{# Flags for the latest build #}
<td class="center rightBorder">
@@ -235,13 +242,18 @@
{% else %}
{% set durationFormatted = '' %}
{% endif %}
+{% if run.getChildren %}
+{% set testrowResult = '(in testrows)' %}
+{% else %}
+{% set testrowResult = '' %}
+{% endif %}
<td class="center">
<span class="spaceHorizontal {{ resultIcon }} clickOnTouch" data-toggle="tooltip" data-placement="top" data-html="true"
title="<table>
<tr><th>Build key: </th><td>{{ buildKey }}</td></tr>
<tr><th>Configuration: </th><td>{{ run.getConfName }}</td></tr>
<tr><th>Timestamp: </th><td>{{ run.getTimestamp }}</td></tr>
-<tr><th>Result: </th><td>{{ run.getResult }}</td></tr>
+<tr><th>Result: </th><td>{{ run.getResult }} {{ testrowResult }}</td></tr>
<tr><th>Duration: </th><td>{{ run.getDuration / 10 }} s {{ durationFormatted }}</td></tr>
<tr><th>Blacklisted: </th><td>{% if run.getBlacklisted %}yes{% else %}no{% endif %}</td></tr></table>">
</span></td>
diff --git a/non-puppet/qtmetrics2/testparser.pl b/non-puppet/qtmetrics2/testparser.pl
index d3bbb87..89ce1c9 100644
--- a/non-puppet/qtmetrics2/testparser.pl
+++ b/non-puppet/qtmetrics2/testparser.pl
@@ -1398,7 +1398,7 @@ sub sql_create_tables
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
testfunction_id MEDIUMINT UNSIGNED NOT NULL,
testset_run_id INT UNSIGNED NOT NULL,
- result ENUM('na','pass','fail','xpass','xfail','skip','bpass','bfail','bxpass','bxfail','bskip') NOT NULL DEFAULT 'na',
+ result ENUM('na','pass','fail','xpass','xfail','skip','bpass','bfail','bxpass','bxfail','bskip','tr_pass','tr_fail','tr_skip') NOT NULL DEFAULT 'na',
duration SMALLINT UNSIGNED NOT NULL,
CONSTRAINT testfunction_run_pk PRIMARY KEY (id)
) ENGINE MyISAM"
@@ -1827,16 +1827,16 @@ sub sql
} else {
# calculate the result from the testrow results, if any (use just the plain pass/fail/skip values)
my $testrow_result = "na"; # assume the testrow result is not available
- my $result = "pass"; # calculate the 'worst' result from the testrow results
+ my $result = "tr_pass"; # calculate the 'worst' result from the testrow results
foreach my $testrow (keys %{$datahash{cfg}{$cfg}{testresults}{all_tests}{$testset_project}{$test}{testfunctions}{$testfunction}{DataTags}}) {
$testrow_result = $datahash{cfg}{$cfg}{testresults}{all_tests}{$testset_project}{$test}{testfunctions}{$testfunction}{DataTags}{$testrow}{result};
# "skip" to overwrite "pass"
- if ($result eq "pass") {
- $result = "skip" if ($testrow_result eq "skip" or $testrow_result eq "bskip");
+ if ($result eq "tr_pass") {
+ $result = "tr_skip" if ($testrow_result eq "skip" or $testrow_result eq "bskip");
}
# "fail" to overwrite others
- if ($result ne "fail") {
- $result = "fail" if ($testrow_result eq "fail" or $testrow_result eq "bfail" or $testrow_result eq "xpass" or $testrow_result eq "bxpass");
+ if ($result ne "tr_fail") {
+ $result = "tr_fail" if ($testrow_result eq "fail" or $testrow_result eq "bfail" or $testrow_result eq "xpass" or $testrow_result eq "bxpass");
}
}
if ($testrow_result eq "na") {