Package fi.jumi.launcher

Examples of fi.jumi.launcher.JumiBootstrap


    private final StringBuilder out = new StringBuilder();

    @Test
    public void runs_tests_with_current_classpath() throws Exception {
        JumiBootstrap bootstrap = new JumiBootstrap().setTextUiOutput(out);
        bootstrap.suite.setTestClasses(OnePassingTest.class);

        bootstrap.runSuite();

        String out = this.out.toString();
        assertThat("should show test results", out, containsString("Pass: 2"));
        assertThat("should hide passing tests by default", out, not(containsString("OnePassingTest")));
    }
View Full Code Here


        assertThat("should hide passing tests by default", out, not(containsString("OnePassingTest")));
    }

    @Test
    public void reports_failures_by_throwing_AssertionError() throws Exception {
        JumiBootstrap bootstrap = new JumiBootstrap().setTextUiOutput(out);
        bootstrap.suite.setTestClasses(OneFailingTest.class);

        thrown.expect(AssertionError.class);
        thrown.expectMessage("There were test failures");
        bootstrap.runSuite();
    }
View Full Code Here

    }

    @Test
    public void can_debug_the_daemons_actor_messages() throws Exception {
        ByteArrayOutputStream daemonOutput = new ByteArrayOutputStream();
        JumiBootstrap bootstrap = new JumiBootstrap().setTextUiOutput(out).enableDebugMode(daemonOutput);
        bootstrap.suite.setTestClasses(OnePassingTest.class);

        bootstrap.runSuite();

        assertThat(daemonOutput.toString(), containsString("[jumi-actor-1]"));
    }
View Full Code Here

        try {
            ByteArrayOutputStream printed = new ByteArrayOutputStream();
            PrintStream spiedErr = spy(new PrintStream(printed));
            System.setErr(spiedErr);

            JumiBootstrap bootstrap = new JumiBootstrap();
            bootstrap.suite.setTestClasses(OnePassingTest.class);
            bootstrap.daemon.setIdleTimeout(0); // we want the daemon process to exit quickly
            bootstrap.setTextUiOutput(new NullWriter());
            bootstrap.enableDebugMode(); // <-- the thing we are testing
            bootstrap.runSuite();

            Thread.sleep(50); // wait for the daemon process to exit, and our printer thread to notice it
            assertThat("this test has a problem; daemon printed nothing", printed.size(), is(not(0)));
            verify(spiedErr, never()).close(); // <-- the thing we are testing
View Full Code Here

    // configuration

    @Test
    public void passing_tests_are_hidden_by_default() {
        JumiBootstrap bootstrap = new JumiBootstrap();

        assertThat(getFieldValue(bootstrap, "passingTestsVisible"), is((Object) false));
    }
View Full Code Here

        assertThat(getFieldValue(bootstrap, "passingTestsVisible"), is((Object) false));
    }

    @Test
    public void passing_tests_can_be_made_visible() {
        JumiBootstrap bootstrap = new JumiBootstrap().setPassingTestsVisible(true);

        assertThat(getFieldValue(bootstrap, "passingTestsVisible"), is((Object) true));
    }
View Full Code Here

        assertThat(getFieldValue(bootstrap, "passingTestsVisible"), is((Object) true));
    }

    @Test
    public void output_defaults_to_stdout() {
        JumiBootstrap bootstrap = new JumiBootstrap();

        assertThat(getFieldValue(bootstrap, "textUiOutput"), is((Object) System.out));
    }
View Full Code Here

        assertThat(getFieldValue(bootstrap, "textUiOutput"), is((Object) System.out));
    }

    @Test
    public void debug_output_is_disabled_by_default() {
        JumiBootstrap bootstrap = new JumiBootstrap();

        assertThat(getFieldValue(bootstrap, "daemonOutput").getClass().getSimpleName(), is("NullOutputStream"));
        assertThat(bootstrap.daemon.getLogActorMessages(), is(false));
    }
View Full Code Here

        assertThat(bootstrap.daemon.getLogActorMessages(), is(false));
    }

    @Test
    public void debug_output_defaults_to_stderr_when_enabled() throws Exception {
        JumiBootstrap bootstrap = new JumiBootstrap().enableDebugMode();

        assertThat(getDaemonOutput(bootstrap), is((Object) System.err));
        assertThat(bootstrap.daemon.getLogActorMessages(), is(true));
    }
View Full Code Here

import fi.jumi.launcher.JumiBootstrap;

public class JumiSuite {

    public static void main(String[] args) throws Exception {
        JumiBootstrap bootstrap = new JumiBootstrap();
        bootstrap.suite
                .addJvmOptions("-ea")
                .setIncludedTestsPattern("glob:com/example/**Test.class"); // uses Java 7 glob patterns
        bootstrap
                .enableDebugMode() // shows Jumi's internal messaging; can be useful for testing framework developers
                .setPassingTestsVisible(true) // shows full output from all tests, instead of just failing tests
                .runSuite();
    }
View Full Code Here

TOP

Related Classes of fi.jumi.launcher.JumiBootstrap

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.