// determines test cases, gets spec file from test cases attribute or from command line and // starts parsing of the spec file. // SpecFile passed as a parameter in the command line overrides local spec file defined in the attribute protected virtual void DetermineTestCases() { try { _parseError = null; // get control file string cmdSpecFile = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_SPEC_LTM_KEY)) { cmdSpecFile = (string)CModCmdLine.CmdLine[CMD_SPEC_LTM_KEY]; } // get max priority string[] tmp1 = null; string[] tmp2 = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_PRIORITY_FILTER_LTM_KEY)) { tmp1 = new string[] { BuildFilterFromMaxPriority((string)CModCmdLine.CmdLine[CMD_PRIORITY_FILTER_LTM_KEY]) } } ; if (CModCmdLine.CmdLine.ContainsKey(CMD_FILTER_LTM_KEY)) { tmp2 = new string[] { (string)CModCmdLine.CmdLine[CMD_FILTER_LTM_KEY] } } ; string[] cmdFilters = (string[])CombineArrays(tmp1, tmp2); // get default section string cmdDefaultSection = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_SPEC_DEFAULT_SECTION)) { cmdDefaultSection = (string)CModCmdLine.CmdLine[CMD_SPEC_DEFAULT_SECTION]; } XmlDriverScenario XmlReaderScenario = new XmlDriverScenario("XmlReader", "ReaderCreateSpec.xml"); XmlDriverScenario XmlWriterScenario = new XmlDriverScenario("XmlWriter", "WriterCreateSpec.xml"); List <XmlDriverScenario> slist = new List <XmlDriverScenario>(); slist.Add(XmlReaderScenario); slist.Add(XmlWriterScenario); foreach (XmlDriverScenario scenarioAttr in slist) { string specFile = (cmdSpecFile == null) ? scenarioAttr.ControlFile : cmdSpecFile; string name = scenarioAttr.Name; string[] filters = (string[])CombineArrays(cmdFilters, scenarioAttr.Filters); string defaultSection = (cmdDefaultSection == null) ? scenarioAttr.DefaultSection : cmdDefaultSection; if (specFile == null || specFile == string.Empty) { throw new CXmlDriverException("Control File is not defined for TestCase \"" + scenarioAttr.Desc + "\""); } // parse spec file and update testModule's param list ParseControlFile(name, specFile, filters, defaultSection, null, null, _testModuleParams); } } catch (Exception e) { HandleException(e); } }
// determines test cases, gets spec file from test cases attribute or from command line and // starts parsing of the spec file. // SpecFile passed as a parameter in the command line overrides local spec file defined in the attribute protected virtual void DetermineTestCases() { try { _parseError = null; // get control file string cmdSpecFile = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_SPEC_LTM_KEY)) cmdSpecFile = (string)CModCmdLine.CmdLine[CMD_SPEC_LTM_KEY]; // get max priority string[] tmp1 = null; string[] tmp2 = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_PRIORITY_FILTER_LTM_KEY)) tmp1 = new string[] { BuildFilterFromMaxPriority((string)CModCmdLine.CmdLine[CMD_PRIORITY_FILTER_LTM_KEY]) }; if (CModCmdLine.CmdLine.ContainsKey(CMD_FILTER_LTM_KEY)) tmp2 = new string[] { (string)CModCmdLine.CmdLine[CMD_FILTER_LTM_KEY] }; string[] cmdFilters = (string[])CombineArrays(tmp1, tmp2); // get default section string cmdDefaultSection = null; if (CModCmdLine.CmdLine.ContainsKey(CMD_SPEC_DEFAULT_SECTION)) cmdDefaultSection = (string)CModCmdLine.CmdLine[CMD_SPEC_DEFAULT_SECTION]; XmlDriverScenario XmlReaderScenario = new XmlDriverScenario("XmlReader", "ReaderCreateSpec.xml"); XmlDriverScenario XmlWriterScenario = new XmlDriverScenario("XmlWriter", "WriterCreateSpec.xml"); List<XmlDriverScenario> slist = new List<XmlDriverScenario>(); slist.Add(XmlReaderScenario); slist.Add(XmlWriterScenario); foreach (XmlDriverScenario scenarioAttr in slist) { string specFile = (cmdSpecFile == null) ? scenarioAttr.ControlFile : cmdSpecFile; string name = scenarioAttr.Name; string[] filters = (string[])CombineArrays(cmdFilters, scenarioAttr.Filters); string defaultSection = (cmdDefaultSection == null) ? scenarioAttr.DefaultSection : cmdDefaultSection; if (specFile == null || specFile == string.Empty) throw new CXmlDriverException("Control File is not defined for TestCase \"" + scenarioAttr.Desc + "\""); // parse spec file and update testModule's param list ParseControlFile(name, specFile, filters, defaultSection, null, null, _testModuleParams); } } catch (Exception e) { HandleException(e); } }