/// <summary>
        /// creates the correct runner according to the given type
        /// </summary>
        /// <param name="runType"></param>
        /// <param name="ciParams"></param>
        IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciParams)
        {
            IAssetRunner runner = null;

            switch (runType)
            {
            case TestStorageType.Alm:
                //check that all required parameters exist
                foreach (string param1 in requiredParamsForQcRun)
                {
                    if (!_ciParams.ContainsKey(param1))
                    {
                        ConsoleWriter.WriteLine(string.Format(Resources.LauncherParamRequired, param1));
                        return(null);
                    }
                }

                //parse params that need parsing
                double dblQcTimeout = int.MaxValue;
                if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
                    dblQcTimeout = int.MaxValue;
                }

                ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));

                QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
                if (!Enum.TryParse <QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
                    enmQcRunMode = QcRunMode.RUN_LOCAL;
                }
                ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

                //go over testsets in the parameters, and collect them
                List <string> sets = GetParamsWithPrefix("TestSet");

                if (sets.Count == 0)
                {
                    ConsoleWriter.WriteLine(Resources.LauncherNoTests);
                    return(null);
                }

                //create an Alm runner
                runner = new AlmTestSetsRunner(_ciParams["almServerUrl"],
                                               _ciParams["almUserName"],
                                               Decrypt(_ciParams["almPassword"], secretkey),
                                               _ciParams["almDomain"],
                                               _ciParams["almProject"],
                                               dblQcTimeout,
                                               enmQcRunMode,
                                               _ciParams["almRunHost"],
                                               sets);
                break;

            case TestStorageType.FileSystem:

                //get the tests
                IEnumerable <string> tests = GetParamsWithPrefix("Test");

                IEnumerable <string>        jenkinsEnvVariablesWithCommas = GetParamsWithPrefix("JenkinsEnv");
                Dictionary <string, string> jenkinsEnvVariables           = new Dictionary <string, string>();
                foreach (string var in jenkinsEnvVariablesWithCommas)
                {
                    string[] nameVal = var.Split(",;".ToCharArray());
                    jenkinsEnvVariables.Add(nameVal[0], nameVal[1]);
                }
                //parse the timeout into a TimeSpan
                TimeSpan timeout = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("fsTimeout"))
                {
                    string strTimoutInSeconds = _ciParams["fsTimeout"];
                    if (strTimoutInSeconds.Trim() != "-1")
                    {
                        int intTimoutInSeconds = 0;
                        int.TryParse(strTimoutInSeconds, out intTimoutInSeconds);
                        timeout = TimeSpan.FromSeconds(intTimoutInSeconds);
                    }
                }

                //LR specific values:
                //default values are set by JAVA code, in com.hp.application.automation.tools.model.RunFromFileSystemModel.java

                int pollingInterval = 30;
                if (_ciParams.ContainsKey("controllerPollingInterval"))
                {
                    pollingInterval = int.Parse(_ciParams["controllerPollingInterval"]);
                }

                TimeSpan perScenarioTimeOut = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("PerScenarioTimeOut"))
                {
                    string strTimoutInSeconds = _ciParams["PerScenarioTimeOut"];
                    if (strTimoutInSeconds.Trim() != "-1")
                    {
                        int intTimoutInSeconds = 0;
                        if (int.TryParse(strTimoutInSeconds, out intTimoutInSeconds))
                        {
                            perScenarioTimeOut = TimeSpan.FromMinutes(intTimoutInSeconds);
                        }
                    }
                }

                char[]        delim = { '\n' };
                List <string> ignoreErrorStrings = new List <string>();
                if (_ciParams.ContainsKey("ignoreErrorStrings"))
                {
                    ignoreErrorStrings.AddRange(_ciParams["ignoreErrorStrings"].Split(delim, StringSplitOptions.RemoveEmptyEntries));
                }


                if (tests == null || tests.Count() == 0)
                {
                    WriteToConsole(Resources.LauncherNoTestsFound);
                }

                List <string> validTests = Helper.ValidateFiles(tests);

                if (tests != null && tests.Count() > 0 && validTests.Count == 0)
                {
                    ConsoleWriter.WriteLine(Resources.LauncherNoValidTests);
                    return(null);
                }

                runner = new FileSystemTestsRunner(validTests, timeout, pollingInterval, perScenarioTimeOut, ignoreErrorStrings, jenkinsEnvVariables);

                break;

            default:
                runner = null;
                break;
            }
            return(runner);
        }
        /// <summary>
        /// creates the correct runner according to the given type
        /// </summary>
        /// <param name="runType"></param>
        /// <param name="ciParams"></param>
        IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciParams)
        {
            IAssetRunner runner = null;
            switch (runType)
            {
                case TestStorageType.Alm:
                    //check that all required parameters exist
                    foreach (string param1 in requiredParamsForQcRun)
                    {
                        if (!_ciParams.ContainsKey(param1))
                        {
                            ConsoleWriter.WriteLine(string.Format(Resources.LauncherParamRequired, param1));
                            return null;
                        }
                    }

                    //parse params that need parsing
                    double dblQcTimeout = int.MaxValue;
                    if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
                        dblQcTimeout = int.MaxValue;
                    }

                    ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));

                    QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
                    if (!Enum.TryParse<QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
                        enmQcRunMode = QcRunMode.RUN_LOCAL;
                    }
                    ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

                    //go over testsets in the parameters, and collect them
                    List<string> sets = GetParamsWithPrefix("TestSet");

                    if (sets.Count == 0)
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherNoTests);
                        return null;
                    }

                    //create an Alm runner
                    runner = new AlmTestSetsRunner(_ciParams["almServerUrl"],
                                     _ciParams["almUserName"],
                                     Decrypt(_ciParams["almPassword"], secretkey),
                                     _ciParams["almDomain"],
                                     _ciParams["almProject"],
                                     dblQcTimeout,
                                     enmQcRunMode,
                                     _ciParams["almRunHost"],
                                     sets);
                    break;
                case TestStorageType.FileSystem:

                    //get the tests
                    IEnumerable<string> tests = GetParamsWithPrefix("Test");

                    IEnumerable<string> jenkinsEnvVariablesWithCommas = GetParamsWithPrefix("JenkinsEnv");
                    Dictionary<string, string> jenkinsEnvVariables = new Dictionary<string,string>();
                    foreach (string var in jenkinsEnvVariablesWithCommas)
                    {
                        string[] nameVal = var.Split(",;".ToCharArray());
                        jenkinsEnvVariables.Add(nameVal[0], nameVal[1]);
                    }
                    //parse the timeout into a TimeSpan
                    TimeSpan timeout = TimeSpan.MaxValue;
                    if (_ciParams.ContainsKey("fsTimeout"))
                    {
                        string strTimoutInSeconds = _ciParams["fsTimeout"];
                        if (strTimoutInSeconds.Trim() != "-1")
                        {
                            int intTimoutInSeconds = 0;
                            int.TryParse(strTimoutInSeconds, out intTimoutInSeconds);
                            timeout = TimeSpan.FromSeconds(intTimoutInSeconds);
                        }
                    }
                    ConsoleWriter.WriteLine("Launcher timeout is " + timeout.ToString(@"dd\:\:hh\:mm\:ss"));

                    //LR specific values:
                    //default values are set by JAVA code, in com.hp.application.automation.tools.model.RunFromFileSystemModel.java

                    int pollingInterval = 30;
                    if (_ciParams.ContainsKey("controllerPollingInterval"))
                        pollingInterval = int.Parse(_ciParams["controllerPollingInterval"]);

                    TimeSpan perScenarioTimeOutMinutes = TimeSpan.MaxValue;
                    if (_ciParams.ContainsKey("PerScenarioTimeOut"))
                    {
                        string strTimoutInMinutes = _ciParams["PerScenarioTimeOut"];
                        ConsoleWriter.WriteLine("reading PerScenarioTimeout: "+strTimoutInMinutes);
                        if (strTimoutInMinutes.Trim() != "-1")
                        {
                            int intTimoutInMinutes = 0;
                            if (int.TryParse(strTimoutInMinutes, out intTimoutInMinutes))
                                perScenarioTimeOutMinutes = TimeSpan.FromMinutes(intTimoutInMinutes);
                            ConsoleWriter.WriteLine("PerScenarioTimeout: "+perScenarioTimeOutMinutes+" minutes");
                        }
                    }
                    ConsoleWriter.WriteLine("PerScenarioTimeout: " + perScenarioTimeOutMinutes.ToString(@"dd\:\:hh\:mm\:ss") + " minutes");

                    char[] delim = { '\n' };
                    List<string> ignoreErrorStrings = new List<string>();
                    if (_ciParams.ContainsKey("ignoreErrorStrings"))
                    {
                        ignoreErrorStrings.AddRange(_ciParams["ignoreErrorStrings"].Split(delim, StringSplitOptions.RemoveEmptyEntries));
                    }

                    if (tests == null || tests.Count() == 0)
                    {
                        WriteToConsole(Resources.LauncherNoTestsFound);
                    }

                    List<string> validTests = Helper.ValidateFiles(tests);

                    if (tests != null && tests.Count() > 0 && validTests.Count == 0)
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherNoValidTests);
                        return null;
                    }

                    //--MC connection info
                    McConnectionInfo mcConnectionInfo = new McConnectionInfo();
                    if (_ciParams.ContainsKey("MobileHostAddress"))
                    {
                        string mcServerUrl = _ciParams["MobileHostAddress"];

                        if (!string.IsNullOrEmpty(mcServerUrl) )
                        {
                            //url is something like http://xxx.xxx.xxx.xxx:8080
                            string[] strArray = mcServerUrl.Split(new Char[] { ':' });
                            if (strArray.Length == 3)
                            {
                                mcConnectionInfo.MobileHostAddress = strArray[1].Replace("/", "");
                                mcConnectionInfo.MobileHostPort = strArray[2];
                            }

                            //mc username
                            if (_ciParams.ContainsKey("MobileUserName"))
                            {
                                string mcUsername = _ciParams["MobileUserName"];
                                if (!string.IsNullOrEmpty(mcUsername))
                                {
                                    mcConnectionInfo.MobileUserName = mcUsername;
                                }
                            }

                            //mc password
                            if (_ciParams.ContainsKey("MobilePassword"))
                            {
                                string mcPassword = _ciParams["MobilePassword"];
                                if (!string.IsNullOrEmpty(mcPassword))
                                {
                                    mcConnectionInfo.MobilePassword = Decrypt(mcPassword, secretkey);
                                }
                            }

                            //ssl
                            if (_ciParams.ContainsKey("MobileUseSSL"))
                            {
                                string mcUseSSL = _ciParams["MobileUseSSL"];
                                if (!string.IsNullOrEmpty(mcUseSSL))
                                {
                                    mcConnectionInfo.MobileUseSSL = int.Parse(mcUseSSL);
                                }
                            }

                            //Proxy enabled flag
                            if (_ciParams.ContainsKey("MobileUseProxy"))
                            {
                                string useProxy = _ciParams["MobileUseProxy"];
                                if (!string.IsNullOrEmpty(useProxy))
                                {
                                    mcConnectionInfo.MobileUseProxy = int.Parse(useProxy);
                                }
                            }

                            //Proxy type
                            if (_ciParams.ContainsKey("MobileProxyType"))
                            {
                                string proxyType = _ciParams["MobileProxyType"];
                                if (!string.IsNullOrEmpty(proxyType))
                                {
                                    mcConnectionInfo.MobileProxyType = int.Parse(proxyType);
                                }
                            }

                            //proxy address
                            if (_ciParams.ContainsKey("MobileProxySetting_Address"))
                            {
                                string proxyAddress = _ciParams["MobileProxySetting_Address"];
                                if (!string.IsNullOrEmpty(proxyAddress))
                                {
                                    // data is something like "16.105.9.23:8080"
                                    string[] strArray4ProxyAddr = proxyAddress.Split(new Char[] { ':' });
                                    if (strArray.Length == 2)
                                    {
                                        mcConnectionInfo.MobileProxySetting_Address = strArray4ProxyAddr[0];
                                        mcConnectionInfo.MobileProxySetting_Port = int.Parse(strArray4ProxyAddr[1]);
                                    }
                                }
                            }

                            //Proxy authentication
                            if (_ciParams.ContainsKey("MobileProxySetting_Authentication"))
                            {
                                string proxyAuthentication = _ciParams["MobileProxySetting_Authentication"];
                                if (!string.IsNullOrEmpty(proxyAuthentication))
                                {
                                    mcConnectionInfo.MobileProxySetting_Authentication = int.Parse(proxyAuthentication);
                                }
                            }

                            //Proxy username
                            if (_ciParams.ContainsKey("MobileProxySetting_UserName"))
                            {
                                string proxyUsername = _ciParams["MobileProxySetting_UserName"];
                                if (!string.IsNullOrEmpty(proxyUsername))
                                {
                                    mcConnectionInfo.MobileProxySetting_UserName = proxyUsername;
                                }
                            }

                            //Proxy password
                            if (_ciParams.ContainsKey("MobileProxySetting_Password"))
                            {
                                string proxyPassword = _ciParams["MobileProxySetting_Password"];
                                if (!string.IsNullOrEmpty(proxyPassword))
                                {
                                    mcConnectionInfo.MobileProxySetting_Password = Decrypt(proxyPassword, secretkey);
                                }
                            }

                        }
                    }

                    // other mobile info
                    string mobileinfo = "";
                    if (_ciParams.ContainsKey("mobileinfo"))
                    {
                        mobileinfo = _ciParams["mobileinfo"];
                    }

                    runner = new FileSystemTestsRunner(validTests, timeout, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables, mcConnectionInfo, mobileinfo);

                    break;

                default:
                    runner = null;
                    break;
            }
            return runner;
        }
        /// <summary>
        /// creates the correct runner according to the given type
        /// </summary>
        /// <param name="runType"></param>
        /// <param name="ciParams"></param>
        /// <param name="initialTestRun"></param>
        private IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciParams, bool initialTestRun)
        {
            IAssetRunner runner = null;

            switch (runType)
            {
            case TestStorageType.Alm:
                //check that all required parameters exist
                foreach (string param1 in requiredParamsForQcRun)
                {
                    if (!_ciParams.ContainsKey(param1))
                    {
                        ConsoleWriter.WriteLine(string.Format(Resources.LauncherParamRequired, param1));
                        return(null);
                    }
                }

                //parse params that need parsing
                double dblQcTimeout = int.MaxValue;
                if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
                    dblQcTimeout = int.MaxValue;
                }

                ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));

                QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
                if (!Enum.TryParse <QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
                    enmQcRunMode = QcRunMode.RUN_LOCAL;
                }
                ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

                //go over test sets in the parameters, and collect them
                List <string> sets = GetParamsWithPrefix("TestSet");

                if (sets.Count == 0)
                {
                    ConsoleWriter.WriteLine(Resources.LauncherNoTests);
                    return(null);
                }

                //check if filterTests flag is selected; if yes apply filters on the list

                bool   isFilterSelected;
                string filter = _ciParams.ContainsKey("FilterTests") ? _ciParams["FilterTests"] : "";

                isFilterSelected = !string.IsNullOrEmpty(filter) && Convert.ToBoolean(filter.ToLower());

                string filterByName = _ciParams.ContainsKey("FilterByName") ? _ciParams["FilterByName"] : "";

                string statuses = _ciParams.ContainsKey("FilterByStatus") ? _ciParams["FilterByStatus"] : "";

                List <string> filterByStatuses = new List <string>();

                if (statuses != "")
                {
                    if (statuses.Contains(","))
                    {
                        filterByStatuses = statuses.Split(',').ToList();
                    }
                    else
                    {
                        filterByStatuses.Add(statuses);
                    }
                }

                bool isSSOEnabled = _ciParams.ContainsKey("SSOEnabled") && Convert.ToBoolean(_ciParams["SSOEnabled"]);

                //create an Alm runner
                runner = new AlmTestSetsRunner(_ciParams["almServerUrl"],
                                               _ciParams["almUserName"],
                                               Decrypt(_ciParams["almPassword"], _secretKey),
                                               _ciParams["almDomain"],
                                               _ciParams["almProject"],
                                               dblQcTimeout,
                                               enmQcRunMode,
                                               _ciParams["almRunHost"],
                                               sets,
                                               isFilterSelected,
                                               filterByName,
                                               filterByStatuses,
                                               initialTestRun,
                                               TestStorageType.Alm,
                                               isSSOEnabled,
                                               _ciParams["almClientID"], Decrypt(_ciParams["almApiKey"], _secretKey));
                break;

            case TestStorageType.FileSystem:
                bool displayController = false;
                if (_ciParams.ContainsKey("displayController"))
                {
                    if (_ciParams["displayController"] == "1")
                    {
                        displayController = true;
                    }
                }
                string analysisTemplate = (_ciParams.ContainsKey("analysisTemplate") ? _ciParams["analysisTemplate"] : "");

                List <TestData> validBuildTests = GetValidTests("Test", Resources.LauncherNoTestsFound, Resources.LauncherNoValidTests);

                //add build tests and cleanup tests in correct order
                List <TestData> validTests = new List <TestData>();

                if (!_rerunFailedTests)
                {
                    ConsoleWriter.WriteLine("Run build tests");

                    //run only the build tests
                    foreach (var item in validBuildTests)
                    {
                        validTests.Add(item);
                    }
                }
                else
                {     //add also cleanup tests
                    string fsTestType = (_ciParams.ContainsKey("testType") ? _ciParams["testType"] : "");

                    List <TestData> validFailedTests  = GetValidTests("FailedTest", Resources.LauncherNoFailedTestsFound, Resources.LauncherNoValidFailedTests);
                    List <TestData> validCleanupTests = new List <TestData>();
                    if (GetValidTests("CleanupTest", Resources.LauncherNoCleanupTestsFound, Resources.LauncherNoValidCleanupTests).Count > 0)
                    {
                        validCleanupTests = GetValidTests("CleanupTest", Resources.LauncherNoCleanupTestsFound, Resources.LauncherNoValidCleanupTests);
                    }
                    List <string> reruns         = GetParamsWithPrefix("Reruns");
                    List <int>    numberOfReruns = new List <int>();
                    foreach (var item in reruns)
                    {
                        numberOfReruns.Add(int.Parse(item));
                    }

                    bool noRerunsSet = CheckListOfRerunValues(numberOfReruns);

                    if (noRerunsSet)
                    {
                        ConsoleWriter.WriteLine("In order to rerun the tests the number of reruns should be greater than zero.");
                    }
                    else
                    {
                        for (int i = 0; i < numberOfReruns.Count; i++)
                        {
                            var currentRerun = numberOfReruns.ElementAt(i);

                            if (fsTestType.Equals("Of any of the build's tests"))
                            {
                                ConsoleWriter.WriteLine("Rerun the entire test set");
                                while (currentRerun > 0)
                                {
                                    if (validCleanupTests.Count > 0)
                                    {
                                        validTests.Add(validCleanupTests.ElementAt(i));
                                    }

                                    foreach (var item in validFailedTests)
                                    {
                                        validTests.Add(item);
                                    }

                                    currentRerun--;
                                }
                            }
                            else
                            {
                                while (currentRerun > 0)
                                {
                                    if (validCleanupTests.Count > 0)
                                    {
                                        validTests.Add(validCleanupTests.ElementAt(i));
                                    }

                                    validTests.Add(validFailedTests.ElementAt(i));

                                    currentRerun--;
                                }
                            }
                        }
                    }
                }

                //get the tests
                //IEnumerable<string> tests = GetParamsWithPrefix("Test");

                IEnumerable <string>        jenkinsEnvVariablesWithCommas = GetParamsWithPrefix("JenkinsEnv");
                Dictionary <string, string> jenkinsEnvVariables           = new Dictionary <string, string>();
                foreach (string var in jenkinsEnvVariablesWithCommas)
                {
                    string[] nameVal = var.Split(",;".ToCharArray());
                    jenkinsEnvVariables.Add(nameVal[0], nameVal[1]);
                }
                //parse the timeout into a TimeSpan
                TimeSpan timeout = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("fsTimeout"))
                {
                    string strTimeoutInSeconds = _ciParams["fsTimeout"];
                    if (strTimeoutInSeconds.Trim() != "-1")
                    {
                        int intTimeoutInSeconds = 0;
                        int.TryParse(strTimeoutInSeconds, out intTimeoutInSeconds);
                        timeout = TimeSpan.FromSeconds(intTimeoutInSeconds);
                    }
                }
                ConsoleWriter.WriteLine("Launcher timeout is " + timeout.ToString(@"dd\:\:hh\:mm\:ss"));

                //LR specific values:
                //default values are set by JAVA code, in com.hpe.application.automation.tools.model.RunFromFileSystemModel.java

                int pollingInterval = 30;
                if (_ciParams.ContainsKey("controllerPollingInterval"))
                {
                    pollingInterval = int.Parse(_ciParams["controllerPollingInterval"]);
                }
                ConsoleWriter.WriteLine("Controller Polling Interval: " + pollingInterval + " seconds");

                TimeSpan perScenarioTimeOutMinutes = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("PerScenarioTimeOut"))
                {
                    string strTimeoutInMinutes = _ciParams["PerScenarioTimeOut"];
                    //ConsoleWriter.WriteLine("reading PerScenarioTimeout: "+ strTimoutInMinutes);
                    if (strTimeoutInMinutes.Trim() != "-1")
                    {
                        int intTimoutInMinutes = 0;
                        if (int.TryParse(strTimeoutInMinutes, out intTimoutInMinutes))
                        {
                            perScenarioTimeOutMinutes = TimeSpan.FromMinutes(intTimoutInMinutes);
                        }
                        //ConsoleWriter.WriteLine("PerScenarioTimeout: "+perScenarioTimeOutMinutes+" minutes");
                    }
                }
                ConsoleWriter.WriteLine("PerScenarioTimeout: " + perScenarioTimeOutMinutes.ToString(@"dd\:\:hh\:mm\:ss") + " minutes");

                char[]        delimiter          = { '\n' };
                List <string> ignoreErrorStrings = new List <string>();
                if (_ciParams.ContainsKey("ignoreErrorStrings"))
                {
                    if (_ciParams.ContainsKey("ignoreErrorStrings"))
                    {
                        ignoreErrorStrings.AddRange(Array.ConvertAll(_ciParams["ignoreErrorStrings"].Split(delimiter, StringSplitOptions.RemoveEmptyEntries), ignoreError => ignoreError.Trim()));
                    }
                }

                //If a file path was provided and it doesn't exist stop the analysis launcher
                if (!analysisTemplate.Equals("") && !Helper.FileExists(analysisTemplate))
                {
                    return(null);
                }

                //--MC connection info
                McConnectionInfo mcConnectionInfo = new McConnectionInfo();
                if (_ciParams.ContainsKey("MobileHostAddress"))
                {
                    string mcServerUrl = _ciParams["MobileHostAddress"];

                    if (!string.IsNullOrEmpty(mcServerUrl))
                    {
                        //url is something like http://xxx.xxx.xxx.xxx:8080
                        string[] strArray = mcServerUrl.Split(new Char[] { ':' });
                        if (strArray.Length == 3)
                        {
                            mcConnectionInfo.MobileHostAddress = strArray[1].Replace("/", "");
                            mcConnectionInfo.MobileHostPort    = strArray[2];
                        }

                        //mc username
                        if (_ciParams.ContainsKey("MobileUserName"))
                        {
                            string mcUsername = _ciParams["MobileUserName"];
                            if (!string.IsNullOrEmpty(mcUsername))
                            {
                                mcConnectionInfo.MobileUserName = mcUsername;
                            }
                        }

                        //mc password
                        if (_ciParams.ContainsKey("MobilePassword"))
                        {
                            string mcPassword = _ciParams["MobilePassword"];
                            if (!string.IsNullOrEmpty(mcPassword))
                            {
                                mcConnectionInfo.MobilePassword = Decrypt(mcPassword, _secretKey);
                            }
                        }

                        //mc tenantId
                        if (_ciParams.ContainsKey("MobileTenantId"))
                        {
                            string mcTenantId = _ciParams["MobileTenantId"];
                            if (!string.IsNullOrEmpty(mcTenantId))
                            {
                                mcConnectionInfo.MobileTenantId = mcTenantId;
                            }
                        }


                        //ssl
                        if (_ciParams.ContainsKey("MobileUseSSL"))
                        {
                            string mcUseSSL = _ciParams["MobileUseSSL"];
                            if (!string.IsNullOrEmpty(mcUseSSL))
                            {
                                mcConnectionInfo.MobileUseSSL = int.Parse(mcUseSSL);
                            }
                        }

                        //Proxy enabled flag
                        if (_ciParams.ContainsKey("MobileUseProxy"))
                        {
                            string useProxy = _ciParams["MobileUseProxy"];
                            if (!string.IsNullOrEmpty(useProxy))
                            {
                                mcConnectionInfo.MobileUseProxy = int.Parse(useProxy);
                            }
                        }


                        //Proxy type
                        if (_ciParams.ContainsKey("MobileProxyType"))
                        {
                            string proxyType = _ciParams["MobileProxyType"];
                            if (!string.IsNullOrEmpty(proxyType))
                            {
                                mcConnectionInfo.MobileProxyType = int.Parse(proxyType);
                            }
                        }


                        //proxy address
                        if (_ciParams.ContainsKey("MobileProxySetting_Address"))
                        {
                            string proxyAddress = _ciParams["MobileProxySetting_Address"];
                            if (!string.IsNullOrEmpty(proxyAddress))
                            {
                                // data is something like "16.105.9.23:8080"
                                string[] strArrayForProxyAddress = proxyAddress.Split(new Char[] { ':' });

                                if (strArrayForProxyAddress.Length == 2)
                                {
                                    mcConnectionInfo.MobileProxySetting_Address = strArrayForProxyAddress[0];
                                    mcConnectionInfo.MobileProxySetting_Port    = int.Parse(strArrayForProxyAddress[1]);
                                }
                            }
                        }

                        //Proxy authentication
                        if (_ciParams.ContainsKey("MobileProxySetting_Authentication"))
                        {
                            string proxyAuthentication = _ciParams["MobileProxySetting_Authentication"];
                            if (!string.IsNullOrEmpty(proxyAuthentication))
                            {
                                mcConnectionInfo.MobileProxySetting_Authentication = int.Parse(proxyAuthentication);
                            }
                        }

                        //Proxy username
                        if (_ciParams.ContainsKey("MobileProxySetting_UserName"))
                        {
                            string proxyUsername = _ciParams["MobileProxySetting_UserName"];
                            if (!string.IsNullOrEmpty(proxyUsername))
                            {
                                mcConnectionInfo.MobileProxySetting_UserName = proxyUsername;
                            }
                        }

                        //Proxy password
                        if (_ciParams.ContainsKey("MobileProxySetting_Password"))
                        {
                            string proxyPassword = _ciParams["MobileProxySetting_Password"];
                            if (!string.IsNullOrEmpty(proxyPassword))
                            {
                                mcConnectionInfo.MobileProxySetting_Password = Decrypt(proxyPassword, _secretKey);
                            }
                        }
                    }
                }

                // other mobile info
                string mobileinfo = "";
                if (_ciParams.ContainsKey("mobileinfo"))
                {
                    mobileinfo = _ciParams["mobileinfo"];
                }

                Dictionary <string, List <String> > parallelRunnerEnvironments = new Dictionary <string, List <string> >();

                // retrieve the parallel runner environment for each test
                if (_ciParams.ContainsKey("parallelRunnerMode"))
                {
                    foreach (var test in validTests)
                    {
                        string        envKey           = "Parallel" + test.Id + "Env";
                        List <string> testEnvironments = GetParamsWithPrefix(envKey);

                        // add the environments for all the valid tests
                        parallelRunnerEnvironments.Add(test.Id, testEnvironments);
                    }
                }

                // users can provide a custom report path
                string reportPath = null;
                if (_ciParams.ContainsKey("fsReportPath"))
                {
                    reportPath = _ciParams["fsReportPath"];
                }

                SummaryDataLogger     summaryDataLogger = GetSummaryDataLogger();
                List <ScriptRTSModel> scriptRTSSet      = GetScriptRtsSet();
                if (_ciParams.ContainsKey("fsUftRunMode"))
                {
                    string uftRunMode = "Fast";
                    uftRunMode = _ciParams["fsUftRunMode"];
                    runner     = new FileSystemTestsRunner(validTests, timeout, uftRunMode, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables, mcConnectionInfo, mobileinfo, parallelRunnerEnvironments, displayController, analysisTemplate, summaryDataLogger, scriptRTSSet, reportPath);
                }
                else
                {
                    runner = new FileSystemTestsRunner(validTests, timeout, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables, mcConnectionInfo, mobileinfo, parallelRunnerEnvironments, displayController, analysisTemplate, summaryDataLogger, scriptRTSSet, reportPath);
                }

                break;

            default:
                runner = null;
                break;
            }
            return(runner);
        }
Example #4
0
        /// <summary>
        /// creates the correct runner according to the given type
        /// </summary>
        /// <param name="runType"></param>
        /// <param name="ciParams"></param>
        IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciParams)
        {
            IAssetRunner runner = null;

            switch (runType)
            {
            case TestStorageType.Alm:
                //check that all required parameters exist
                foreach (string param1 in requiredParamsForQcRun)
                {
                    if (!_ciParams.ContainsKey(param1))
                    {
                        ConsoleWriter.WriteLine(string.Format(Resources.LauncherParamRequired, param1));
                        return(null);
                    }
                }

                //parse params that need parsing
                double dblQcTimeout = int.MaxValue;
                if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
                    dblQcTimeout = int.MaxValue;
                }

                ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));

                QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
                if (!Enum.TryParse <QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
                {
                    ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
                    enmQcRunMode = QcRunMode.RUN_LOCAL;
                }
                ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

                //go over testsets in the parameters, and collect them
                List <string> sets = GetParamsWithPrefix("TestSet");

                if (sets.Count == 0)
                {
                    ConsoleWriter.WriteLine(Resources.LauncherNoTests);
                    return(null);
                }

                //create an Alm runner
                runner = new AlmTestSetsRunner(_ciParams["almServerUrl"],
                                               _ciParams["almUserName"],
                                               Decrypt(_ciParams["almPassword"], secretkey),
                                               _ciParams["almDomain"],
                                               _ciParams["almProject"],
                                               dblQcTimeout,
                                               enmQcRunMode,
                                               _ciParams["almRunHost"],
                                               sets);
                break;

            case TestStorageType.FileSystem:
                //Get displayController var
                bool displayController = false;
                if (_ciParams.ContainsKey("displayController"))
                {
                    if (_ciParams["displayController"] == "1")
                    {
                        displayController = true;
                    }
                }
                string analysisTemplate = (_ciParams.ContainsKey("analysisTemplate") ? _ciParams["analysisTemplate"] : "");

                Dictionary <string, string> testsKeyValue = GetKeyValuesWithPrefix("Test");
                List <TestData>             tests         = new List <TestData>();

                foreach (var item in testsKeyValue)
                {
                    tests.Add(new TestData(item.Value, item.Key));
                }

                //get the tests
                //IEnumerable<string> tests = GetParamsWithPrefix("Test");

                IEnumerable <string>        jenkinsEnvVariablesWithCommas = GetParamsWithPrefix("JenkinsEnv");
                Dictionary <string, string> jenkinsEnvVariables           = new Dictionary <string, string>();
                foreach (string var in jenkinsEnvVariablesWithCommas)
                {
                    string[] nameVal = var.Split(",;".ToCharArray());
                    jenkinsEnvVariables.Add(nameVal[0], nameVal[1]);
                }
                //parse the timeout into a TimeSpan
                TimeSpan timeout = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("fsTimeout"))
                {
                    string strTimoutInSeconds = _ciParams["fsTimeout"];
                    if (strTimoutInSeconds.Trim() != "-1")
                    {
                        int intTimoutInSeconds = 0;
                        int.TryParse(strTimoutInSeconds, out intTimoutInSeconds);
                        timeout = TimeSpan.FromSeconds(intTimoutInSeconds);
                    }
                }
                ConsoleWriter.WriteLine("Launcher timeout is " + timeout.ToString(@"dd\:\:hh\:mm\:ss"));

                //LR specific values:
                //default values are set by JAVA code, in com.hpe.application.automation.tools.model.RunFromFileSystemModel.java

                int pollingInterval = 30;
                if (_ciParams.ContainsKey("controllerPollingInterval"))
                {
                    pollingInterval = int.Parse(_ciParams["controllerPollingInterval"]);
                }
                ConsoleWriter.WriteLine("Controller Polling Interval: " + pollingInterval + " seconds");

                TimeSpan perScenarioTimeOutMinutes = TimeSpan.MaxValue;
                if (_ciParams.ContainsKey("PerScenarioTimeOut"))
                {
                    string strTimoutInMinutes = _ciParams["PerScenarioTimeOut"];
                    //ConsoleWriter.WriteLine("reading PerScenarioTimeout: "+ strTimoutInMinutes);
                    if (strTimoutInMinutes.Trim() != "-1")
                    {
                        int intTimoutInMinutes = 0;
                        if (int.TryParse(strTimoutInMinutes, out intTimoutInMinutes))
                        {
                            perScenarioTimeOutMinutes = TimeSpan.FromMinutes(intTimoutInMinutes);
                        }
                        //ConsoleWriter.WriteLine("PerScenarioTimeout: "+perScenarioTimeOutMinutes+" minutes");
                    }
                }
                ConsoleWriter.WriteLine("PerScenarioTimeout: " + perScenarioTimeOutMinutes.ToString(@"dd\:\:hh\:mm\:ss") + " minutes");

                char[]        delim = { '\n' };
                List <string> ignoreErrorStrings = new List <string>();
                if (_ciParams.ContainsKey("ignoreErrorStrings"))
                {
                    if (_ciParams.ContainsKey("ignoreErrorStrings"))
                    {
                        ignoreErrorStrings.AddRange(Array.ConvertAll(_ciParams["ignoreErrorStrings"].Split(delim, StringSplitOptions.RemoveEmptyEntries), ignoreError => ignoreError.Trim()));
                    }
                }

                if (tests == null || tests.Count() == 0)
                {
                    WriteToConsole(Resources.LauncherNoTestsFound);
                }

                List <TestData> validTests = Helper.ValidateFiles(tests);

                if (tests != null && tests.Count() > 0 && validTests.Count == 0)
                {
                    ConsoleWriter.WriteLine(Resources.LauncherNoValidTests);
                    return(null);
                }

                //If a file path was provided and it doesn't exist stop the analysis launcher
                if (!analysisTemplate.Equals("") && !Helper.FileExists(analysisTemplate))
                {
                    return(null);
                }

                //--MC connection info
                McConnectionInfo mcConnectionInfo = new McConnectionInfo();
                if (_ciParams.ContainsKey("MobileHostAddress"))
                {
                    string mcServerUrl = _ciParams["MobileHostAddress"];

                    if (!string.IsNullOrEmpty(mcServerUrl))
                    {
                        //url is something like http://xxx.xxx.xxx.xxx:8080
                        string[] strArray = mcServerUrl.Split(new Char[] { ':' });
                        if (strArray.Length == 3)
                        {
                            mcConnectionInfo.MobileHostAddress = strArray[1].Replace("/", "");
                            mcConnectionInfo.MobileHostPort    = strArray[2];
                        }

                        //mc username
                        if (_ciParams.ContainsKey("MobileUserName"))
                        {
                            string mcUsername = _ciParams["MobileUserName"];
                            if (!string.IsNullOrEmpty(mcUsername))
                            {
                                mcConnectionInfo.MobileUserName = mcUsername;
                            }
                        }

                        //mc password
                        if (_ciParams.ContainsKey("MobilePassword"))
                        {
                            string mcPassword = _ciParams["MobilePassword"];
                            if (!string.IsNullOrEmpty(mcPassword))
                            {
                                mcConnectionInfo.MobilePassword = Decrypt(mcPassword, secretkey);
                            }
                        }

                        //mc tenantId
                        if (_ciParams.ContainsKey("MobileTenantId"))
                        {
                            string mcTenantId = _ciParams["MobileTenantId"];
                            if (!string.IsNullOrEmpty(mcTenantId))
                            {
                                mcConnectionInfo.MobileTenantId = mcTenantId;
                            }
                        }


                        //ssl
                        if (_ciParams.ContainsKey("MobileUseSSL"))
                        {
                            string mcUseSSL = _ciParams["MobileUseSSL"];
                            if (!string.IsNullOrEmpty(mcUseSSL))
                            {
                                mcConnectionInfo.MobileUseSSL = int.Parse(mcUseSSL);
                            }
                        }

                        //Proxy enabled flag
                        if (_ciParams.ContainsKey("MobileUseProxy"))
                        {
                            string useProxy = _ciParams["MobileUseProxy"];
                            if (!string.IsNullOrEmpty(useProxy))
                            {
                                mcConnectionInfo.MobileUseProxy = int.Parse(useProxy);
                            }
                        }


                        //Proxy type
                        if (_ciParams.ContainsKey("MobileProxyType"))
                        {
                            string proxyType = _ciParams["MobileProxyType"];
                            if (!string.IsNullOrEmpty(proxyType))
                            {
                                mcConnectionInfo.MobileProxyType = int.Parse(proxyType);
                            }
                        }


                        //proxy address
                        if (_ciParams.ContainsKey("MobileProxySetting_Address"))
                        {
                            string proxyAddress = _ciParams["MobileProxySetting_Address"];
                            if (!string.IsNullOrEmpty(proxyAddress))
                            {
                                // data is something like "16.105.9.23:8080"
                                string[] strArray4ProxyAddr = proxyAddress.Split(new Char[] { ':' });

                                if (strArray4ProxyAddr.Length == 2)
                                {
                                    mcConnectionInfo.MobileProxySetting_Address = strArray4ProxyAddr[0];
                                    mcConnectionInfo.MobileProxySetting_Port    = int.Parse(strArray4ProxyAddr[1]);
                                }
                            }
                        }

                        //Proxy authentication
                        if (_ciParams.ContainsKey("MobileProxySetting_Authentication"))
                        {
                            string proxyAuthentication = _ciParams["MobileProxySetting_Authentication"];
                            if (!string.IsNullOrEmpty(proxyAuthentication))
                            {
                                mcConnectionInfo.MobileProxySetting_Authentication = int.Parse(proxyAuthentication);
                            }
                        }

                        //Proxy username
                        if (_ciParams.ContainsKey("MobileProxySetting_UserName"))
                        {
                            string proxyUsername = _ciParams["MobileProxySetting_UserName"];
                            if (!string.IsNullOrEmpty(proxyUsername))
                            {
                                mcConnectionInfo.MobileProxySetting_UserName = proxyUsername;
                            }
                        }

                        //Proxy password
                        if (_ciParams.ContainsKey("MobileProxySetting_Password"))
                        {
                            string proxyPassword = _ciParams["MobileProxySetting_Password"];
                            if (!string.IsNullOrEmpty(proxyPassword))
                            {
                                mcConnectionInfo.MobileProxySetting_Password = Decrypt(proxyPassword, secretkey);
                            }
                        }
                    }
                }

                // other mobile info
                string mobileinfo = "";
                if (_ciParams.ContainsKey("mobileinfo"))
                {
                    mobileinfo = _ciParams["mobileinfo"];
                }

                Dictionary <string, List <String> > parallelRunnerEnvironments = new Dictionary <string, List <string> >();

                // retrieve the parallel runner environment for each test
                if (_ciParams.ContainsKey("parallelRunnerMode"))
                {
                    foreach (var test in validTests)
                    {
                        string        envKey           = "Parallel" + test.Id + "Env";
                        List <string> testEnvironments = GetParamsWithPrefix(envKey);

                        // add the environments for all the valid tests
                        parallelRunnerEnvironments.Add(test.Id, testEnvironments);
                    }
                }

                if (_ciParams.ContainsKey("fsUftRunMode"))
                {
                    string uftRunMode = "Fast";
                    uftRunMode = _ciParams["fsUftRunMode"];
                    runner     = new FileSystemTestsRunner(validTests, timeout, uftRunMode, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables, mcConnectionInfo, mobileinfo, parallelRunnerEnvironments, displayController, analysisTemplate);
                }
                else
                {
                    runner = new FileSystemTestsRunner(validTests, timeout, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables, mcConnectionInfo, mobileinfo, parallelRunnerEnvironments, displayController, analysisTemplate);
                }

                break;

            default:
                runner = null;
                break;
            }
            return(runner);
        }
        /// <summary>
        /// creates the correct runner according to the given type
        /// </summary>
        /// <param name="runType"></param>
        /// <param name="ciParams"></param>
        IAssetRunner CreateRunner(TestStorageType runType, JavaProperties ciParams)
        {
            IAssetRunner runner = null;
            switch (runType)
            {
                case TestStorageType.Alm:
                    //check that all required parameters exist
                    foreach (string param1 in requiredParamsForQcRun)
                    {
                        if (!_ciParams.ContainsKey(param1))
                        {
                            ConsoleWriter.WriteLine(string.Format(Resources.LauncherParamRequired, param1));
                            return null;
                        }
                    }

                    //parse params that need parsing
                    double dblQcTimeout = int.MaxValue;
                    if (!double.TryParse(_ciParams["almTimeout"], out dblQcTimeout))
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherTimeoutNotNumeric);
                        dblQcTimeout = int.MaxValue;
                    }

                    ConsoleWriter.WriteLine(string.Format(Resources.LuancherDisplayTimout, dblQcTimeout));

                    QcRunMode enmQcRunMode = QcRunMode.RUN_LOCAL;
                    if (!Enum.TryParse<QcRunMode>(_ciParams["almRunMode"], true, out enmQcRunMode))
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherIncorrectRunmode);
                        enmQcRunMode = QcRunMode.RUN_LOCAL;
                    }
                    ConsoleWriter.WriteLine(string.Format(Resources.LauncherDisplayRunmode, enmQcRunMode.ToString()));

                    //go over testsets in the parameters, and collect them
                    List<string> sets = GetParamsWithPrefix("TestSet");

                    if (sets.Count == 0)
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherNoTests);
                        return null;
                    }

                    //create an Alm runner
                    runner = new AlmTestSetsRunner(_ciParams["almServerUrl"],
                                     _ciParams["almUserName"],
                                     Decrypt(_ciParams["almPassword"], secretkey),
                                     _ciParams["almDomain"],
                                     _ciParams["almProject"],
                                     dblQcTimeout,
                                     enmQcRunMode,
                                     _ciParams["almRunHost"],
                                     sets);
                    break;
                case TestStorageType.FileSystem:

                    //get the tests
                    IEnumerable<string> tests = GetParamsWithPrefix("Test");

                    IEnumerable<string> jenkinsEnvVariablesWithCommas = GetParamsWithPrefix("JenkinsEnv");
                    Dictionary<string, string> jenkinsEnvVariables = new Dictionary<string,string>();
                    foreach (string var in jenkinsEnvVariablesWithCommas)
                    { 
                        string[] nameVal = var.Split(",;".ToCharArray());
                        jenkinsEnvVariables.Add(nameVal[0], nameVal[1]);
                    }
                    //parse the timeout into a TimeSpan
                    TimeSpan timeout = TimeSpan.MaxValue;
                    if (_ciParams.ContainsKey("fsTimeout"))
                    {
                        string strTimoutInSeconds = _ciParams["fsTimeout"];
                        if (strTimoutInSeconds.Trim() != "-1")
                        {
                            int intTimoutInSeconds = 0;
                            int.TryParse(strTimoutInSeconds, out intTimoutInSeconds);
                            timeout = TimeSpan.FromSeconds(intTimoutInSeconds);
                        }
                    }
                    ConsoleWriter.WriteLine("Launcher timeout is " + timeout.ToString(@"dd\:\:hh\:mm\:ss"));

                    //LR specific values:
                    //default values are set by JAVA code, in com.hp.application.automation.tools.model.RunFromFileSystemModel.java

                    int pollingInterval = 30;
                    if (_ciParams.ContainsKey("controllerPollingInterval"))
                        pollingInterval = int.Parse(_ciParams["controllerPollingInterval"]);

                    TimeSpan perScenarioTimeOutMinutes = TimeSpan.MaxValue;
                    if (_ciParams.ContainsKey("PerScenarioTimeOut"))
                    {
                        string strTimoutInMinutes = _ciParams["PerScenarioTimeOut"];
                        ConsoleWriter.WriteLine("reading PerScenarioTimeout: "+strTimoutInMinutes);
                        if (strTimoutInMinutes.Trim() != "-1")
                        {
                            int intTimoutInMinutes = 0;
                            if (int.TryParse(strTimoutInMinutes, out intTimoutInMinutes))
                                perScenarioTimeOutMinutes = TimeSpan.FromMinutes(intTimoutInMinutes);
                            ConsoleWriter.WriteLine("PerScenarioTimeout: "+perScenarioTimeOutMinutes+" minutes");
                        }
                    }
                    ConsoleWriter.WriteLine("PerScenarioTimeout: " + perScenarioTimeOutMinutes.ToString(@"dd\:\:hh\:mm\:ss") + " minutes");

                    char[] delim = { '\n' };
                    List<string> ignoreErrorStrings = new List<string>();
                    if (_ciParams.ContainsKey("ignoreErrorStrings"))
                    {
                        ignoreErrorStrings.AddRange(_ciParams["ignoreErrorStrings"].Split(delim, StringSplitOptions.RemoveEmptyEntries));
                    }

                    
                    if (tests == null || tests.Count() == 0)
                    {
                        WriteToConsole(Resources.LauncherNoTestsFound);
                    }

                    List<string> validTests = Helper.ValidateFiles(tests);

                    if (tests != null && tests.Count() > 0 && validTests.Count == 0)
                    {
                        ConsoleWriter.WriteLine(Resources.LauncherNoValidTests);
                        return null;
                    }

                    runner = new FileSystemTestsRunner(validTests, timeout, pollingInterval, perScenarioTimeOutMinutes, ignoreErrorStrings, jenkinsEnvVariables);

                    break;

                default:
                    runner = null;
                    break;
            }
            return runner;
        }