All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jmms.testing.TestEngine Maven / Gradle / Ivy

/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package jmms.testing;

import jmms.core.Api;
import jmms.core.model.MetaTestSuite;

public interface TestEngine {

    /**
     * Creates a new {@link TestContext}.
     */
    TestContext createTestContext(Api api);

    /**
     * Reloads full engine.
     */
    void reload(Api api);

    /**
     * Drops db and creates again.
     */
    void dropDb(Api api, boolean recreate);

    /**
     * Deletes all data.
     */
    int cleanDb(Api api);

    /**
     * Generates data for all entities.
     *
     * 

* Returns the total created rows. */ int genDb(Api api, int rows); /** * Creates a {@link TestSuite} of the given {@link MetaTestSuite}. */ TestSuite createTestSuite(TestTarget target, MetaTestSuite tests); /** * Run the test suite and returns results. */ default TestResults runTestSuite(TestSuite suite) { return runTestSuite(createTestContext(suite.getApi()), suite); } /** * Run the test suite and returns results. */ default TestResults runTestSuite(TestContext context, TestSuite suite) { return runTestSuite(context, suite, NopTestListener.INSTANCE); } /** * Run the test suite and returns the test results. */ TestResults runTestSuite(TestContext context, TestSuite suite, TestListener listener); /** * Run the test case and returns result. */ default TestResult runTestCase(TestAndSuite testAndSuite) { return runTestCase(testAndSuite.getSuite(), testAndSuite.getTest()); } /** * Run the test case and returns result. */ default TestResult runTestCase(TestSuite suite, TestCase test) { return runTestCase(createTestContext(suite.getApi()), suite, test); } /** * Run the test case and returns result. */ default TestResult runTestCase(TestContext context, TestAndSuite testAndSuite) { return runTestCase(context, testAndSuite.getSuite(), testAndSuite.getTest()); } /** * Run the test case and returns result. */ default TestResult runTestCase(TestContext context, TestSuite suite, TestCase test) { return runTestCase(context, suite, test, NopTestListener.INSTANCE); } /** * Run the test case and returns result. */ TestResult runTestCase(TestContext context, TestSuite suite, TestCase test, TestListener listener); /** * Destroys the {@link TestSuite}. */ void destroyTestSuite(TestSuite suite); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy