Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43909

Wiki Page: How can I perform parallel testing using Silk Mobile?

$
0
0
Prior to running parallel tests using the SilkMobileExecutor you should be aware of following prerequisites: (1) SilkMobileExecutor requires that all the devices being tested are from the same mobile OS (for example, you can have a machine with SilkMobile executing on up to 5 Android devices using the SilkMobileExecutor. However you cannot execute on a different mobile OS such as on iOS). (2) You have a node-locked licenses as SilkMobileExecutor is only available for this type of licensing (3) The use of the SilkMobileExecuter can be done only from the testing framework – for example Junit, NUnit. (4) You have available Agent ports (go to “File | Agents” ) and ensure that the ports are available, so that SilkMobile can connect to the multiple devices. These ports can be assigned manually or automatically.   Once the prerequisites have been met, ensure that you can connect and launch the “devices” via the “Open Device” dialog, like so:   Next record a test against one of the devices (please ensure that the same version of the application under test is installed on all devices) Replay the test script and ensure that you have a working robust script. Go to the “Code” tab in SilkMobile and select the framework you wish to export the testcase to (in this instance I have chosen Junit). Copy the Junit framework into Eclipse and modify the Junit code it by adding new Thread() objects (which passes in the TestMethod()), so that the test method can be executed from multiple threads as demonstrated in the code below. import org.junit.Test; import com.experitest.client.Client; public class ParallelRunning {    private String host = "localhost" ;    private String projectBaseDirectory = "C:\\Users\\stefanu\\workspace\\Executor" ;    @Test    public void testUntitled() throws InterruptedException {       Thread t1 = new Thread(new TestMethod(8889, "adb:Nexus 7 old" ));       Thread t2 = new Thread(new TestMethod(8890, "adb:Android 7 2013" ));       t1.start();       t2.start();       t1.join();       t2.join();    }    private class TestMethod implements Runnable {       private int port ;       private String device ;       public TestMethod(int port, String device) {          this. port = port;          this. device = device;       }         @Override         public void run() {         Client client = new Client( host, port );         client.setProjectBaseDirectory( projectBaseDirectory );         client.setReporter( "xml", "reports", "Untitled" );         client.setDevice( device );         if (device.startsWith( "adb" ))             client.launch( "com.imdb.mobile/.HomeActivity" , true, false);         if(client.waitForElement( "NATIVE", "partial_text=Movies" , 0, 30000)){         }         client.click( "NATIVE", "text=Movies" , 0, 1);         if(client.waitForElement( "NATIVE", "partial_text=TV" , 0, 30000)){         }         client.click( "NATIVE", "text=TV" , 0, 1);         if(client.waitForElement( "NATIVE", "id=home" , 0, 10000)){         }         client.click("NATIVE", "id=home", 0, 1);         if(client.waitForElement( "NATIVE", "id=all_label ", 0, 30000)){         }         client.click( "NATIVE", "id=all_label" , 0, 1);         if(client.waitForElement( "NATIVE", "id=home" , 0, 30000)){         }         client.click( "NATIVE", "id=home" , 0, 1);         client.generateReport();         }    } }

Viewing all articles
Browse latest Browse all 43909

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>