/** Test run one Test successfully. */ @Test public void testRunsSuccessfully() { TestProtocolService protocolService = new TestProtocolService(); TestCase testCase = new TestCase(); testCase.setName("TestCase1"); protocolService.set(testCase, new TestResult()); TestResult testResult = protocolService.get(testCase); assertNotNull(testResult); assertTrue(!testResult.isSuccessfully()); }
/** Test was never run before. */ @Test public void testNeverRuns() { TestResult testResult = new TestResult(); testResult.setWrong(1); TestCase testCase = new TestCase(); testCase.setName("TestCase3"); testResult = new TestProtocolService().get(testCase); assertNull(testResult); }
/** Test Protocol on execute a TestSuite that contains referred Testcases. */ @Test public void testRunSuiteWithReferedTestCases() { TestProtocolService protocolService = new TestProtocolService(); TestResult testResult = new TestResult(); TestResult tcTestResult = new TestResult(); tcTestResult.setFullName("MyName"); testResult.add(tcTestResult); TestSuite testSuite = new TestSuite(); protocolService.set(testSuite, testResult); assertNotNull(protocolService.get(testSuite)); TestCase testCase = new TestCase(); testCase.setName("MyName"); testSuite.addReferredTestStructure(testCase); assertNotNull(protocolService.get(testCase)); }
/** Test Protocol on execute a TestSuite that has Children. */ @Test public void testRunSuiteWithChildren() { TestProtocolService protocolService = new TestProtocolService(); TestCase testCase = new TestCase(); testCase.setName("MyName"); TestSuite testSuite = new TestSuite(); testSuite.addChild(testCase); TestResult testResult = new TestResult(); TestResult tcTestResult = new TestResult(); tcTestResult.setFullName(testCase.getFullName()); testResult.add(tcTestResult); assertTrue(testResult.isSuite()); protocolService.set(testSuite, testResult); assertNotNull(protocolService.get(testSuite)); assertNotNull(protocolService.get(testCase)); }
/** Test run one Test not successfully. */ @Test public void testRunsNotSuccessfully() { TestProtocolService protocolService = new TestProtocolService(); TestResult testResult = new TestResult(); testResult.setException(0); testResult.setIgnored(0); testResult.setRight(0); testResult.setWrong(1); TestCase testCase = new TestCase(); testCase.setName("TestCase2"); protocolService.set(testCase, testResult); testResult = protocolService.get(testCase); assertNotNull(testResult); assertFalse(testResult.isSuccessfully()); }