/** * @param testTask the testTask to be executed * @param testSuite the TestSuite wrapper for the testTask * @param environment the environment configuration */ public void runTestTask(TestTask testTask, TestSuite testSuite, Environment environment) { /* * check if all mandatory fields are set */ ProcessStatus notNullCheck = NullCheckWrapperUtil.checkIfNotNull(testTask, "id", "method", "resource"); if (notNullCheck.isPassed()) { /* Run the http calls */ try { resourceInvocationHandler.executeResourceCalls(testTask, testSuite); /* Run the status check assertions if set */ if (testTask.getStatusCheck() != null) { assertionExecutor.executeStatusAssertion(testTask, testSuite); } /* Run the value assertions if set */ if (testTask.getAssertions() != null && testTask.getAssertions().size() > 0) { for (ValueAssertion assertion : testTask.getAssertions()) { assertionExecutor.executeAssertion(assertion, testSuite.getTestContext()); if (!assertion.isPassed()) { testSuite.setFailureCount(testSuite.getFailureCount() + 1); testTask.setPassed(false); } } } } catch (IOException e) { LOGGER.error("IO Exception when executing testSuiteId " + testSuite.getId(), e); testTask.setError(e.getMessage()); } catch (JsonPathException e) { LOGGER.error("Json path Exception when executing testSuiteId " + testSuite.getId(), e); testTask.setError(e.getMessage()); } catch (InvalidExpressionException e) { LOGGER.error("InvalidExpression when executing testSuiteId" + testSuite.getId(), e); testTask.setError(e.getMessage()); } } else { testTask.setError(notNullCheck.getMessage()); } }