public static void Run() { TestContext.Activate(); Thread.Pool.RunOnNewThread(async() => { foreach (var test in GetTests()) { try { var testCase = Activator.CreateInstance(test) as UITest; await testCase.Run(); Log.For <TestEngine>().Debug($"Test \"{ test.GetType().Name }\" ran successfully"); await Task.Delay(1.Seconds()); } catch (Exception ex) { // TODO: Report failed test via Firebase await Alert.Show($"Test failed: \"{ test.GetType().Name }\"\n\n{ex.Message}"); return; } } await Alert.Show("TESTS COMPLETED"); }); }
public static void Run <T>() where T : UITest { TestContext.Activate(); var test = GetTests().FirstOrDefault(x => x == typeof(T)); if (test == null) { throw new Exception($"Testcase with type {typeof(T)} not found."); } Thread.Pool.RunOnNewThread(async() => { var testCase = Activator.CreateInstance(test) as UITest; await testCase.Run(); }); }