//Builds files sent by repository public void Build(string testDriver, string testConfiguration, List <string> testCodes = null) { try { //Creating background window of command prompt and firing build command Console.WriteLine("\n Start Logging (Requirement 8)"); Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; if (testCodes != null) { string codes = ""; foreach (string test in testCodes) { codes = codes + " " + test; } if (testConfiguration == "C#") { p.StartInfo.Arguments = "/Ccsc /warnaserror /target:library " + testDriver + " " + codes; } if (testConfiguration == "Java") { p.StartInfo.Arguments = "/Cjavac " + testDriver; } } else { if (testConfiguration == "C#") { p.StartInfo.Arguments = "/Ccsc /warnaserror /target:library " + testDriver; } if (testConfiguration == "Java") { p.StartInfo.Arguments = "/Cjavac " + testDriver; } } Console.Write("\n Build Command: {0}", p.StartInfo.Arguments); p.StartInfo.WorkingDirectory = storagepath; p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.Start(); p.WaitForExit(); string time = p.TotalProcessorTime.ToString(); string errors = p.StandardError.ReadToEnd(); string output = p.StandardOutput.ReadToEnd(); Console.Write("\n\n"); Console.Write("\n Output:\n{0}", output + errors); if (errors == "" && !output.Contains("error")) { Console.Write("\n Build Successful."); comm1.sndr.uploadFile(Path.GetFileNameWithoutExtension(testDriver) + ".dll", storagepath); testDriverToBeTested = Path.GetFileNameWithoutExtension(testDriver) + ".dll"; } else { Console.Write("\n Build Failure"); } Console.Write("\n Execution Time: {0}", time); bl.startLogging(errors, output, time, testDriver); } catch (Exception ex) { Console.Write("\n\n {0}", ex.Message); } }