private static void RunTests(ulong testRun) { var testsList = TestRail.GetTestList(testRun); if (testsList.Count == 0) { throw new Exception($"There are no tests in Run [{testRun}]"); } //WebDriverHelper.DeleteScreenshot(); TestExecutor.RunTests(testsList); }
private static void AddTests(ulong testRun) { var testsList = TestRail.GetTestList(testRun); if (testsList.Count == 0) { throw new Exception($"There are no tests in Run [{testRun}]"); } foreach (var test in testsList) { foreach (var asm in Assemblies) { MethodInfo method = null; var tag = TestRail.GetTag(test); var tagVals = tag.Split('@'); var funcName = tagVals[0]; var funcParam = tagVals.Length > 1 ? tagVals[1] : null; var caseId = $"C{test.CaseID}"; var type = asm.Assembly.GetTypes().FirstOrDefault(x => (method = GetMethod(x, funcName, caseId)) != null); if (type == null || method == null) { continue; } var methods = type.GetMethods(); var setupMethod = methods.FirstOrDefault(x => x.GetCustomAttributes().Any(atr => atr.GetType().Name == "SetUpAttribute")); var teardownMethod = methods.FirstOrDefault(x => x.GetCustomAttributes().Any(atr => atr.GetType().Name == "TearDownAttribute")); asm.TestsList.Add(new TestInfo() { TestRailInfo = test, TestClass = type, TestMethod = method, SetupMethod = setupMethod, TeardownMethod = teardownMethod, FuncParam = funcParam }); } } }