/** * Returns true if any of the executed statements was a reflection statement * * @return */ public boolean calledReflection() { int executedStatements = getExecutedStatements(); for(int numStatement = 0; numStatement < executedStatements; numStatement++) { Statement s = test.getStatement(numStatement); if(s.isReflectionStatement()) return true; } return false; }
/** * Execute a test case * * @param test * The test case to execute * @return Result of the execution */ public static ExecutionResult runTest(TestCase test) { ExecutionResult result = new ExecutionResult(test, null); try { TestCaseExecutor executor = getInstance(); logger.debug("Executing test"); result = executor.execute(test); MaxStatementsStoppingCondition.statementsExecuted(result.getExecutedStatements()); } catch (Exception e) { logger.error("TG: Exception caught: ", e); throw new Error(e); } return result; }
/** * Execute a test case * * @param test * The test case to execute * @return Result of the execution */ @Deprecated public ExecutionResult runTest(TestCase test) { ExecutionResult result = new ExecutionResult(test, null); try { result = TestCaseExecutor.getInstance().execute(test); MaxStatementsStoppingCondition.statementsExecuted(result.getExecutedStatements()); } catch (Exception e) { logger.warn("TG: Exception caught: " + e.getMessage(), e); try { Thread.sleep(1000); result.setTrace(ExecutionTracer.getExecutionTracer().getTrace()); } catch (Exception e1) { throw new Error(e1); } } // System.out.println("TG: Killed "+result.getNumKilled()+" out of "+mutants.size()); return result; }
/** * <p> * inline * </p> * * @param suite * a {@link org.evosuite.testsuite.TestSuiteChromosome} object. */ public void inline(TestSuiteChromosome suite) { for (TestChromosome test : suite.getTestChromosomes()) { final int old_test_size = test.size(); inline(test); final int new_test_size = test.size(); final int removed_statements = old_test_size - new_test_size; if (removed_statements > 0) { ExecutionResult lastExecResult = test.getLastExecutionResult(); if (lastExecResult != null) { final int old_exec_statements = lastExecResult.getExecutedStatements(); final int new_exec_statements = old_exec_statements - removed_statements; lastExecResult.setExecutedStatements(new_exec_statements); } } } }
DSEStats.getInstance().reportNewConcolicExecutionTime(estimatedConcolicExecutionTime); MaxStatementsStoppingCondition.statementsExecuted(result.getExecutedStatements());
private static HashSet<String> getMoreClassesToReset(TestCase tc, ExecutionResult result) { HashSet<String> moreClassesForStaticReset = new HashSet<String>(); for (int position = 0; position < result.getExecutedStatements(); position++) { Statement statement = tc.getStatement(position); for (int i = fieldStatement.getPosition() + 1; i < result.getExecutedStatements(); i++) { Statement invokedStatement = tc.getStatement(i); if (invokedStatement.references(fieldReference)) {