static void Main(string[] args) { XmlDataAccess XmlHelper1 = new XmlDataAccess("performanceConfig.xml"); XmlDataAccess XmlHelper2 = new XmlDataAccess("performanceInput.xml"); XmlDataAccess XmlHelper3 = new XmlDataAccess("performanceReport.xml"); List<TestCommand> listTCommand = XmlHelper1.getTestCommands(); ComponentFunction.Initialize(listTCommand); List<TestSuite> listTSuite = XmlHelper1.getTestSuites(); List<TestData> listTData = new List<TestData>(); Dictionary<string, string> listTConfig = new Dictionary<string, string>(); string excelPath = ConfigurationSettings.AppSettings["ExcelFile"]; ExcelDataAccess exceldataAccess = new ExcelDataAccess(excelPath); listTConfig = exceldataAccess.getTestConfig(); listTConfig = XmlHelper1.getTestConfig(); foreach (TestSuite tsuite in listTSuite) { string Log = ""; if (tsuite.Construct(ref Log)) { List<string> listvalues = XmlHelper2.getValues(tsuite.getName()); foreach (string values in listvalues) { Log = ""; TestData temp = new TestData(); string description = string.Empty; if (tsuite.Debug(values, ref Log, ref description, listTConfig)) { temp.TestCase = tsuite.getName(); temp.Values = values; temp.Result = Glossary.PASS; temp.Comment = Log; }else{ temp.TestCase = tsuite.getName(); temp.Values = values; temp.Result = Glossary.FAILURE; temp.Comment = Log; } listTData.Add(temp); } } } XmlHelper3.BuildReport(listTData); Console.ReadLine(); }
public static void Main() { XmlDataAccess XmlHelper1 = new XmlDataAccess("testbuildConfig.xml"); XmlDataAccess XmlHelper2 = new XmlDataAccess("testbuildInput.xml"); XmlDataAccess XmlHelper3 = new XmlDataAccess("testbuildReport.xml"); List<TestCommand> listTCommand = XmlHelper1.getTestCommands(); ComponentFunction.Initialize(listTCommand); List<TestSuite> listTSuite = XmlHelper1.getTestSuites(); List<TestData> listTData = new List<TestData>(); Dictionary<string, string> listTConfig = new Dictionary<string, string>(); listTConfig = XmlHelper1.getTestConfig(); foreach (TestSuite tsuite in listTSuite) { string Log = ""; if (tsuite.Construct(ref Log)) { List<string> listvalues = XmlHelper2.getValues(tsuite.getName()); foreach (string values in listvalues) { Log = ""; TestData temp = new TestData(); MessageShow.DebugTCase(tsuite.getName(), tsuite.getParameters(), tsuite.getInputArgumentsTypeInfo(), values); string description = string.Empty; if(tsuite.Debug(values, ref Log, ref description, listTConfig)){ temp.TestCase = tsuite.getName(); temp.Values = values; temp.Result = Glossary.PASS; temp.Comment = Log; }else{ temp.TestCase = tsuite.getName(); temp.Values = values; temp.Result = Glossary.FAILURE; temp.Comment = Log; } MessageShow.DebugFinish(tsuite.getName(), temp.Result, temp.Comment); listTData.Add(temp); } } } XmlHelper3.BuildReport(listTData); Console.ReadLine(); }
private bool GenerateTestDatas(List<string> listvalues, TestCase tcase) { if (_dtAccess != null) { if (beginID == 0) beginID++; List<string> listParams = util.getListValueFromString(tcase.Parameters); int nArgument = listParams.Count; if (nArgument == 1 && listParams[0].Equals("")) { Out.WriteLine("TCase name=" + tcase.Name + " have no arguments"); return false; } else { List<TestData> newDatas = new List<TestData>(); foreach (string item in listvalues) { int n = util.getListValueFromString(item).Count; if (n != nArgument) { Error.WriteLine("The number of arguments input isnot valid."); return false; } else { TestData temp = new TestData(); temp.ID = beginID.ToString(); temp.Comment = "Data generate by pict."; temp.TestCase = tcase.Name; temp.Values = item; temp.Result = ""; beginID++; newDatas.Add(temp); } } if (newDatas.Count > 0) { _dtAccess.GenerateTestdatas(newDatas); Out.WriteLine("Generate TData for TCase=" + tcase.Name + " successful."); Out.WriteLine("There are " + newDatas.Count + " TestDatas generated by pict."); } else { Error.WriteLine("Generate TData for TCase=" + tcase.Name + " unsuccessful."); Error.WriteLine("No valid TData to generate."); return false; } } } return true; }
public void inTData(TestData data) { this._listTDatas.Add(data); }