@Override public void result(Result result) { if (result.getError() != null) { // If the result contains an error, report a failure. testResult.putString(REPORT_KEY_STACK, result.getErrorMessage()); resultCode = REPORT_VALUE_RESULT_FAILURE; testResult.putString(Instrumentation.REPORT_KEY_STREAMRESULT, result.getErrorMessage()); } else if (result.getStatus().equals("undefined")) { // There was a missing step definition, report an error. List<String> snippets = runtime.getSnippets(); String report = String.format( "Missing step-definition\n\n%s\nfor step '%s'", snippets.get(snippets.size() - 1), currentStep.getName()); testResult.putString(REPORT_KEY_STACK, report); resultCode = REPORT_VALUE_RESULT_ERROR; testResult.putString( Instrumentation.REPORT_KEY_STREAMRESULT, String.format("Missing step-definition: %s", currentStep.getName())); } }
private void saveSteps(Routine routine, SQLiteDatabase database) { ContentValues values = new ContentValues(); int stepId = this.selectMaxStepId() + 1; int stepOrdinal = 1; for (Step step : routine.getSteps()) { values.clear(); values.put(DbHelper.STEP_ID, stepId); values.put(DbHelper.STEP_NAME, step.getName()); values.put(DbHelper.STEP_ORDINAL, stepOrdinal); values.put(DbHelper.STEP_SECONDS, step.getDurationSeconds()); values.put(DbHelper.STEP_ROUTINE_ID, routine.getId()); stepId++; stepOrdinal++; database.insertOrThrow(DbHelper.STEPS, null, values); } }