The release related discussions, plans and questions.
przemilke
TestLink user
Posts: 5 Joined: Thu Dec 18, 2008 10:15 am
Post
by przemilke » Thu Dec 18, 2008 10:30 am
Hi everyone!
Had anyone tried to add results (Passed, Failed etc) of top level build of the testplan to metrics dashboard?
I have problem with this right now
At the moment we have total cases, active cases, executed cases and I think that section (metrics dashboard) will be better with columns Passed and Failed because of check overall situation.
Problem is not easy, because functions used in reports (for example in resultGeneral.php) are completly different in metrics_dashboard.php. Maybe someone could prompt me which function will be the best to upgrade/use in metrics_dashboard because of testplans results (to reach count of Passed, Failed related to top level build of each case)
Thanks for any help...
Przemilke
przemilke
TestLink user
Posts: 5 Joined: Thu Dec 18, 2008 10:15 am
Post
by przemilke » Thu Dec 18, 2008 11:18 am
I think about change code from resultGeneral.php and implement it to metrics_dashboard.php:
Code: Select all
$tp = new testplan($db);
$builds_to_query = 'a';
$suitesSelected = 'all';
$re = new results($db, $tp, $suitesSelected, $builds_to_query);
// TO-DO figure out how to use TestPlanResultsObj
//$excelWriter = new TestPlanResultsObj();
/**
* COMPONENTS REPORT
*/
$topLevelSuites = $re->getTopLevelSuites();
$mapOfAggregate = $re->getAggregateMap();
$arrDataSuite = null;
$arrDataSuiteIndex = 0;
if (is_array($topLevelSuites)) {
while ($i = key($topLevelSuites)) {
$pairArray = $topLevelSuites[$i];
$currentSuiteId = $pairArray['id'];
$currentSuiteName = $pairArray['name'];
$resultArray = $mapOfAggregate[$currentSuiteId];
$total = $resultArray['total'];
$notRun = $resultArray['notRun'];
if ($total > 0) {
$percentCompleted = (($total - $notRun) / $total) * 100;
}
else {
$percentCompleted = 0;
}
$percentCompleted = number_format($percentCompleted,2);
$arrDataSuite[$arrDataSuiteIndex] = array($currentSuiteName,$total,$resultArray['pass'],$resultArray['fail'],$resultArray['blocked'],$notRun,$percentCompleted);
$arrDataSuiteIndex++;
next($topLevelSuites);
}
At the moment i've no idea how to refer upper code to all active testplans. Upper piece of code involve only one testplan from session... Maybe any idea to solve that problem.
przemilke
TestLink user
Posts: 5 Joined: Thu Dec 18, 2008 10:15 am
Post
by przemilke » Thu Dec 18, 2008 1:33 pm
I resolve that problem simply.
It was simple (now, but few hours ago...)
Changes in metrics_dashboard.php
Code: Select all
foreach($test_plans as $key => $value)
{
$tplan_id=$value['id'];
$linked_tcversions[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id);
$metrics[$tplan_id]['tplan_name']=$value['name'];
$metrics[$tplan_id]['executed']=0;
$metrics[$tplan_id]['active']=0;
$metrics[$tplan_id]['total']=0;
[b] $metrics[$tplan_id]['pass']=0;
$metrics[$tplan_id]['fail']=0;[/b]
}
// Get count of executed testcases
foreach($linked_tcversions as $tplan_id => $tc)
{
$metrics[$tplan_id]['executed']=0;
$metrics[$tplan_id]['active']=0;
$metrics[$tplan_id]['total']=0;
[b] $metrics[$tplan_id]['pass']=0; // Passed and Failed testcase's by PMilke
$metrics[$tplan_id]['fail']=0;[/b]
$metrics[$tplan_id]['executed_vs_active']=-1;
$metrics[$tplan_id]['executed_vs_total']=-1;
$metrics[$tplan_id]['active_vs_total']=-1;
if( !is_null($tc) )
{
foreach($tc as $key => $value)
{
if( $value['exec_id'] > 0 )
{
$metrics[$tplan_id]['executed']++;
}
if( $value['active'])
{
$metrics[$tplan_id]['active']++;
}
[b] if( $value['exec_status'] == 'p' )
{
$metrics[$tplan_id]['pass']++;
}
if( $value['exec_status'] == 'f' )
{
$metrics[$tplan_id]['fail']++;
}[/b]
$metrics[$tplan_id]['total']++;
} // foreach
}
} // foreach