private void EvaluateResults() { if (FirstTrace == null) { _test.RecordFailed(Session, this, "Didn't run"); return; } EvaluateGeneralTestResults(); if (FailedTestRequirements.Count > 0) { _test.RecordFailed(Session, this, $"{FailedTestRequirements.Count} general test requirements were not met"); return; } TraceRequirements processThreadReqs = _test.TraceRequirements(); TRACE_TEST_RESULTS processThreadResults = FirstTrace.EvaluateProcessTestRequirement(processThreadReqs, ref ResultCommentary); if (EvaluateProcessTestResults(processThreadReqs, processThreadResults, 0)) { _test.RecordPassed(Session, this); } else { _test.RecordFailed(Session, this, $"Failed tests. Process:{processThreadResults.ProcessResults.Failed} Thread: ? Children: ?"); } }
private static bool EvaluateProcessTestResults(TraceRequirements requirements, TRACE_TEST_RESULTS results, int depth) { //need to ensure each set of thread requirements can be satisfied by at least one unique thread Dictionary <REQUIREMENTS_LIST, List <ProtoGraph> > reqSatisfyGraphs = new Dictionary <REQUIREMENTS_LIST, List <ProtoGraph> >(); foreach (REQUIREMENTS_LIST reqlist in requirements.ThreadRequirements) { reqSatisfyGraphs[reqlist] = new List <ProtoGraph>(); } foreach (var threadReqList in requirements.ThreadRequirements) { Dictionary <ProtoGraph, REQUIREMENT_TEST_RESULTS> allThreadResults = results.ThreadResults[threadReqList]; foreach (var graph_results in allThreadResults) { ProtoGraph graph = graph_results.Key; if (graph_results.Value.Failed.Count == 0) { reqSatisfyGraphs[threadReqList].Add(graph); } } } bool threadsVerified = VerifyAllThreadRequirements(reqSatisfyGraphs, out string?threadVerifyError); bool processesVerified = results.ProcessResults.Failed.Count == 0; //if(!threadsVerified) FailedTestRequirements.Add(null, $"Thread traces didn't satisfy conditions list: "+threadVerifyError); //if(!processesVerified) FailedTestRequirements.Add(null, $"{results.ProcessResults.Failed.Count} requirements failed"); return(threadsVerified && processesVerified); //todo - multi process tests /* * foreach(var x in results.ChildResults) * { * TRACE_TEST_RESULTS processThreadResults = childtrace.EvaluateProcessTestRequirement(processThreadReqs); * EvaluateProcessTestResults(processThreadReqs, processThreadResults); * } */ }