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

com.mgmtp.perfload.test.utils.DriverTestRunner Maven / Gradle / Ivy

There is a newer version: 4.8.0-beta-2
Show newest version
/*
 * Copyright (c) 2002-2014 mgm technology partners GmbH
 *
 * 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 com.mgmtp.perfload.test.utils;

import com.google.inject.Injector;
import com.mgmtp.perfload.core.client.config.ModulesLoader;
import com.mgmtp.perfload.core.client.web.config.AbstractWebLtModule;
import com.mgmtp.perfload.core.common.util.PropertiesMap;

/**
 * Utility class for running a load test driver within a unit test.
 * 
 * @author rnaegele
 * @since 4.7.0
 */
public class DriverTestRunner {

	public static void runDriver(final AbstractWebLtModule driverModule, final String operation, final String target,
			final PropertiesMap testplanProperties) throws Exception {
		PropertiesMap properties = driverModule.getProperties();
		properties.put("wtm.strategy.constant.waitingTimeMillis", "0");
		properties.put("wtm.beforeTestStartMillis", "0");
		properties.putAll(testplanProperties);

		ModulesLoader ml = new ModulesLoader(new DriverTestModule(driverModule, properties, operation, target), properties,
				new MockClient(), 1, 1);

		Injector inj = ml.createInjector();
		TestExecutor executor = inj.getInstance(TestExecutor.class);
		executor.runDriver();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy