@Override protected void setUp() throws Exception { super.setUp(); java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE); project = createFreeStyleProject(projectName); DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> publishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>( project); publishers.add(new QuarantineTestDataPublisher()); QuarantinableJUnitResultArchiver archiver = new QuarantinableJUnitResultArchiver("*.xml"); archiver.setTestDataPublishers(publishers); project.getPublishersList().add(archiver); hudson.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy()); hudson.setSecurityRealm(createDummySecurityRealm()); }
@Override protected void setUp() throws Exception { super.setUp(); java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE); project = createFreeStyleProject(projectName); DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> publishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>( project); publishers.add(new QuarantineTestDataPublisher()); QuarantinableJUnitResultArchiver archiver = new QuarantinableJUnitResultArchiver("*.xml"); archiver.setTestDataPublishers(publishers); project.getPublishersList().add(archiver); hudson.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy()); hudson.setSecurityRealm(createDummySecurityRealm()); User u = User.get("user1"); u.addProperty(new Mailer.UserProperty(user1Mail)); }
public void testNoTestsHaveQuarantineActionForStandardPublisher() throws Exception { project.getPublishersList().remove(QuarantinableJUnitResultArchiver.class); DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> publishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>( project); publishers.add(new QuarantineTestDataPublisher()); project.getPublishersList().add(new JUnitResultArchiver("*.xml", false, publishers)); TestResult tr = getResultsFromJUnitResult("junit-1-failure.xml"); for (SuiteResult suite : tr.getSuites()) { for (CaseResult result : suite.getCases()) { assertNull(result.getTestAction(QuarantineTestAction.class)); } } }
@Override public boolean perform(DynamicBuild dynamicBuild, Launcher launcher, BuildListener listener) { String files = getPluginInputFiles(); listener.getLogger().println(String.format("Archiving JUnit results: '%s'", files)); DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>(Saveable.NOOP); JUnitResultArchiver publisher = new JUnitResultArchiver(files, true, testDataPublishers); try { return publisher.perform(((AbstractBuild) dynamicBuild), launcher, listener); } catch (Exception e) { listener.getLogger().println(String.format("FAILED archiving JUnit results: %s", e.toString())); return false; } }