SoapUIRecipeExecutor implements RecipeExecutor { @Override public Execution executeRecipe(TestRecipe recipe) { applyRecipeFilters(recipe); return postRecipe(recipe, false); }  @Override Execution submitRecipe(TestRecipe recipe); @Override Execution executeRecipe(TestRecipe recipe); @Override void addExecutionListener(ExecutionListener listener); @Override void removeExecutionListener(ExecutionListener listener); @Override void addRecipeFilter(RecipeFilter recipeFilter); @Override void removeRecipeFilter(RecipeFilter recipeFilter); @Override ExecutionMode getExecutionMode();  }
@Test public void runsMinimalProject() throws Exception { TestRecipe testRecipe = newTestRecipe( groovyScriptStep("println 'Hello Earth'") ).buildTestRecipe(); Execution execution = executor.executeRecipe(testRecipe); assertThat(execution.getId(), is(not(nullValue()))); assertThat(execution.getCurrentStatus(), is(TestJobReport.StatusEnum.FINISHED)); }
@Test public void runsRestGetRequestJson() throws Exception { TestRecipe testRecipe = newTestRecipe( GET(serverURL) .acceptsJson() .assertJsonContent(ASSERTION_KEY, ASSERTION_TEST_VALUE) ).buildTestRecipe(); Execution execution = executor.executeRecipe(testRecipe); assertThat(execution.getId(), is(not(nullValue()))); assertThat(execution.getCurrentStatus(), is(TestJobReport.StatusEnum.FINISHED)); HarResponse harResponse = execution.getExecutionResult().getTestStepResult(0).getHarEntry().getResponse(); assertThat(harResponse, is(not(nullValue()))); assertEquals("{\"message\":\"Hello World\"}", harResponse.getContent().getText()); }
@Test public void runsPropertyTransferRequest() { TestRecipe testRecipe = newTestRecipe( GET(serverURL) .named(REST_SOURCE) .acceptsJson() .assertJsonContent(ASSERTION_KEY, ASSERTION_TEST_VALUE), propertyTransfer() .addTransfer(from(aSource() .withSourceStep(REST_SOURCE) .withProperty(PROPERTY_ENDPOINT)) .to(aTarget() .withTargetStep(REST_TARGET) .withProperty(PROPERTY_ENDPOINT))), GET(BOGUS_URL) .named(REST_TARGET) .acceptsJson() .assertJsonContent(ASSERTION_KEY, ASSERTION_ROOT_VALUE) ).buildTestRecipe(); Execution execution = executor.executeRecipe(testRecipe); assertThat(execution.getId(), is(not(nullValue()))); assertThat(execution.getCurrentStatus(), is(TestJobReport.StatusEnum.FINISHED)); }
@Test public void runsPropertyTransferRequestWithJsonPathExtraction() { TestRecipe testRecipe = buildPropertyTransferWithJsonPathExtractionTestRecipe(); Execution execution = executor.executeRecipe(testRecipe); assertThat(execution.getId(), is(not(nullValue()))); assertThat(execution.getCurrentStatus(), is(TestJobReport.StatusEnum.FINISHED)); assertThat(getPostedJsonTestObject(), is(testObject)); }
@Test public void extractsDataAfterRecipeExecution() { final String[] extractedProperty = {""}; TestRecipe recipe = newTestRecipe( POST(URI) .named("RestRequest") .withExtractors( fromProperty("Endpoint", property -> extractedProperty[0] = property))) .buildTestRecipe(); assertThat(recipe.getTestCase().getProperties().size(), is(2)); assertThat(recipe.getTestCase().getProperties().get("Endpoint" + recipe.getExtractorData().getExtractorDataId()), is("")); assertThat(recipe.getTestCase().getProperties().get(ExtractorData.EXTRACTOR_DATA_KEY), is(not(nullValue()))); Execution execution = executor.executeRecipe(recipe); assertThat(execution.getCurrentStatus(), is(TestJobReport.StatusEnum.FINISHED)); assertThat(extractedProperty[0], is(GOOGLE_ENDPOINT)); }