ThrowsException
ThrowsException

Reputation: 2636

Running mobile tests on multiple devices

Im trying to automate some testing for my application on safari and started looking into selenium and SeLion from paypal to help out. I notices the SeLion library has the @MobileTest decorator but it seems you can only specify one device per test. If I wanted to test my app on both iPad and iPhone what would the best way to write my tests be? Would I basically just have to write wrapper methods like

@Test
@MobileTest(appName = "safari", device = "iphone:8.1",
deviceType = "iPhone Simulator")
public void test() {
   commonTest()
}

@Test
@MobileTest(appName = "safari", device = "ipad",
deviceType = "iPad Simulator")
public void test() {
   commonTest()
}

I don't think its possible to do

//test in series?
@Test
@MobileTest(appName = "safari", device = "iphone")
@MobileTest(appName = "safari", device = "ipad",
deviceType = "iPad Simulator")
public void test() {
   commonTest()
}

Upvotes: 0

Views: 83

Answers (1)

Doug Simmons
Doug Simmons

Reputation: 458

Correct.

You can not use two MobileTest annotations on the same Test method.

Also, in the current SeLion version(s), there isn't an easy way to use the same Test method for more than one mobile device. This said, there is currently a branch and pull request open that will make device configurable beyond the annotation --- adding the option to specify it via a testng suite file, Java system property, or environment variable. Once this code makes it in, you will have better options.

Please follow this PR

Upvotes: 1

Related Questions