1<?php 2 3include"./api/include_api.php"; 4auth_authenticate_user(); 5 6session_validate_form_reset(); 7 8$project_properties = session_get_project_properties(); 9$project_name = $project_properties['project_name']; 10$project_id = $project_properties['project_id']; 11 12# Links to pages 13$page = basename(__FILE__); 14 15html_window_title(); 16html_print_body(); 17html_page_title($project_name ." - ". lang_get('auto_pass_page') ); 18 19 20 21 22print"<div align='center'>". NEWLINE; 23print"The following tests have been Passed by the system:<BR>"; 24print"<table class=width80 rules=cols>". NEWLINE; 25print"<tr>". NEWLINE; 26html_tbl_print_header( lang_get('testset_id') ); 27html_tbl_print_header( lang_get('test_id') ); 28html_tbl_print_header( lang_get('test_name') ); 29html_tbl_print_header( lang_get('test_run_id') ); 30print"</tr>". NEWLINE; 31 32 33$testset_id = $_GET['testset_id']; 34 35 36global $db; 37$results_tbl = TEST_RESULTS_TBL; 38$f_test_run_id = TEST_RESULTS_TS_UNIQUE_RUN_ID; 39$f_test_id = TEST_RESULTS_TEMPEST_TEST_ID; 40$f_testset_id = TEST_RESULTS_TEST_SET_ID; 41$f_test_name = TEST_RESULTS_TEST_SUITE; 42$f_status = TEST_RESULTS_TEST_STATUS; 43$f_assigned_to = TEST_RESULTS_ASSIGNED_TO; 44$f_started = TEST_RESULTS_STARTED; 45$f_finished = TEST_RESULTS_FINISHED; 46$f_time_started = TEST_RESULTS_TIME_STARTED; 47$f_time_finished = TEST_RESULTS_TIME_FINISHED; 48 49 50$q = "SELECT DISTINCT( $f_test_id ) 51 FROM $results_tbl 52 WHERE $f_testset_id = '$testset_id'"; 53$rs = db_query( $db, $q ); 54 55while($row = db_fetch_row( $db, $rs ) ) { 56 57 $test_id = $row[TEST_RESULTS_TEMPEST_TEST_ID]; 58 59 //Get the latest run of the test 60 $q_results = "SELECT MAX($f_test_run_id) as MAX 61 FROM $results_tbl 62 WHERE $f_testset_id = '$testset_id' 63 AND $f_test_id = '$test_id' 64 AND $f_finished = '1'"; 65 //print"$q_results<BR>"; 66 67 $rs_results = db_query( $db, $q_results ); 68 $row_results = db_fetch_row( $db, $rs_results ); 69 $max_testresults_id = $row_results['MAX']; 70 71 //Get the Unique Run ID from the latest run 72 $q_run_id = "SELECT $f_test_run_id FROM $results_tbl WHERE $f_test_run_id = '$max_testresults_id'"; 73 74 $rs_run_id = db_query( $db, $q_run_id ); 75 $num_run_id = db_num_rows( $db, $rs_run_id ); 76 77 if($num_run_id != 0){ 78 79 $row_run_id = db_fetch_row( $db, $rs_run_id ); 80 81 //Gets the status of the individual verifications that are FAIL for the test run 82 $vr_tbl = VERIFY_RESULTS_TBL; 83 $f_verify_id = VERIFY_RESULTS_ID; 84 $f_vr_test_run_id = VERIFY_RESULTS_TS_UNIQUE_RUN_ID; 85 $f_status = VERIFY_RESULTS_TEST_STATUS; 86 87 $unique_run_id = $row_run_id[TEST_RESULTS_TS_UNIQUE_RUN_ID]; 88 89 $query_results = "SELECT $f_status 90 FROM $vr_tbl 91 WHERE ( $f_vr_test_run_id = '$unique_run_id' AND $f_status != 'PASS') 92 OR ($f_vr_test_run_id = '$unique_run_id' AND $f_status != 'INFO')"; 93 94 95 $rs_results = db_query( $db, $query_results ); // = mysql_query($query_results); 96 $num_results = db_num_rows( $db, $rs_results ); //$num_results = mysql_num_rows($recordset_results); 97 98 //If there are no FAILS and the test isnt a Manual Test, then continue with Passing it 99 if( 0 == $num_results && 'S' == (substr($unique_run_id,0,1) ) ){ 100 //Checks that the test has not been previously passed 101 102 $assoc_tbl = TEST_TS_ASSOC_TBL; 103 $f_assoc_id = TEST_TS_ASSOC_ID; 104 $f_assoc_ts_id = TEST_TS_ASSOC_TS_ID; 105 $f_assoc_test_id = TEST_TS_ASSOC_TEST_ID; 106 $f_assoc_status = TEST_TS_ASSOC_STATUS; 107 $f_assoc_assigned_to = TEST_TS_ASSOC_ASSIGNED_TO; 108 $f_assoc_timestamp = TEST_TS_ASSOC_TIMESTAMP; 109 110 $q_check = "SELECT $f_assoc_status 111 FROM $assoc_tbl 112 WHERE $f_assoc_ts_id = '$testset_id' 113 AND $f_assoc_test_id = '$test_id]'"; 114 115 //print"<BR>------$query_check<BR>"; 116 $rs_check = db_query( $db, $q_check ); 117 $row_check = db_fetch_array( $db, $rs_check ); 118 $status = $row_check[TEST_TS_ASSOC_STATUS]; 119 120 //If the test has not been passed, then pass it 121 if($status != 'Passed') { 122 123 $test_name = test_get_name( $test_id ); 124 125 print"<tr>". NEWLINE; 126 print"<td>$testset_id</td>". NEWLINE; 127 print"<td>$test_id</td>". NEWLINE; 128 print"<td>$test_name</td>". NEWLINE; 129 print"<td><a href='results_view_verifications_page.php?test_run_id=$unique_run_id&testset_id=$testset_id&test_id=$test_id'>$unique_run_id</td>". NEWLINE; 130 print"</tr>". NEWLINE; 131 132 $q_update = "UPDATE $assoc_tbl 133 SET $f_assoc_status = 'Passed', 134 $f_assoc_assigned_to = 'System', 135 $f_assoc_timestamp = '$current_date' 136 WHERE $f_assoc_ts_id = '$testset_id' 137 AND $f_assoc_test_id = '$test_id'"; 138 db_query( $db, $q_update); 139 140 } 141 } 142 } 143} 144 145print"</table>". NEWLINE; 146print"</div>". NEWLINE; 147 148 149print"<br><br>". lang_get('autopass_complete') ."<br><br><br><br>". NEWLINE; 150 151html_print_footer(); 152 153?>