Using basicReportinc » History » Version 3
Amber Herold, 04/25/2011 03:13 PM
1 | 1 | Amber Herold | h1. Using basicReport.inc |
---|---|---|---|
2 | |||
3 | basicReport.inc is a class that can be used to quickly display run information as well as parameters and results. It creates html tables by reading database tables. |
||
4 | The only input it needs is the expId, jobtype and a database table name. |
||
5 | |||
6 | Here is a sample file using the class to display information from a single run: |
||
7 | <pre> |
||
8 | <?php |
||
9 | |||
10 | require_once "inc/basicreport.inc"; |
||
11 | |||
12 | $expId = $_GET['expId']; |
||
13 | $runId = $_GET['rId']; |
||
14 | |||
15 | try { |
||
16 | 2 | Amber Herold | // Create an instance of the BasicReport class using the makeStack jobtype and DB table |
17 | 1 | Amber Herold | $testSuiteReport = new BasicReport( $expId, "makestack2", "ApStackRunData"); |
18 | |||
19 | // Get the run data for the specific test run we are reporting on |
||
20 | $runData =$testSuiteReport->getRunData($runId); |
||
21 | |||
22 | // The jobReportLink provides a link to another page for further information. |
||
23 | // If there is no more data to display, this should link back to the current page. |
||
24 | // If the 3rd param to displaySummaryTable() is True, sub tables will be parsed and displayed. |
||
25 | $jobReportLink = 'testsuiterunreport.php?expId='.$expId.'&rId='.$runData['DEF_id']; |
||
26 | $summaryTable = $testSuiteReport->displaySummaryTable($runData, $jobReportLink, True); |
||
27 | |||
28 | } catch (Exception $e) { |
||
29 | 2 | Amber Herold | $message = $e->getMessage(); |
30 | 1 | Amber Herold | $summaryTable = "<font color='#cc3333' size='+2'>Error creating report page: $message </font>\n"; |
31 | } |
||
32 | |||
33 | // Display the standard Appion interface header |
||
34 | processing_header("MakeStack Run Report","MakeStack Run Report for $runData[stackRunName]"); |
||
35 | |||
36 | // Display the table built by the BasicReport class or errors |
||
37 | echo $summaryTable; |
||
38 | |||
39 | // Display the standard Appion interface footer |
||
40 | processing_footer(); |
||
41 | |||
42 | ?> |
||
43 | </pre> |