PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/java/com/atlassian/bamboo/plugin/dotnet/tests/NUnitResultsParserTest.java

https://bitbucket.org/atlassian/bamboo-dotnet-plugin/
Java | 57 lines | 43 code | 7 blank | 7 comment | 0 complexity | 94e55af0445f0100c96ff159f60e991c MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /**
  2. *
  3. */
  4. package com.atlassian.bamboo.plugin.dotnet.tests;
  5. import com.atlassian.bamboo.plugin.dotnet.tests.nunit.NUnitXmlTestResultsParser;
  6. import com.atlassian.bamboo.utils.BambooTestUtils;
  7. import org.jetbrains.annotations.NotNull;
  8. import org.junit.Test;
  9. import static org.junit.Assert.assertEquals;
  10. import static org.junit.Assert.assertFalse;
  11. import static org.junit.Assert.assertTrue;
  12. /**
  13. * @author Ross Rowe
  14. *
  15. */
  16. public class NUnitResultsParserTest
  17. {
  18. private static final String TEST_RESULT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResult.xml";
  19. private static final String TEST_FAILURE_RESULT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResultFailure.xml";
  20. private static final String TEST_RESULT_CATEGORYIES_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/TestResultCategories.xml";
  21. private static final String XUNIT_FILE = "com/atlassian/bamboo/plugin/dotnet/tests/ark.nunit.output.xml";
  22. @Test
  23. public void testParseSampleFile() throws Exception {
  24. NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
  25. parser.parse(BambooTestUtils.getInputStream(TEST_RESULT_FILE));
  26. assertFalse(parser.getSuccessfulTests().isEmpty());
  27. assertTrue(parser.getFailedTests().isEmpty());
  28. }
  29. @Test
  30. public void testParseXUnitFile() throws Exception {
  31. NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
  32. parser.parse(BambooTestUtils.getInputStream(XUNIT_FILE));
  33. assertFalse(parser.getSuccessfulTests().isEmpty());
  34. assertTrue(parser.getFailedTests().isEmpty());
  35. }
  36. @Test
  37. public void testParseFileWithFailures() throws Exception {
  38. NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
  39. parser.parse(BambooTestUtils.getInputStream(TEST_FAILURE_RESULT_FILE));
  40. assertFalse(parser.getSuccessfulTests().isEmpty());
  41. assertFalse(parser.getFailedTests().isEmpty());
  42. }
  43. @Test
  44. public void testParseFileWithCategories() throws Exception {
  45. NUnitXmlTestResultsParser parser = new NUnitXmlTestResultsParser();
  46. parser.parse(BambooTestUtils.getInputStream(TEST_RESULT_CATEGORYIES_FILE));
  47. assertFalse(parser.getSuccessfulTests().isEmpty());
  48. assertTrue(parser.getFailedTests().isEmpty());
  49. }
  50. }