public void VerifyXml(string reflectionDirectory, int expectedCount) { var files = Directory.GetFiles(reflectionDirectory, "*xml"); if (expectedCount != files.Length) { throw new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForReflectionVerifyXml(expectedCount, files) }; } }
private ReportPackageSourceFile GetSourceFile(ReportPackageClass javaClass, ReportPackageSourceFile[] packageSourceFiles) { try { return(packageSourceFiles.First(file => file.Name == javaClass.SourceFilename)); } catch (Exception e) { throw new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForRawCoveragerSoureFile(javaClass) }; } }
public void MapTestMethods(string reflectionDirectory, ref List <JavaTestClass> testClasses) { foreach (var testClass in testClasses) { try { MapTestMethodsImplementation(reflectionDirectory, testClass); } catch (Exception e) { throw new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForReflectionMapping(e, testClass) }; } } }
private static bool Covered(JavaTestMethod referenceTestMethod, JavaTestMethod studentTestMethod) { if (referenceTestMethod.LineCoverages.Count != studentTestMethod.LineCoverages.Count) { throw new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory.GenerateReportForAnalysisLineCoverage(referenceTestMethod, studentTestMethod) } } ; return(!referenceTestMethod.LineCoverages.Where((r, i) => !(r.CoveredInstructions > 0 ? studentTestMethod.LineCoverages[i].CoveredInstructions > 0 : studentTestMethod.LineCoverages[i].CoveredInstructions == 0)).Any()); //return !referenceTestMethod.LineCoverages.Where((t, i) => t.CoveredBranches > studentTestMethod.LineCoverages[i].CoveredBranches // || t.CoveredInstructions > studentTestMethod.LineCoverages[i].CoveredInstructions // || t.MissedBranches < studentTestMethod.LineCoverages[i].MissedBranches // || t.MissedInstructions < studentTestMethod.LineCoverages[i].MissedInstructions).Any(); } }
public void SetupJUnitCore(string workingDirectory, IList <JavaTestClass> javaClasses) { var process = new EngineProcess(Command, GetCommonOptionsForJunitCore(javaClasses), workingDirectory); try { process.Run(); } catch (Exception e) { var exception = new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForRawCoveragerJunitCore(process, e, javaClasses) }; process.Stop(); throw exception; } process.Stop(); }
public void GenerateXmlForJavaClass(string codeDirectory, string reflectionDirectory, JavaTestClass javaTestClass) { var process = new EngineProcess(Command, GetCommandOptions(codeDirectory, javaTestClass, reflectionDirectory), codeDirectory); try { process.Run(); } catch (Exception e) { var exception = new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForReflectionProcess(process, e, javaTestClass) }; process.Stop(); throw exception; } process.Stop(); }
public void TraceJavaMethod(JavaTestClass javaTestClass, JavaTestMethod testMethod, string workingDirectory) { var commandOptions = GetCommandOptions(javaTestClass.Name, testMethod.Name, javaTestClass.ClassPath); var process = new EngineProcess(Command, commandOptions, workingDirectory); try { process.Run(); } catch (Exception e) { var exception = new EngineExceptionDto() { Report = JavaEngineReportExceptionFactory .GenerateReportForTraceJavaMethod(process, e, javaTestClass, testMethod) }; process.Stop(); throw exception; } process.Stop(); }