///<summary>Report on the fact that a given line has been executed.</summary> public static void ExecutedLine(string className, string methodName, string descriptor, int line) { //This is done to prevent the SUT keep on executing code after a test case is evaluated if (IsKillSwitch()) { //TODO // var initClass = Arrays.stream(Thread.CurrentThread..getStackTrace()) // .anyMatch(e -> e.getMethodName().equals("<clinit>")); /* * must NOT stop the initialization of a class, otherwise the SUT will be left in an * inconsistent state in the following calls */ // if (!initClass) // { // throw new KillSwitchException(); // } } //TODO //for targets to cover var lineId = ObjectiveNaming.LineObjectiveName(className, line); var classId = ObjectiveNaming.ClassObjectiveName(className); UpdateObjective(lineId, 1d); UpdateObjective(classId, 1d); //to calculate last executed line var lastLine = className + "_" + line + "_" + methodName; var lastMethod = className + "_" + methodName + "_" + descriptor; MarkLastExecutedStatement(lastLine, lastMethod); }
//This method is called by the probe inserted after each covered line in the instrumented SUT public static void CompletedLine(string className, string methodName, int lineNo) { ObjectiveRecorder.RegisterTarget(ObjectiveNaming.LineObjectiveName(className, lineNo)); //TODO: description ExecutionTracer.ExecutedLine(className, methodName, "desc", lineNo); }