public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly //if (Util.IsRestartRequiredForWinAppAccess) // return Util.RestartWithUiAccess(); // http://geekswithblogs.net/akraus1/articles/64871.aspx Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public void Run() { if (TestSuiteRunner != null) { TestSuiteRunner.RunTests(this); } }
//控制执行流程 //1. 读取指定目录下的所有子目录 //2. 屏幕打印所有子目录 //3. 等待输入子目录编号 //4. 执行子目录下的所有文件 private static void ExecuteFile(string filePath) { var lines = File.ReadAllLines(filePath, Encoding.Default); var suite = TestSuiteFactory.Instance.CreateTestSuiteFrom(lines, filePath, null); TestSuiteRunner runner = new TestSuiteRunner(); runner.Run(suite); }
[Test, Ignore("Runs out of memory")] public void RunEntireClosureTestSuite() { IEnumerable <string> files = GetTestSuiteFiles(); TestSuiteRunner runner = JSNet.ClosureLibraryTestSuiteRunner(basejsfile); TestSuiteResults results = runner.TestFiles(files); Assert.AreEqual(0, results.Failed.Count(), results.ToString()); Assert.AreEqual(500, results.Passed.Count(), results.ToString()); }
public static int Main(string[] args) { Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public static int Main(string[] args) { /* * if(!CheckDeviceAvailable()) * { * DialogResult dr = MessageBox.Show("Do you want to continue? Click Ok button to continue.", "Warning" , MessageBoxButtons.YesNo,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2); * if(dr == DialogResult.No) * { * return 0; * } * } */ var configs = GetConfigs(); string CheckDevice = configs["CheckDevice_BeforeTesting"]; string RestoreDB = configs["RestoreDB_AfterEachTestCase"]; // If CheckDevice is Y, program will check these ip addresses are available or not. if (CheckDevice.Equals("Y")) { //stop Nform service Console.WriteLine("Stop Nform service..."); string strRst = RunCommand("sc stop Nform"); //Be used to check devices are avalibale or not, which are configured in Device.ini LxDeviceAvailable myDeviceAvailable = new LxDeviceAvailable(); myDeviceAvailable.CheckSnmpDevice(); myDeviceAvailable.CheckVelDevice(); //start Nform service Console.WriteLine("Start Nform service..."); strRst = RunCommand("sc start Nform"); } Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { MessageBox.Show("Unexpected exception occurred:"); Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public static int Main(string[] args) { Keyboard.AbortKey = System.Windows.Forms.Keys.Escape; int error = 0; Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; //Disable Delphi plugin Ranorex.Core.ElementEngine.Instance.Flavors["delphi"].Enabled = false; //Add process name to GDI capture list RawTextFlavor.Instance.ClassNames.Add(new Regex("^TToolBar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TDBGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TPanel$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TCalendar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXStringGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TStringGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXEditor$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TRichEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TDBRichEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXVSTreeView$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TStatusBar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TTreeView$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TListBox$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TGroupBox$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TJvRichEdit$")); RawTextFlavor.Instance.ProcessNames.Add(new Regex("^Systemx$")); RawTextFlavor.Instance.ProcessNames.Add(new Regex("^TSXToolBar$")); RawTextFlavor.Instance.ProcessNames.Add(new Regex("^TSXPanel$")); RawTextFlavor.Instance.ProcessNames.Add(new Regex("^TSXRichEdit$")); try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly //if (Util.IsRestartRequiredForWinAppAccess) // return Util.RestartWithUiAccess(); Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; RawTextFlavor.Instance.ClassNames.Add(new Regex("^TToolBar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TDBGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TPanel$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TCalendar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXStringGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TStringGrid$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXEditor$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TRichEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TDBRichEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TSXVSTreeView$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TStatusBar$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TEdit$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TTreeView$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TListBox$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TGroupBox$")); RawTextFlavor.Instance.ClassNames.Add(new Regex("^TJvRichEdit$")); System.Windows.Forms.Application.Run(new Splash.WinSplash()); try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly //if (Util.IsRestartRequiredForWinAppAccess) // return Util.RestartWithUiAccess(); Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; try { Ranorex.Plugin.WpfConfiguration.WpfApplicationTrees = Ranorex.Plugin.WpfTreeSelection.UiaPreferred; error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public InternetExplorerFastWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public FirefoxDevWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly if (Util.IsRestartRequiredForWinAppAccess) { return(Util.RestartWithUiAccess()); } // try // { // Utils.DisableAboveModule(false); // // // }catch (Exception e) // { // Console.WriteLine(e.ToString()); // Console.ReadLine(); // } Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; var testSuiteXml = File.Exists("Runner.rxtst") ? XElement.Load("Runner.rxtst").ToString() : XElement.Load("DHSAutomation.rxtst").ToString(); CultureInfo ci = Utils.GetOSLanguage(); string langCode = ci.Name; Console.WriteLine(langCode); // bool stopped = false; // bool itself = true; // // try { // var docSet = XElement.Load("DHSAutomation.rxtst"); // // foreach (var e in docSet.XPathSelectElements("//testconfiguration/testcase")) { // var caseId = e.Attribute("id").Value; // foreach (var testModule in docSet.XPathSelectElements("//childhierarchy/testsuite/testcase/testcase[@id='" + caseId + "']/testmodule")) { // var testModuleId = testModule.Attribute("id").Value; // var orgTestModule = docSet.XPathSelectElement("//flatlistofchildren//testmodule[@id='" + testModuleId + "']"); // var refId = orgTestModule.Attribute("ref").Value; // if (!stopped) { // if (!refId.Equals("5110d38b-fdba-4df5-8ebc-549d97bac8e2") || !itself) { // orgTestModule.SetAttributeValue("enabled", "False"); // } // Console.WriteLine(orgTestModule); // } // if (refId.Equals("5110d38b-fdba-4df5-8ebc-549d97bac8e2")) { // stopped = true; // } // } // } // // File.WriteAllText("Runner.rxtst", docSet.ToString()); // // } catch (Exception e) { // Console.WriteLine(e.ToString()); // } // // Console.ReadLine(); try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine, testSuiteXml); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; } return(error); }
public EdgeFastWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public EdgeCoordinatorWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public CoordinatorWebBrowserFactoryBase(TestSuiteRunner runner) { TestSuiteRunner = runner; timer = new Timer(RenewLeases, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); }
public FastLocalWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public static int Main(string[] args) { // Uncomment the following 2 lines if you want to automate Windows apps // by starting the test executable directly //if (Util.IsRestartRequiredForWinAppAccess) // return Util.RestartWithUiAccess(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); SpeechSynthesizer Speech = new SpeechSynthesizer(); Keyboard.AbortKey = System.Windows.Forms.Keys.Escape; int error = 0; // To autorun Scripts in directory <C: on reg1, D: on reg 2-n>/PAL/RanorexStudio Projects\Ranorex Automation\Alpha\bin\Debug // NOTE: autorun is assumed to be type Baseline // RanorexAutomation.exe auto [<iteratins-time> [<Scenario-list>] ] // <iteratins-time> = number iterations // <iteratins-time> = time to stop "6:00 am" // <iteratins-time> = time to start and stop "6:00 am to 3:00 PM" // <Scenario-list> = list if scenarios to run comma delited "3,4,6-20" // If neither <iteratins-time> or <Scenario-list> supplied will run using same paramaters as last run // Just auto <iterations-time> can be given, will ust last run scenario list // Get command line argumets Global.CommandLineArg0 = ""; Global.CommandLineArg1 = ""; Global.CommandLineArg2 = ""; Global.CommandLineArg3 = ""; string[] RanorexCmdLine = Environment.GetCommandLineArgs(); int Arguments = args.Length; switch (Arguments) { case 1: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); break; case 2: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); Global.CommandLineArg2 = RanorexCmdLine[2].ToUpper(); break; case 3: Global.CommandLineArg0 = RanorexCmdLine[0].ToUpper(); Global.CommandLineArg1 = RanorexCmdLine[1].ToUpper(); Global.CommandLineArg2 = RanorexCmdLine[2].ToUpper(); Global.CommandLineArg3 = RanorexCmdLine[3].ToUpper(); break; } // For debugging auto run // Global.CommandLineArg1 = "AUTO"; // Global.CommandLineArg2 = "1"; // Global.CommandLineArg3 = "3"; // Report.Log(ReportLevel.Info, "CommandLineStuff", // "\n" + "Arglen: " + Arguments + "\n" + // "Zero: " + Global.CommandLineArg0 + "\n" + // "One: " + Global.CommandLineArg1 + "\n" + // "Two: " + Global.CommandLineArg2 + "\n" + // "Three: " + Global.CommandLineArg3 + "\n" // , new RecordItemIndex(0)); // Thread.Sleep(10000); // Environment.Exit(0); // Onetime delay for Ranorex to setup instrumentation Thread.Sleep(5000); if (Global.CommandLineArg1 == "AUTO") { Global.AutoRun = true; } try { error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); } catch (Exception e) { Report.Error("Unexpected exception occurred: " + e.ToString()); error = -1; Global.LogText = "Unexpected exception occurred: " + e.ToString(); WriteToLogFile.Run(); Global.TempErrorString = Global.LogText; WriteToErrorFile.Run(); Global.WavFilePath = "UnexpectedException.wav"; PlayWavFile.Run(); if (Global.DoRegisterSoundAlerts) { Speech.Speak("Register " + Global.RegisterNumber); } } fnTearDown Teardown = new fnTearDown(); Report.Log(ReportLevel.Info, "Main", "Starting Teardown", new RecordItemIndex(0)); TestModuleRunner.Run(Teardown); Report.Log(ReportLevel.Info, "Main", "Teardown Finished", new RecordItemIndex(0)); return(error); }
public ChromeDevWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public LocalWebBrowserFactory(TestSuiteRunner runner) { TestSuiteRunner = runner; }
public FirefoxCoordinatorWebBrowserFactory(TestSuiteRunner runner) : base(runner) { }
public EdgeFastWebFactoryTmp(TestSuiteRunner runner) : base(runner) { }
public static int Main(string[] args) { /* * if(!CheckDeviceAvailable()) * { * DialogResult dr = MessageBox.Show("Do you want to continue? Click Ok button to continue.", "Warning" , MessageBoxButtons.YesNo,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2); * if(dr == DialogResult.No) * { * return 0; * } * } * * var configs = GetConfigs (); * string CheckDevice = configs["CheckDevice_BeforeTesting"]; * string RestoreDB = configs["RestoreDB_AfterEachTestCase"]; */ /* * Get size of database for SQL SERVER * LxSQLDbOperation SQLOper = new LxSQLDbOperation(); * SqlConnection conn = new SqlConnection(); * conn.ConnectionString =@"Data Source=10.146.64.56\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=sa@2013;"; * SQLOper.OpenConnection(conn); * string NformSize = SQLOper.GetDbSize(conn, "Nform"); * string NformAlmSize = SQLOper.GetDbSize(conn, "NformAlm"); * string NformLogSize = SQLOper.GetDbSize(conn, "NformLog"); * Console.WriteLine("The size of Nform is:"+NformSize); * Console.WriteLine("The size of Nform is:"+NformAlmSize); * Console.WriteLine("The size of Nform is:"+NformLogSize); */ /* * Get size of database for SQL CE * LxCEDbOperation CEOper = new LxCEDbOperation(); * double NformAlmSize = CEOper.GetAlarmDbSize(); * double NformDataLogSize = CEOper.GetDataLogDbSize(); * Console.WriteLine("NformAlmSize is: " +NformAlmSize); * Console.WriteLine("NformDataLogSize is: " +NformDataLogSize); * */ /* * Increase database for SQLCE * LxCEDbOperation CEOper = new LxCEDbOperation(); * CEOper.IncreaseAlarmDbSize(); * CEOper.IncreaseDatalogDbSize(); * */ /* * Increase database for SQL SERVER * LxSQLDbOperation SQLOper = new LxSQLDbOperation(); * SqlConnection conn = new SqlConnection(); * conn.ConnectionString =@"Data Source=10.146.64.56\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=sa@2013;"; * SQLOper.GetDbSize(conn,"NformAlm"); * SQLOper.GetDbSize(conn,"NformLog"); * SQLOper.IncreaseAlarmDbSize(); * SQLOper.IncreaseDatalogDbSize(); * * */ /* * Get table value for SQLCE database * * LxCEDbOperation CEOper = new LxCEDbOperation(); * string dbNformName = @"Nform.sdf"; * string dbNformAlmName = @"NformAlm.sdf"; * string dbNformLogName = @"NformLog.sdf"; * string cmdVersion = @"SELECT * FROM Version;"; * string cmdAlarm = @"SELECT * FROM Alarm;"; * string cmdLog = @"SELECT * FROM DataLog;"; * CEOper.GetTableValue(dbNformName,cmdVersion); * CEOper.GetTableValue(dbNformAlmName,cmdAlarm); * CEOper.GetTableValue(dbNformLogName,cmdLog); * * */ /* * Get table value for SQLServer database * LxSQLDbOperation SQLOper = new LxSQLDbOperation(); * SqlConnection conn = new SqlConnection(); * conn.ConnectionString =@"Data Source=10.146.64.56\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=sa@2013;"; * string cmdVersion = @"use Nform;SELECT * FROM Version;"; * string cmdAlarm = @"use NformAlm;SELECT * FROM Alarm;"; * string cmdLog = @"use NformLog;SELECT * FROM DataLog;"; * string cmdGrp = @"use Nform;SELECT * FROM UsrGrp;"; * SQLOper.GetTableValue(conn,cmdVersion); * SQLOper.GetTableValue(conn,cmdGrp); * */ /* * string ip1 = AppConfigOper.parseToValue("$SNMP_SingleAuto_1$"); * string ip2 = AppConfigOper.parseToValue("$Velocity_device_2$"); * Console.WriteLine("ip1 is:"+ip1); * Console.WriteLine("ip2 is:"+ip2); */ string CheckDevice = AppConfigOper.mainOp.getConfigValue("CheckDevice_BeforeTesting"); string RestoreDB = AppConfigOper.mainOp.getConfigValue("RestoreDB_AfterEachTestCase"); string runOnVM = AppConfigOper.mainOp.getConfigValue("RunOnVM"); //Create Report folder string reportDir = System.IO.Directory.GetCurrentDirectory(); System.IO.DirectoryInfo reportDirect = System.IO.Directory.CreateDirectory(reportDir + @"\Report\" + "Report_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss")); string ReportPath = reportDirect.FullName + @"\"; setReport(ReportPath); // If CheckDevice is Y, program will check these ip addresses are available or not. if (CheckDevice.Equals("Y")) { //stop Nform service Console.WriteLine("Stop Nform service..."); string strRst = RunCommand("sc stop Nform"); //Be used to check devices are avalibale or not, which are configured in Device.ini LxDeviceAvailable myDeviceAvailable = new LxDeviceAvailable(); myDeviceAvailable.CheckSnmpDevice(); myDeviceAvailable.CheckVelDevice(); //start Nform service Console.WriteLine("Start Nform service..."); strRst = RunCommand("sc start Nform"); } if (runOnVM.Equals("Y")) { Keyboard.Enabled = false; Mouse.Enabled = false; Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; NformRepository.Instance.SearchTimeout = new Duration(50000); } Keyboard.AbortKey = System.Windows.Forms.Keys.Pause; int error = 0; /* * try * { * error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); * } * catch (Exception e) * { * MessageBox.Show("Unexpected exception occurred:"); * Report.Error("Unexpected exception occurred: " + e.ToString()); * error = -1; * } */ error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine); return(error); }