Exemplo n.º 1
0
 public static function run($to_run)
 {
     pts_test_run_manager::set_batch_mode(array('UploadResults' => false, 'SaveResults' => false, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false));
     $tests_to_run_concurrently = 2;
     if (($j = getenv('PTS_CONCURRENT_TEST_RUNS')) && is_numeric($j) && $j > 1) {
         $tests_to_run_concurrently = $j;
         echo 'PTS_CONCURRENT_TEST_RUNS set; running ' . $tests_to_run_concurrently . ' tests concurrently.' . PHP_EOL;
     }
     $test_flags = pts_c::batch_mode;
     if (pts_test_run_manager::initial_checks($to_run, $test_flags, 'SHORT') == false) {
         return false;
     }
     /*
     if(count($to_run) < $tests_to_run_concurrently)
     {
     	echo PHP_EOL . 'More tests must be specified in order to run ' . $tests_to_run_concurrently . ' tests concurrently.';
     	return false;
     }
     */
     $test_run_manager = new pts_test_run_manager($test_flags);
     // Load the tests to run
     if ($test_run_manager->load_tests_to_run($to_run) == false) {
         return false;
     }
     // Run the actual tests
     $total_loop_time = pts_client::read_env('TOTAL_LOOP_TIME');
     if ($total_loop_time == 'infinite') {
         $total_loop_time = 'infinite';
         echo 'TOTAL_LOOP_TIME set; running tests in an infinite loop until otherwise triggered' . PHP_EOL;
     } else {
         if ($total_loop_time && is_numeric($total_loop_time) && $total_loop_time > 9) {
             $total_loop_time = $total_loop_time * 60;
             echo 'TOTAL_LOOP_TIME set; running tests for ' . $total_loop_time / 60 . ' minutes' . PHP_EOL;
         } else {
             $total_loop_time = false;
         }
     }
     //$test_run_manager->pre_execution_process();
     $test_run_manager->multi_test_stress_run_execute($tests_to_run_concurrently, $total_loop_time);
 }