org.jboss.arquillian.test.spi.annotation.TestScoped Java Examples
The following examples show how to use
org.jboss.arquillian.test.spi.annotation.TestScoped.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeSuiteTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeSuite()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new After(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordSuiteVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordSuiteVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #2
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeClassTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeClass()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordClassVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordClassVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #3
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeTestTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeTest()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #4
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void defaultConfigurationTest() throws Exception { // by default, no videos are taken at all fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 0); assertEventFired(StartRecordVideo.class, 0); assertEventFired(StartRecordSuiteVideo.class, 0); assertEventFired(AfterVideoStart.class, 0); assertEventFired(BeforeVideoStop.class, 0); assertEventFired(StopRecordVideo.class, 0); assertEventFired(StopRecordSuiteVideo.class, 0); assertEventFired(AfterVideoStop.class, 0); }
Example #5
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void takeOnlyOnFailTestFailedTest() throws Exception { Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.failed(new RuntimeException("some exception"))); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(PropertyReportEvent.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #6
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void takeOnlyOnFailTestPassedTest() throws Exception { Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(PropertyReportEvent.class, 0); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #7
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void afterTestEventTakeAfterTestTrue() throws Exception { Mockito.when(configuration.getTakeAfterTest()).thenReturn(true); fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"), LifecycleMethodExecutor.NO_OP)); assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #8
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void afterTestEventTestStatusFailedTakeAfterTestTrueTakeWhenFailedFalse() throws Exception { Mockito.when(configuration.getTakeAfterTest()).thenReturn(true); Mockito.when(configuration.getTakeWhenTestFailed()).thenReturn(false); fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"))); bind(TestScoped.class, TestResult.class, TestResult.failed(new RuntimeException())); fire(new AfterRules(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"), LifecycleMethodExecutor.NO_OP)); assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #9
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void afterTestEventTestStatusFailedTakeAfterTestTrueTakeWhenFailedTrue() throws Exception { Mockito.when(configuration.getTakeAfterTest()).thenReturn(true); Mockito.when(configuration.getTakeWhenTestFailed()).thenReturn(true); fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"))); bind(TestScoped.class, TestResult.class, TestResult.failed(new RuntimeException())); fire(new AfterRules(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"), LifecycleMethodExecutor.NO_OP)); assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #10
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void afterTestEventTestStatusPassed() throws Exception { Mockito.when(configuration.getTakeAfterTest()).thenReturn(true); fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest"), LifecycleMethodExecutor.NO_OP)); assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #11
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void takeBeforeTestTrueScreenshotMethodTest() throws Exception { Mockito.when(configuration.getTakeBeforeTest()).thenReturn(false); // false in config fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); // true in annotation fire(new Before(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeBeforeTestTrueMethod"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeBeforeTestTrueMethod"), LifecycleMethodExecutor.NO_OP)); // so we take it assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #12
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void takeBeforeTestFalseScreenshotMethodTest() throws Exception { Mockito.when(configuration.getTakeBeforeTest()).thenReturn(true); // true in config fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); // false in annotation fire(new Before(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeBeforeTestFalseMethod"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeBeforeTestFalseMethod"), LifecycleMethodExecutor.NO_OP)); // so we dont take it assertEventFired(BeforeScreenshotTaken.class, 0); assertEventFired(TakeScreenshot.class, 0); assertEventFired(AfterScreenshotTaken.class, 0); }
Example #13
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void takeAfterTestTrueScreenshotMethodTest() throws Exception { Mockito.when(configuration.getTakeAfterTest()).thenReturn(false); // false in config fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); // true in annotation fire(new Before(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeAfterTestMethod"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeAfterTestMethod"), LifecycleMethodExecutor.NO_OP)); // so we take it assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }
Example #14
Source File: ScreenshooterLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 4 votes |
@Test public void takeWhenTestFailedTrueScreenshotMethodTest() throws Exception { Mockito.when(configuration.getTakeWhenTestFailed()).thenReturn(false); // false in config fire(new ScreenshooterExtensionConfigured()); initRecorderStrategyRegister(); // true in annotation fire(new Before(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeWhenTestFailedMethod"))); bind(TestScoped.class, TestResult.class, TestResult.failed(new Throwable())); fire(new AfterRules(FakeAnnotatedClass.class, FakeAnnotatedClass.class.getMethod("takeWhenTestFailedMethod"), LifecycleMethodExecutor.NO_OP)); // so we take it assertEventFired(BeforeScreenshotTaken.class, 1); assertEventFired(TakeScreenshot.class, 1); assertEventFired(AfterScreenshotTaken.class, 1); }