prashant-ramcharan / courgette-jvm

Multiprocess | Parallel Cucumber-JVM | Parallelize your Java Cucumber tests on a feature level or on a scenario level.
MIT License
134 stars 39 forks source link

cannot override mobileDeviceType #415

Closed fatahillahardhi closed 1 month ago

fatahillahardhi commented 2 months ago

Hi again @prashant-ramcharan

I tried to override the mobileDeviceType with the command -Dcourgette.mobileDeviceType="mobileDeviceType.REAL_DEVICE", but I keep getting the following error: courgette.runtime.CourgetteException: You must only provide simulator device names (without udid) in the mobileDevice list when using mobile device type: SIMULATOR

here's my runner:

@RunWith(Courgette.class)
@CourgetteOptions(
        threads = 1,
        runLevel = CourgetteRunLevel.SCENARIO,
        rerunFailedScenarios = false,
        testOutput = CourgetteTestOutput.CONSOLE,
        plugin = {CourgettePlugin.MOBILE_DEVICE_ALLOCATOR},
        mobileDevice = {
                "device"
        },        
        cucumberOptions = @CucumberOptions(
                features = "src/test/resources/features",
                tags = "@Android or @Ios",
                plugin = {
                        "pretty",
                        "json:build/cucumber.json",
                        "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm",
                }
        ))

public class MobileTestRunner {

}

and the commands ./gradlew clean automationTestMobile -Dcourgette.mobileDeviceType="MobileDeviceType.REAL_DEVICE" -Dcourgette.mobileDevice="DEVICE:000XXXX-XXXXXX" -Dcucumber.tags="@TAGS"

prashant-ramcharan commented 2 months ago

Hello,

You won't be able to override mobileDeviceType at runtime as this value is expected to be defined in the runner. The default is MobileDeviceType.SIMULATOR

Are you using 1 runner for both real device testing and simulator testing?

fatahillahardhi commented 2 months ago

I see...

Yes, I'm using one runner for both real devices and simulators, but it's not efficient if I have to change the mobileDeviceType every time.

prashant-ramcharan commented 2 months ago

@fatahillahardhi You should be able to override the mobile device type at runtime now.

Use Courgette version 6.16.0

-Dcourgette.mobileDeviceType=REAL_DEVICE