use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method shouldNotCauseExceptionIfFilesAreNotAvailable.
@Test
public void shouldNotCauseExceptionIfFilesAreNotAvailable() throws Exception {
rootFolder = new File("root");
final File testOutput = new File(rootFolder, "testoutputxxxxxxx");
HashMap map = new HashMap();
map.put("artifactfolder", testOutput);
jobInstanceLog = new JobInstanceLog(null, map);
assertThat(jobInstanceLog.getTestIndexPage(), is(nullValue()));
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method setUp.
@Before
public void setUp() {
context = new Mockery();
context.setImposteriser(ClassImposteriser.INSTANCE);
jobInstanceLog = new JobInstanceLog(null, new HashMap());
defaultLogFile = new LogFile(new File("log20051209122103.xml"));
rootFolder = new File("root");
rootFolder.mkdirs();
env = new SystemEnvironment();
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method canGetNumberOfTestsFromBuild.
@Test
public void canGetNumberOfTestsFromBuild() {
BuildTestSuite suiteWithFiveTests = new BuildTestSuite("", 0.0f);
suiteWithFiveTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFiveTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFiveTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFiveTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFiveTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
BuildTestSuite suiteWithFourTests = new BuildTestSuite("", 0.0f);
suiteWithFourTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFourTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFourTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
suiteWithFourTests.addTestCase(new BuildTestCase(null, null, null, null, null, null));
List nineTests = new ArrayList();
nineTests.add(suiteWithFiveTests);
nineTests.add(suiteWithFourTests);
Map props = new HashMap();
props.put("testsuites", nineTests);
JobInstanceLog laterJob = new JobInstanceLog(defaultLogFile, props);
assertEquals(9, laterJob.getNumberOfTests());
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method canGetNumberOfFailedTests.
@Test
public void canGetNumberOfFailedTests() {
BuildTestSuite suiteWithTwoFailures = new BuildTestSuite("", 0.0f);
suiteWithTwoFailures.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.FAILED));
suiteWithTwoFailures.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.FAILED));
BuildTestSuite suiteWithOneFailure = new BuildTestSuite("", 0.0f);
suiteWithOneFailure.addTestCase(new BuildTestCase(null, null, null, null, null, BuildTestCaseResult.FAILED));
List threeFailures = new ArrayList();
threeFailures.add(suiteWithTwoFailures);
threeFailures.add(suiteWithOneFailure);
Map props = new HashMap();
props.put("testsuites", threeFailures);
JobInstanceLog laterJob = new JobInstanceLog(defaultLogFile, props);
assertEquals(3, laterJob.getNumberOfFailures());
}
use of com.thoughtworks.go.domain.JobInstanceLog in project gocd by gocd.
the class JobInstanceLogTest method shouldFindIndexPageFromTestOutput.
@Test
public void shouldFindIndexPageFromTestOutput() throws Exception {
rootFolder = new File("root");
final File testOutput = new File(rootFolder, "testoutput");
testOutput.mkdirs();
File indexHtml = new File(testOutput, "index.html");
FileOutputStream fileOutputStream = new FileOutputStream(indexHtml);
IOUtils.write("Test", fileOutputStream);
IOUtils.closeQuietly(fileOutputStream);
HashMap map = new HashMap();
map.put("artifactfolder", rootFolder);
jobInstanceLog = new JobInstanceLog(null, map);
assertThat(jobInstanceLog.getTestIndexPage(), is(indexHtml));
}
Aggregations