use of io.jenkins.blueocean.rest.factory.BlueTestResultFactory.Result in project blueocean-plugin by jenkinsci.
the class BlueTestResultContainerImpl method get.
@Override
public BlueTestResult get(final String name) {
Result resolved = resolve();
if (resolved.summary == null || resolved.results == null) {
throw new NotFoundException("no tests");
}
BlueTestResult testResult = IterableUtils.find(resolved.results, blueTestResult -> blueTestResult != null && blueTestResult.getId().equals(name), null);
if (testResult == null) {
throw new NotFoundException("not found");
}
return testResult;
}
use of io.jenkins.blueocean.rest.factory.BlueTestResultFactory.Result in project blueocean-plugin by jenkinsci.
the class BlueTestResultContainerImpl method iterator.
@NonNull
@Override
public Iterator<BlueTestResult> iterator() {
Result resolved = resolve();
if (resolved.summary == null || resolved.results == null) {
throw new NotFoundException("no tests");
}
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
String status = request.getParameter("status");
String state = request.getParameter("state");
String age = request.getParameter("age");
return getBlueTestResultIterator(resolved.results, status, state, age);
}
return resolved.results.iterator();
}
use of io.jenkins.blueocean.rest.factory.BlueTestResultFactory.Result in project blueocean-plugin by jenkinsci.
the class BlueTestResultFactoryTest method testFactoryReturnsZeroTestsForNode.
@Test
public void testFactoryReturnsZeroTestsForNode() {
testsToReturn = 0;
Run<?, ?> run = mock(Run.class);
BluePipelineNode node = mock(BluePipelineNode.class);
Result resolved = BlueTestResultFactory.resolve(run, node);
assertNull(resolved.summary);
assertNull(resolved.results);
}
use of io.jenkins.blueocean.rest.factory.BlueTestResultFactory.Result in project blueocean-plugin by jenkinsci.
the class BlueTestResultFactoryTest method testFactoryReturnsZeroTests.
@Test
public void testFactoryReturnsZeroTests() {
testsToReturn = 0;
Run<?, ?> run = mock(Run.class);
Result resolved = BlueTestResultFactory.resolve(run, null);
assertNull(resolved.summary);
assertNull(resolved.results);
}
use of io.jenkins.blueocean.rest.factory.BlueTestResultFactory.Result in project blueocean-plugin by jenkinsci.
the class BlueTestResultFactoryTest method testFactory.
@Test
public void testFactory() {
Run<?, ?> run = mock(Run.class);
Result resolved = BlueTestResultFactory.resolve(run, null);
assertNotNull(resolved.summary);
assertEquals(12, resolved.summary.getTotal());
assertEquals(6, resolved.summary.getPassedTotal());
assertEquals(2, resolved.summary.getSkippedTotal());
assertEquals(4, resolved.summary.getFailedTotal());
assertEquals(2, resolved.summary.getRegressionsTotal());
assertEquals(2, resolved.summary.getFixedTotal());
assertEquals(2, resolved.summary.getExistingFailedTotal());
}
Aggregations