Selecting a single device during execution

From within your action lines, you can control which device your test is to execute on. The built-in assign device action is used to specify a target device upon which the subsequent action lines are to be run.

重要: 
With this method, only a single device is selected and run at a time. You are required to terminate the connection the current device-under-test, before executing the remaining tests on other devices.

Ensure that the following requirements are met before implementing automated mobile web testing on a device in the Remote TestKit cloud service:

  1. Use the assign device built-in action to define a list of desired capabilities, which are sets of keys and values sent to the Appium server in JSON format. You can define as many capabilities as you need (learn more). However, it is recommended that your JSON string contain the following basic capabilities including.

    • deviceName
    • platformName
    • browserName

    For example: You rent a Galaxy S7 Edge in Remote TestKit to automate mobile web applications, your set of desired capabilities should be defined as follows.

    • deviceName: Query for its value by using adb devices command.

    • platformName: Android

    • browserName: Chrome, which invokes Google Chrome browser during mobile web application testing.

    • JSON string is as follows:

      [{"deviceName" : "galaxy_s7_edge_sm-g935f.adb.appkitbox.com:58564", 
      "platformName" : "Android", 
      "browserName" : "Chrome"}]
      
    • Specify local URL Appium server:

      • The format is in the form of http://<server_address>:<port_number>/wd/hub/
      • For example: http://127.0.0.1:4723/wd/hub/
    • assign device should resemble the following.

                           url                             capability                                                            name   
      assign device        `http://127.0.0.1:4723/wd/hub/`   [{"deviceName" : "galaxy_s7_edge_sm-g935f.adb.appkitbox.com:58564",   S7 edge 
                                                           "platformName" : "Android", 
                                                           "browserName" : "Chrome"}]    
      
  2. Make a connection to the target device via the connect device built-in action, as specified by its logical name.

    注意: 
    The name is established in advance by the assign device action, which assigns a logical name to a mobile device.

                           name       session id
    connect device         S7 edge    >>s7_edge_sessionID
    
  3. Employ the use device built-in action to use the device to initiate automated tests. The invoked device is specified by its session ID.

    注意: 
    The session ID specified in the session id argument is retrieved via the connect device action.

                         session id
    use device           #s7_edge_sessionID
    
  4. Now, you’re ready to begin performing your automated web-based tests on the target device.

  5. When you no longer need to continue the tests on the target device, it is highly recommended that you terminate the connection with the target device by using the disconnect device built-in action.

                               session id
    disconnect device          #s7_edge_sessionID
    
  6. When you’d like to switch back to the host machine to continue the remaining tests, use the use host machine built-in action.

  7. Overall, your snippet of test should resemble the following.

    //Define desired capabilities
                            url                             capability                                                            name   
    assign device           `http://127.0.0.1:4723/wd/hub/`   [{"deviceName" : "galaxy_s7_edge_sm-g935f.adb.appkitbox.com:58564",   S7 edge 
                                                            "platformName" : "Android", 
                                                            "browserName" : "Chrome"}]   
    
    //Connect to the target device
                              name       session id
    connect device            S7 edge    >>s7_edge_sessionID
    
    //Use the target device
                              session id
    use device                #s7_edge_sessionID
    
    //Implement action lines to perform automated mobile web-based testing
    
    //Disconnect the target device
                               session id
    disconnect device          #s7_edge_sessionID
    

Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGearはLogiGear Corporationの登録商標であり、Action Based TestingおよびTestArchitectはLogiGear Corporationの商標です。ここに記載されているその他の商標は、各所有者の財産です。

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400