public Dictionary <string, string> ResultDisplay(string ResultLocation, ErrorFetcher errorfetcher) { Dictionary <string, string> result = null;//Dictonary for returning test case result try { XmlDocument doc = new XmlDocument(); doc.Load(ResultLocation + "\\TestResult.xml");//opening testcase result XmlNodeList elem = doc.GetElementsByTagName("test-run"); result = new Dictionary <string, string>(); XmlNode fileName = doc.GetElementsByTagName("test-suite")[0]; //Adding result data in Dictionary result.Add("Test-Name", fileName.Attributes["name"].Value); foreach (XmlNode item in elem) { result.Add("Result", item.Attributes["result"].Value); result.Add("Total", item.Attributes["total"].Value); result.Add("Passed", item.Attributes["passed"].Value); result.Add("Skipped", item.Attributes["skipped"].Value); result.Add("Failed", item.Attributes["failed"].Value); result.Add("Inconclusive", item.Attributes["inconclusive"].Value); result.Add("Asserts", item.Attributes["asserts"].Value); } result.Add("Location", ResultLocation + "\\TestResult.xml"); } catch (Exception e) { errorfetcher.Invoke(e.Message); } return(result); }
public void RunNunit(string testlocation, string projectLocation, string projectName, ErrorFetcher errorfetcher) { errFetcher = errorfetcher; try { var process = CreateProcess(); //Process Creation process.Start(); //Process Start var command = "cd " + testlocation; //Changning CMD dir to Test case directory process.StandardInput.WriteLine(command); CopyData(projectLocation, testlocation, process); //Copying latest DLL var nunitConsole = "\"C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe\""; //Location of NUnit Console command = nunitConsole + " " + testlocation + "\\" + projectName + "Test.dll"; //Commmand for running NUnit console with testcase process.StandardInput.WriteLine(command); process.StandardInput.WriteLine("exit");//Exiting CMD process.WaitForExit(); } catch (Exception e) { errFetcher.Invoke(e.Message); } }
public Dictionary <string, string> ExecuteDriver(string projectDLLPath, string directory, ErrorFetcher errorFetcher) { Dictionary <string, string> result = null; this.errorFetcher = errorFetcher; try { //declaring variable for all Location of file and it's name var pathSplit = projectDLLPath.Split('\\'); var projectLocation = string.Join("\\", pathSplit.Take((pathSplit.Length) - 1)); var projectName = pathSplit[pathSplit.Length - 4]; var testLocation = GetNunitLocation(projectName, projectLocation, directory); //Getting location of NUnit of given project RunNunitTest(testLocation, projectLocation, projectName); //Running Nunit test cases for changed project result = GetResult(testLocation); //Getting result from TestResult.xml } catch (Exception e) { errorFetcher.Invoke(e.Message); } return(result); }
public FileWatcher(DataFetcher dataFetcher, string directory, ErrorFetcher errorFetcher, MonitoringSourceControl sourceControl)//FileWatcher Constructor initializing all Delegates { this.Directory = directory; this.fetcher = dataFetcher; this.errorFetcher = errorFetcher; this.MonitorSCList = sourceControl; }
public string NUnitFinder(string directory, string projectName, string dll_location, ErrorFetcher errorFetcher) { string returnValue = null; try { List <string> files = new List <string>(); files.AddRange(Directory.GetFiles(directory, projectName + "Test.dll", SearchOption.AllDirectories));//Searching directory for Test case var dest = files[0].Split('\\'); var destination = string.Join("\\", dest.Take((dest.Length) - 1)); returnValue = destination;//returning test case Location } catch (Exception e) { errorFetcher.Invoke(e.Message); } return(returnValue); }