How to use prompt_to_test_subset method of pts_test_run_manager class

Best Phoronix-test-suite code snippet using pts_test_run_manager.prompt_to_test_subset

pts_test_run_manager.php

Source:pts_test_run_manager.php Github

copy

Full Screen

...1473 {1474 $this->pre_run_message = $run_object->get_pre_run_message();1475 $this->post_run_message = $run_object->get_post_run_message();1476 $tests_contained = $run_object->get_contained_test_result_objects();1477 if($this->prompt_to_test_subset() && !$this->auto_mode && !$this->batch_mode)1478 {1479 $this->prompt_subset_of_result_objects_to_run($tests_contained);1480 }1481 foreach($tests_contained as $result_object)1482 {1483 $this->add_test_result_object($result_object);1484 }1485 }1486 else if($run_object instanceof pts_result_file)1487 {1488 // Print the $to_run ?1489 $this->run_description = $run_object->get_description();1490 $preset_vars = $run_object->get_preset_environment_variables();1491 $result_objects = $run_object->get_result_objects();1492 $this->set_save_name($run_object->get_identifier(), false);1493 $this->file_name_title = $run_object->get_title();1494 pts_module_manager::process_environment_variables_string_to_set($preset_vars);1495 if($this->prompt_to_test_subset() && !$this->auto_mode && !$this->batch_mode)1496 {1497 $this->prompt_subset_of_result_objects_to_run($result_objects);1498 }1499 foreach($result_objects as &$result_object)1500 {1501 if($result_object->test_profile->get_identifier() == null)1502 {1503 continue;1504 }1505 // Check to ensure that nothing extra may have somehow wound up in the execution argument string of a saved result file...1506 if(pts_strings::has_in_string($result_object->get_arguments(), array('; ', '&&', '|')))1507 {1508 continue;1509 }1510 $test_result = new pts_test_result($result_object->test_profile);1511 $test_result->set_used_arguments($result_object->get_arguments());1512 $test_result->set_used_arguments_description($result_object->get_arguments_description());1513 $this->add_test_result_object($test_result);1514 }1515 }1516 else1517 {1518 trigger_error($run_object . ' is not recognized.', E_USER_ERROR);1519 continue;1520 }1521 }1522 // AutoSortRunQueue1523 if(pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/AutoSortRunQueue', 'TRUE') && ($this->force_save_results == false || pts_env::read('TEST_EXECUTION_SORT')))1524 {1525 // Not that it matters much, but if $this->force_save_results is set that means likely running from a result file...1526 // so if running a result file, don't change the ordering of the existing results1527 // Sort the run order so that all tests that are similar are grouped together, etc1528 switch(strtolower(pts_env::read('TEST_EXECUTION_SORT')))1529 {1530 case 'none': // natural order1531 break;1532 case 'random':1533 shuffle($this->tests_to_run);1534 break;1535 case 'dependencies':1536 usort($this->tests_to_run, array('pts_test_run_manager', 'compare_result_objects_by_dependencies'));1537 break;1538 case 'test-estimated-time':1539 usort($this->tests_to_run, array('pts_test_run_manager', 'compare_result_objects_by_estimated_time'));1540 break;1541 case 'test-estimated-time-desc':1542 usort($this->tests_to_run, array('pts_test_run_manager', 'compare_result_objects_by_estimated_time'));1543 $this->tests_to_run = array_reverse($this->tests_to_run);1544 break;1545 case 'test':1546 usort($this->tests_to_run, array('pts_test_run_manager', 'compare_result_objects_by_test_identifier'));1547 break;1548 case 'default':1549 default:1550 usort($this->tests_to_run, array('pts_test_run_manager', 'compare_result_objects_by_subsystem_and_types'));1551 break;1552 }1553 }1554 $this->prompt_save_results = $run_contains_a_no_result_type == false || $unique_test_count > 1;1555 $this->force_save_results = $this->force_save_results || $request_results_save;1556 // Is there something to run?1557 return $this->get_test_count() > 0;1558 }1559 public function load_result_file_to_run($save_name, $result_identifier, &$result_file, $tests_to_complete = null)1560 {1561 // Determine what to run1562 $this->auto_save_results($save_name, $result_identifier);1563 $this->run_description = $result_file->get_description();1564 $result_objects = $result_file->get_result_objects();1565 // Unset result objects that shouldn't be run1566 if(is_array($tests_to_complete))1567 {1568 foreach(array_keys($result_objects) as $i)1569 {1570 if(!in_array($i, $tests_to_complete))1571 {1572 unset($result_objects[$i]);1573 }1574 }1575 }1576 if(count($result_objects) == 0)1577 {1578 return false;1579 }1580 foreach($result_objects as &$result_object)1581 {1582 if($this->validate_test_to_run($result_object->test_profile))1583 {1584 // Check to ensure that nothing extra may have somehow wound up in the execution argument string of a saved result file...1585 if(pts_strings::has_in_string($result_object->get_arguments(), array('; ', '&&', '|')))1586 {1587 echo PHP_EOL . 'Exception loading a result object.' . PHP_EOL;1588 continue;1589 }1590 $test_result = new pts_test_result($result_object->test_profile);1591 $test_result->set_used_arguments($result_object->get_arguments());1592 $test_result->set_used_arguments_description($result_object->get_arguments_description());1593 $this->add_test_result_object($test_result);1594 }1595 }1596 // Is there something to run?1597 return $this->get_test_count() > 0;1598 }1599 public function is_multi_test_stress_run()1600 {1601 return $this->multi_test_stress_run;1602 }1603 protected function test_prompts_to_result_objects(&$test_profile)1604 {1605 $result_objects = array();1606 if($this->batch_mode && $this->batch_mode['RunAllTestCombinations'])1607 {1608 $opts = pts_test_run_options::batch_user_options($test_profile);1609 }1610 else if($this->batch_mode && (pts_env::read('PRESET_OPTIONS') || pts_env::read('PRESET_OPTIONS_VALUES')))1611 {1612 $opts = pts_test_run_options::prompt_user_options($test_profile, null, true);1613 }1614 else if($this->auto_mode == 2)1615 {1616 $opts = pts_test_run_options::default_user_options($test_profile);1617 }1618 else1619 {1620 $opts = pts_test_run_options::prompt_user_options($test_profile);1621 }1622 if($opts == false)1623 {1624 return array();1625 }1626 list($test_arguments, $test_arguments_description) = $opts;1627 foreach(array_keys($test_arguments) as $i)1628 {1629 $test_result = new pts_test_result($test_profile);1630 $test_result->set_used_arguments($test_arguments[$i]);1631 $test_result->set_used_arguments_description($test_arguments_description[$i]);1632 $result_objects[] = $test_result;1633 }1634 return $result_objects;1635 }1636 public function prompt_subset_of_result_objects_to_run(&$result_objects_contained)1637 {1638 $ros = array();1639 foreach($result_objects_contained as $key => $ro)1640 {1641 $ros[$key] = trim($ro->test_profile->get_title() . PHP_EOL . $ro->get_arguments_description());1642 }1643 $run_ids = pts_user_io::prompt_text_menu('Select the test(s) to run', $ros, true, true);1644 foreach($result_objects_contained as $id => $ro)1645 {1646 if(!in_array($id, $run_ids))1647 {1648 unset($result_objects_contained[$id]);1649 }1650 }1651 }1652 public function do_prompt_to_test_subset()1653 {1654 $this->test_subset = true;1655 }1656 public function prompt_to_test_subset()1657 {1658 return $this->test_subset;1659 }1660 public static function compare_result_objects_by_subsystem_and_types($a, $b)1661 {1662 $a_comp = $a->test_profile->get_test_hardware_type() . $a->test_profile->get_test_software_type() . $a->test_profile->get_internal_tags_raw() . $a->test_profile->get_result_scale_formatted() . $a->test_profile->get_identifier(true);1663 $b_comp = $b->test_profile->get_test_hardware_type() . $b->test_profile->get_test_software_type() . $b->test_profile->get_internal_tags_raw() . $b->test_profile->get_result_scale_formatted() . $b->test_profile->get_identifier(true);1664 if($a_comp == $b_comp)1665 {1666 // So it's the same test being compared... try to sort in ascending order (such that 800 x 600 resolution comes before 1024 x 768), below way is an attempt to recognize such in weird manner1667 if(strlen($a->get_arguments_description()) == strlen($b->get_arguments_description()))1668 {1669 return strcmp($a->get_arguments_description(), $b->get_arguments_description());1670 }...

Full Screen

Full Screen

prompt_to_test_subset

Using AI Code Generation

copy

Full Screen

1require_once('pts_test_run_manager.php');2$pts_test_run_manager = new pts_test_run_manager();3$pts_test_run_manager->prompt_to_test_subset();4$pts_test_run_manager->run_test();5$pts_test_run_manager->results_to_xml();6$pts_test_run_manager->results_to_json();7$pts_test_run_manager->results_to_csv();

Full Screen

Full Screen

prompt_to_test_subset

Using AI Code Generation

copy

Full Screen

1$test_profile = new pts_test_profile('test-profile-name');2$test_run_manager = new pts_test_run_manager();3$test_run_manager->prompt_to_test_subset($test_profile, 0, 2);4$test_profile = new pts_test_profile('test-profile-name');5$test_run_manager = new pts_test_run_manager();6$test_run_manager->prompt_to_test_subset($test_profile, -2);7$test_profile = new pts_test_profile('test-profile-name');8$test_run_manager = new pts_test_run_manager();9$test_run_manager->prompt_to_test_subset($test_profile, 3, 6);

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in pts_test_run_manager

Trigger prompt_to_test_subset code on LambdaTest Cloud Grid

Execute automation tests with prompt_to_test_subset on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful