Package org.jboss.arquillian.test.spi.event.suite

Examples of org.jboss.arquillian.test.spi.event.suite.Before


            }
        }
    }

    private void executeTest(Object inspection, Method method, Annotation annotation) {
        before.fire(new Before(inspection, method));

        test.fire(new Test(new LifecycleMethodExecutor(inspection, method, annotation)));

        after.fire(new After(inspection, method));
    }
View Full Code Here


        HTTPContext context = ModulesApi.findHTTPContext(configuration, protocolMetaData, method);
        return context.getServlets().get(0).getBaseURI();
    }

    public void login(@Observes EventContext<Before> event) throws Exception {
        Before before = event.getEvent();

        UserIsLoggedIn userIsLoggedIn = null;
        if (before.getTestMethod().isAnnotationPresent(UserIsLoggedIn.class)) {
            userIsLoggedIn = before.getTestMethod().getAnnotation(UserIsLoggedIn.class);
        } else if (before.getTestClass().isAnnotationPresent(UserIsLoggedIn.class)) {
            userIsLoggedIn = before.getTestClass().getAnnotation(UserIsLoggedIn.class);
        }

        if (userIsLoggedIn != null) {
            final URI baseUri = getBaseURI(before.getTestMethod());
            final WebDriver driver = createWebDriver();
            try {
                driver.manage().deleteAllCookies();

                driver.navigate().to(baseUri + USER_LOGIN_SERVLET_PATH + "?location=" + URLEncoder.encode(userIsLoggedIn.location(), "UTF-8"));
View Full Code Here

    public void beforeTestEventTakeBeforeTestFalse() throws Exception {

        Mockito.when(configuration.getTakeBeforeTest()).thenReturn(false);

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        assertEventFired(BeforeScreenshotTaken.class, 0);
        assertEventFired(TakeScreenshot.class, 0);
        assertEventFired(AfterScreenshotTaken.class, 0);
    }
View Full Code Here

        Mockito.when(configuration.getTakeBeforeTest()).thenReturn(true);
        Mockito.when(configuration.getScreenshotType()).thenReturn("PNG");

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        assertEventFired(BeforeScreenshotTaken.class, 1);
        assertEventFired(TakeScreenshot.class, 1);
        assertEventFired(AfterScreenshotTaken.class, 1);
    }
View Full Code Here

        Mockito.when(configuration.getTakeAfterTest()).thenReturn(true);
        Mockito.when(configuration.getScreenshotType()).thenReturn("PNG");

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        bind(TestScoped.class, TestResult.class, new TestResult(Status.PASSED));

        fire(new After(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));
View Full Code Here

        Mockito.when(configuration.getTakeAfterTest()).thenReturn(true);
        Mockito.when(configuration.getScreenshotType()).thenReturn("PNG");
        Mockito.when(configuration.getTakeWhenTestFailed()).thenReturn(false);

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        bind(TestScoped.class, TestResult.class, new TestResult(Status.FAILED));

        fire(new After(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));
View Full Code Here

        Mockito.when(configuration.getTakeAfterTest()).thenReturn(true);
        Mockito.when(configuration.getScreenshotType()).thenReturn("PNG");
        Mockito.when(configuration.getTakeWhenTestFailed()).thenReturn(true);

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        bind(TestScoped.class, TestResult.class, new TestResult(Status.FAILED));

        fire(new After(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));
View Full Code Here

        Mockito.when(configuration.getTakeAfterTest()).thenReturn(true);
        Mockito.when(configuration.getScreenshotType()).thenReturn("PNG");

        fire(new ScreenshooterExtensionConfigured());
        fire(new Before(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));

        bind(TestScoped.class, TestResult.class, new TestResult(Status.PASSED));

        fire(new After(FakeTestClass.class, FakeTestClass.class.getMethod("fakeTest")));
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.test.spi.event.suite.Before

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.