public void RunOne() { try { Initialize(); Assembly assembly = Assembly.GetExecutingAssembly(); GFXDTest test = null; foreach (Type type in assembly.GetTypes()) { if (type.IsSubclassOf(typeof(GFXDTest)) && type.FullName.Equals(testname)) { test = (GFXDTest)Activator.CreateInstance(type, resetEvent); } } OnTestEvent(new TestEventArgs(test.GetType().FullName + " Queued")); ThreadPool.QueueUserWorkItem(test.Run, tLocker); lock (tLocker) { TestCount += 1; } Thread.Sleep(1000); } catch (Exception e) { Log(DbHelper.GetExceptionDetails(e, new StringBuilder()).ToString()); OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Encountered exception in GFXDTestRunner.RunOne(). Check log for detail")); } finally { try { Cleanup(); } catch (Exception e) { Log(DbHelper.GetExceptionDetails(e, new StringBuilder()).ToString()); OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Encountered exception in GFXDTestRunner.Cleanup(). Check log for detail")); } } OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Done")); }
/// <summary> /// Entry point to automated test run /// </summary> public void Run() { try { Initialize(); Assembly assembly = Assembly.GetExecutingAssembly(); do { foreach (Type type in assembly.GetTypes()) { if (interrupted) { runContinuously = false; break; } if (type.IsSubclassOf(typeof(GFXDTest))) { GFXDTest test = (GFXDTest)Activator.CreateInstance(type, resetEvent); OnTestEvent(new TestEventArgs(test.GetType().FullName + " Queued")); ThreadPool.QueueUserWorkItem(test.Run, tLocker); lock (tLocker) { TestCount += 1; } Thread.Sleep(1000); } } while (TestCount > 0) { resetEvent.WaitOne(); } Thread.Sleep(1000); } while (runContinuously); } catch (Exception e) { Log(DbHelper.GetExceptionDetails(e, new StringBuilder()).ToString()); OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Encounter exception in EsqlTestRunner.Run(). Check log for detail")); } finally { try { Cleanup(); } catch (Exception e) { Log(DbHelper.GetExceptionDetails(e, new StringBuilder()).ToString()); OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Encounter exception in EsqlTestRunner.Cleanup(). Check log for detail")); } } OnTestEvent(new TestEventArgs(string.Empty, string.Empty, string.Empty, "Done")); }