Package net.thucydides.core.batches

Examples of net.thucydides.core.batches.SystemVariableBasedBatchManager


    public void initMocks() {
        environmentVariables = new MockEnvironmentVariables();
    }
    @Test
    public void should_keep_a_counter_of_tests_being_executed() {
        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        assertThat(batchManager.getCurrentTestCaseNumber(), is(0));

        batchManager.registerTestCase(WhenCoordinatingTestBatches.class);

        assertThat(batchManager.getCurrentTestCaseNumber(), is(1));

    }
View Full Code Here


    }


    @Test
    public void by_default_all_tests_should_run() {
        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        int executedTests = 0;
        for(int i = 0; i < 50; i++) {
            if (batchManager.shouldExecuteThisTest(1)) {
                executedTests++;
            }
        }

        assertThat(executedTests, is(50));
View Full Code Here

    @Test
    public void should_flag_every_n_tests_to_be_run() {
        environmentVariables.setProperty("thucydides.batch.size", "10");
        environmentVariables.setProperty("thucydides.batch.number", "1");

        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        List<Integer> executedTests = new ArrayList<Integer>();
        for(int testNumber = 1; testNumber <= 50; testNumber++) {
            batchManager.registerTestCase("Test Case " + testNumber);
            if (batchManager.shouldExecuteThisTest(1)) {
                executedTests.add(testNumber);
            }
        }

        assertThat(executedTests.size(), is(5));
View Full Code Here

    @Test
    public void should_support_the_old_batch_count_property() {
        environmentVariables.setProperty("thucydides.batch.count", "10");
        environmentVariables.setProperty("thucydides.batch.number", "1");

        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        List<Integer> executedTests = new ArrayList<Integer>();
        for(int testNumber = 1; testNumber <= 50; testNumber++) {
            batchManager.registerTestCase("Test Case " + testNumber);
            if (batchManager.shouldExecuteThisTest(1)) {
                executedTests.add(testNumber);
            }
        }

        assertThat(executedTests.size(), is(5));
View Full Code Here

    @Test
    public void should_flag_every_2nd_tests_to_be_run() {
        environmentVariables.setProperty("thucydides.batch.size", "10");
        environmentVariables.setProperty("thucydides.batch.number", "2");

        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        List<Integer> executedTests = new ArrayList<Integer>();
        for(int testNumber = 1; testNumber <= 50; testNumber++) {
            batchManager.registerTestCase("Test Case " + testNumber);
            if (batchManager.shouldExecuteThisTest(1)) {
                executedTests.add(testNumber);
            }
        }

        assertThat(executedTests.size(), is(5));
View Full Code Here

    @Test
    public void should_handle_tests_being_run_in_parallel() {
        environmentVariables.setProperty("thucydides.batch.size", "10");

        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(environmentVariables);

        List<Integer> executedTests = new ArrayList<Integer>();
        for(int testNumber = 1; testNumber <= 50; testNumber++) {
            batchManager.registerTestCase("Test Case " + testNumber);
            if (batchManager.shouldExecuteThisTest(1)) {
                executedTests.add(testNumber);
            }
        }

        assertThat(executedTests.size(), is(5));
View Full Code Here

        List<List<Integer>> executedTestResults = new ArrayList<List<Integer>>();
        for(int i = 1; i <= 10; i++) {
            MockEnvironmentVariables threadVariables = new MockEnvironmentVariables();
            threadVariables.setProperty("thucydides.batch.count", "10");
            threadVariables.setProperty("thucydides.batch.number", Integer.toString(i));
            SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(threadVariables);
            List<Integer> executedTests = new ArrayList<Integer>();
            executedTestResults.add(executedTests);
            runFiftyTestCases(batchManager, executedTests);
        }
View Full Code Here

        for(int i = 1; i <= 10; i++) {
            MockEnvironmentVariables threadVariables = new MockEnvironmentVariables();
            threadVariables.setProperty("thucydides.batch.count", "10");
            threadVariables.setProperty("thucydides.batch.number", Integer.toString(i));
            SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(threadVariables);
            threads.add(new TestRunnerThread(batchManager));
        }

        for(TestRunnerThread thread : threads) {
            thread.start();
View Full Code Here

    public void the_thread_for_batch_1_should_only_run_tests_in_that_batch() throws InitializationError, InterruptedException {

        MockEnvironmentVariables threadVariables = new MockEnvironmentVariables();
        threadVariables.setProperty("thucydides.batch.count", "3");
        threadVariables.setProperty("thucydides.batch.number", Integer.toString(1));
        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(threadVariables);

        runTestCases(batchManager);

        assertThat(executedTests.size(), is(3));
        assertThat(executedTests, hasItems(1, 4, 7));
View Full Code Here

    public void the_thread_for_batch_2_should_only_run_tests_in_that_batch() throws InitializationError, InterruptedException {

        MockEnvironmentVariables threadVariables = new MockEnvironmentVariables();
        threadVariables.setProperty("thucydides.batch.count", "3");
        threadVariables.setProperty("thucydides.batch.number", Integer.toString(2));
        SystemVariableBasedBatchManager batchManager = new SystemVariableBasedBatchManager(threadVariables);

        runTestCases(batchManager);

        assertThat(executedTests.size(), is(3));
        assertThat(executedTests, hasItems(2, 5, 8));
View Full Code Here

TOP

Related Classes of net.thucydides.core.batches.SystemVariableBasedBatchManager

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.