/src/test/java/com/atlassian/bamboo/plugin/dotnet/tests/NUnitResultsParserTest.java
Java | 57 lines | 43 code | 7 blank | 7 comment | 0 complexity | 94e55af0445f0100c96ff159f60e991c MD5 | raw file
Possible License(s): BSD-3-Clause
- /**
- *
- */
- package com.atlassian.bamboo.plugin.dotnet.tests;
- import com.atlassian.bamboo.plugin.dotnet.tests.nunit.NUnitXmlTestResultsParser;
- import com.atlassian.bamboo.utils.BambooTestUtils;
- import org.jetbrains.annotations.NotNull;
- import org.junit.Test;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertFalse;
- import static org.junit.Assert.assertTrue;
- /**
- * @author Ross Rowe
- *
- */
- public class NUnitResultsParserTest
- {
-
- private static final String TEST_RESULT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResult.xml";
- private static final String TEST_FAILURE_RESULT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResultFailure.xml";
- private static final String TEST_RESULT_CATEGORYIES_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResultCategories.xml";
- private static final String XUNIT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/ark.nunit.output.xml";
- @Test
- public void testParseSampleFile() throws Exception {
- NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
- parser.parse(BambooTestUtils.getInputStream(TEST_RESULT_FILE));
- assertFalse(parser.getSuccessfulTests().isEmpty());
- assertTrue(parser.getFailedTests().isEmpty());
- }
- @Test
- public void testParseXUnitFile() throws Exception {
- NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
- parser.parse(BambooTestUtils.getInputStream(XUNIT_FILE));
- assertFalse(parser.getSuccessfulTests().isEmpty());
- assertTrue(parser.getFailedTests().isEmpty());
- }
-
- @Test
- public void testParseFileWithFailures() throws Exception {
- NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
- parser.parse(BambooTestUtils.getInputStream(TEST_FAILURE_RESULT_FILE));
- assertFalse(parser.getSuccessfulTests().isEmpty());
- assertFalse(parser.getFailedTests().isEmpty());
- }
- @Test
- public void testParseFileWithCategories() throws Exception {
- NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
- parser.parse(BambooTestUtils.getInputStream(TEST_RESULT_CATEGORYIES_FILE));
- assertFalse(parser.getSuccessfulTests().isEmpty());
- assertTrue(parser.getFailedTests().isEmpty());
- }
- }