@Before public void reset() throws IOException, RestException { // skip test if it matches one of the blacklist globs for (PathMatcher blacklistedPathMatcher : blacklistPathMatchers) { // we need to replace a few characters otherwise the test section name can't be parsed as a // path on windows String testSection = testCandidate .getTestSection() .getName() .replace("*", "") .replace("\\", "/") .replaceAll("\\s+/", "/") .trim(); String testPath = testCandidate.getSuitePath() + "/" + testSection; assumeFalse( "[" + testCandidate.getTestPath() + "] skipped, reason: blacklisted", blacklistedPathMatcher.matches(Paths.get(testPath))); } // The client needs non static info to get initialized, therefore it can't be initialized in the // before class restTestExecutionContext.initClient(cluster().httpAddresses(), restClientSettings()); restTestExecutionContext.clear(); // skip test if the whole suite (yaml file) is disabled assumeFalse( buildSkipMessage( testCandidate.getSuitePath(), testCandidate.getSetupSection().getSkipSection()), testCandidate .getSetupSection() .getSkipSection() .skip(restTestExecutionContext.esVersion())); // skip test if test section is disabled assumeFalse( buildSkipMessage( testCandidate.getTestPath(), testCandidate.getTestSection().getSkipSection()), testCandidate.getTestSection().getSkipSection().skip(restTestExecutionContext.esVersion())); }
@Test public void test() throws IOException { // let's check that there is something to run, otherwise there might be a problem with the test // section if (testCandidate.getTestSection().getExecutableSections().size() == 0) { throw new IllegalArgumentException( "No executable sections loaded for [" + testCandidate.getTestPath() + "]"); } if (!testCandidate.getSetupSection().isEmpty()) { logger.info("start setup test [{}]", testCandidate.getTestPath()); for (DoSection doSection : testCandidate.getSetupSection().getDoSections()) { doSection.execute(restTestExecutionContext); } logger.info("end setup test [{}]", testCandidate.getTestPath()); } restTestExecutionContext.clear(); for (ExecutableSection executableSection : testCandidate.getTestSection().getExecutableSections()) { executableSection.execute(restTestExecutionContext); } }