0
여러 장치에서 동시에 내 appium 테스트를 실행하려고합니다.Appium, Cucumber and Junit 여러 장치에서 병렬로 테스트를 실행하는 방법
현재 하나의 Android 기기에서 테스트 사례를 실행할 수 있습니다. 잘게 썰거나 바꾼 후에는 테스트를 병렬로 실행할 수 없습니다.
현재 내 설정. saucelab 또는 셀레늄 그리드 없이도 테스트를 병렬로 실행할 수 있습니다.
내의 JUnit 주자
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"json:target/cucumber.json", "pretty"}, features = {
"src/test/resources/features/
},
glue = "com.test.stepdefs")
public class RunCukesTest {
private static AppiumDriverLocalService service;
public static File file;
@BeforeClass
public static void startAppium() throws IOException {
System.out.println("YOUR OS NAME : " + osName);
String nodePath = null;
String appiumPath = null;
ServerArgument argument;
if (osName.contains("mac")) {
// mac paths
nodePath = "/usr/local/bin/node";
appiumPath = "/usr/local/lib/node_modules/appium/build/lib/main.js";
service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File(nodePath))
.usingPort(4723)
.withArgument(GeneralServerFlag.LOG_LEVEL,
"error")
.withAppiumJS(new File(appiumPath)));
} else if (osName.contains("windows")) {
service = AppiumDriverLocalService.buildDefaultService();
} else if (osName.contains("linux")) {
// linuxs path
nodePath = System.getenv("PRODUCTION") + "/.linuxbrew/bin/node";
appiumPath =
System.getenv("PRODUCTION") + "/.linuxbrew/lib/node_modules/appium/build/lib/main.js";
service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File(nodePath))
.usingPort(4723)
.withAppiumJS(new File(appiumPath)));
}
service.addOutPutStream(stream);
service.start();
}
@AfterClass
public static void stopAppium() {
service.stop();
}
의 예와의 예 내
@Configuration
public class AppUtils {
@Value("${explicit.wait}")
public int explicitWaitTime;
@Value("${implicit.wait}")
public int implicitWaitTime;
@Value("${default.wait}")
public int defaultWaitTime;
public String applicationName;
public DesiredCapabilities capabilities;
@Value("${appium.server.port}")
private String appiumPort;
@Value("${automation.instrumentation}")
private String instrumentation;
@Value("${browser.name}")
private String browserName;
@Value("${platform.name}")
private String platformName;
@Value("${device.name}")
private String deviceName;
@Value("${platform.version}")
private String platformVersion;
@Value("${new.command.timeout}")
private String newCommandTimeout;
@Value("${app.package}")
private String appPackage;
@Value("${device.ready.timeout}")
private String deviceReadyTimeout;
private URL serverUrl;
private AppiumDriver<? extends MobileElement> driver;
@Bean(destroyMethod = "quit")
@Scope("cucumber-glue")
public AndroidDriver getDriver() throws MalformedURLException {
capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, instrumentation);
capabilities.setCapability("appPackage", "com.android.chrome"); //To be moved to properties
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.Main"); //To be moved to properties
serverUrl = new URL("http://localhost:" + appiumPort + "/wd/hub");
// LoggingPreferences logPrefs = new LoggingPreferences();
// logPrefs.addPreferences()
// capabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);
driver = new AndroidDriver(serverUrl, capabilities);
driver.manage().timeouts().implicitlyWait(implicitWaitTime, TimeUnit.SECONDS);
//driver.setLogLevel(Level.OFF);
return (AndroidDriver) driver;
}
}
여기에 대한 좋은 문서를 찾을 수 없습니다 어떤 도움을 감사합니다.