MDL-54628 behat: Set behat dir for each run under behat_dataroot
Before this patch behat_dataroot for parallel runs were created at same level as ->behat_dataroot After this patch, it will be created 1 level under ->behat_dataroot with BEHAT_PARALLEL_SITE_NAME prefix and run number as suffix. This will allow common files as test enabled and parallel run info to be saved in parent directory and access it easily.
This commit is contained in:
@@ -42,6 +42,22 @@ class behat_command {
|
||||
*/
|
||||
const DOCS_URL = 'http://docs.moodle.org/dev/Acceptance_testing';
|
||||
|
||||
/**
|
||||
* Ensures the behat dir exists in moodledata
|
||||
*
|
||||
* @return string Full path
|
||||
*/
|
||||
public static function get_parent_behat_dir() {
|
||||
global $CFG;
|
||||
|
||||
// If not set then return empty string.
|
||||
if (!isset($CFG->behat_dataroot_parent)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return $CFG->behat_dataroot_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the behat dir exists in moodledata
|
||||
* @param int $runprocess run process for which behat dir is returned.
|
||||
@@ -55,12 +71,11 @@ class behat_command {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (empty($runprocess)) {
|
||||
$behatdir = $CFG->behat_dataroot . '/behat';
|
||||
} else if (isset($CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'])) {
|
||||
// If $CFG->behat_parallel_run starts with index 0 and $runprocess for parallel run starts with 1.
|
||||
if (!empty($runprocess) && isset($CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'])) {
|
||||
$behatdir = $CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'] . '/behat';;
|
||||
} else {
|
||||
$behatdir = $CFG->behat_dataroot . $runprocess . '/behat';
|
||||
$behatdir = $CFG->behat_dataroot . '/behat';
|
||||
}
|
||||
|
||||
if (!is_dir($behatdir)) {
|
||||
@@ -218,17 +233,6 @@ class behat_command {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the parallel run file which specifies if parallel test environment is enabled
|
||||
* and how many parallel runs to execute.
|
||||
*
|
||||
* @param int $runprocess run process for which behat dir is returned.
|
||||
* @return string
|
||||
*/
|
||||
public final static function get_last_failed_test_status_file_path($runprocess = 0) {
|
||||
return self::get_behat_dir($runprocess) . '/lastfailed.txt';
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a message.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user