Groovy web console

subscribe to the feed Subscribe
to this
site

groovy test

Published 4 weeks ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
                    def smokeTestParameters_Common = [
                        "Platform=iOS",
                    ]
                    def ipad_devices = [                        "iPad_Pro_12.9_2020_iOS_14",
                        "iPad_8th_iOS_14",
                        "iPad_Pro_12.9_2018_iOS_13",
                        "iPad_Pro_11_2018_iOS_12"
                    ]
                    def iphone_devices = [
                        "iPhone_12_Pro_Max_iOS_14",
                        "iPhone_11_Pro_Max_iOS_13",
                        "iPhone_XS_Max_iOS_12",
                        "iPhone_8_Plus_iOS_12"
                    ]
                    Random rnd = new Random()
                     //get device details- device name and iOS version
                    def device_ipad = ipad_devices[rnd.nextInt(ipad_devices.size())].split("_iOS_")
                    def device_iphone = iphone_devices[rnd.nextInt(iphone_devices.size())].split("_iOS_")

                    def smokeTestParameters_iPad = smokeTestParameters_Common + [
                        "Device_Type=Tablet",
                        "Devices=${device_ipad[0]}",
                        "Platform_Versions=${device_ipad[1]}"
                    ]
                    print smokeTestParameters_iPad.join('&')

                    def smokeTestParameters_iPhone = smokeTestParameters_Common + [
                        "Device_Type=Phone",
                        "Devices=${device_iphone[0]}",
                        "Platform_Versions=${device_iphone[1]}"
                    ]
                    
                    print smokeTestParameters_iPhone.join('&')