M-RUN Tutorial


In this tutorial we will learn how to work with the M-RUN component. To use M-RUN, click on the M-RUN button at the component toolbar of ZAPTEST. M-RUN allows us to run the scripts on multiple devices at the same time. When you open M-RUN for the first time, it will open the “Connected Devices” tab by default where we can see our local devices; an iPhone and an Android. Use the refresh button on the toolbar to update this list. If we click on the device icon, M-RUN will establish a connection with the device. If the device supports remote app control, M-RUN will ask us which application we would like to run. If this application is a browser, it will ask for the URL. For example, let’s launch the “Chrome” browser on an Android device and provide the following URL: www.zaptest.com. Click on the Android device icon. ZAPTEST will show the DeviceManager dialog where we can find the Chrome browser. Double-click It. Since it’s a browser app, DeviceManager will request a URL for navigation. Type www.zaptest.com. That’s it. M-RUN will establish the connection with the device, launch the Chrome browser, open the website and Create a new tab. There are two views in the tab: The remote device and the script. The script view shows the code steps which we are going to execute on this device. This is read-only view and cannot be edited here. To edit, we will use the 1SCRIPT module. The remote device view is like the ZAP Viewer. It shows the current running application. Keep in mind that the keyboard and the mouse are disabled by default. To enable or disable keyboard interaction, we will use the toolbar button. After enabling Keyboard/Mouse, we can remotely control the device: For example, type some text, scroll the page, etc. But it’s best to keep the Keyboard/Mouse control disabled to prevent it from accidentally changing the test-case behavior during runtime. Let’s use the script from the previous lesson and try to run it on the Android and the iOS devices. M-RUN has one main difference from the 1SCRIPT execution: the Launch command is ignored in M-RUN mode, and instead we will prepare the environment each time for each device. Let’s close the Android connection and open the 1SCRIPT tab. Let’s copy the URL for the device configuration and remove the second and third iterations, because M-RUN doesn’t support the Launch method. Now, save the changes because M-RUN works only with saved test cases. Next, let’s update one small but very important option. It’s the Global delay. M-RUN usually works with remote machines or devices. This means that after each step we should wait a short amount of time to get the remote device view updated. Let’s click on the “Tools” menu and open “Options”. Select the Runtime tab and set the delay to 500 milliseconds. This way we add a little buffer for each step. Now, let’s switch back to the M-RUN tab and add two connections: first for the Chrome browser on the Android device: Click on the Android device, type “chrome” into the search field, double click the Chrome browser and paste the URL. The second connection is for the ZAP browser on the iOS device: Click on the iOS device, select the ZAP browser and paste the same URL. That’s it - our devices are configured. If you’re wondering how to spare yourself from all the configurations next time, it’s really easy! We can save the current configuration - just click the “Save” button on the toolbar and select file destination. Now we can close all connected tabs and use the “Open Configuration” button to load the saved configuration. That’s it: ZAPTEST has loaded the M-RUN configuration, established connections with two devices and also launched the apps with the URL opened! Now we can run the script in M-RUN. Click on the run button on the main toolbar and ZAPTEST will execute the script on both devices. To monitor all steps at the same time, we can use the Dashboard. The Dashboard will show all the connected devices and highlight the step of the script with the corresponding color of the device tab (see the name panel above each device view). The Dashboard is very useful to monitor the execution process on all devices and computers. When the execution is complete we can check the results by clicking the Results button on the toolbar. The results contain information about each executed step, and are grouped by devices. If we click on a single device tab, instead of the dashboard, we could find additional toolbar buttons. There are mobile settings, mobile variables, a button to reconnect to the device and a button to run the script only on this device. This is useful for debug purposes. Please, check the How-To documentation about it on the zaptest.com portal On the main toolbar we have a button for adding a new connection. If we click on it, M-RUN will ask us to provide the connection name, a VNC server host and a password. We can use this dialog to connect to remote computers. Now we are going to learn how to configure a VNC server for Windows, Mac and Linux. Let’s start with Windows. We will use TightVNC server in our example. On the remote Windows machine, open www.tightvnc.com website and go to the downloads page. Download the installer for the windows system. Install the VNC Server. At the end of the installation process we will set the VNC password. We will need this password later in ZAPTEST. Check the network and VNC settings and write down the IP address and the port information for this machine. Now let’s get back to our ZAPTEST machine where we will enter this IP, port and password information into M-RUN. ZAPTEST will connect to it. ZAPTEST has a special agent for windows which could improve the communication between the remote machine and the ZAPTEST application. It’s called ZAP VNC Agent. We could download the latest version from our portal. Let’s do that and then install this agent. This agent allows us not only to connect to the remote machine, but also to launch browsers or custom applications. With it we can preconfigure connections just like we did with the mobile devices. Let’s launch ZAP Agent. It requires only two ports: the incoming port, which we will use in M-RUN to connect to this machine. And VNC port, which is the incoming port of our installed VNC server. There is no need to provide any additional authorization information because ZAP Agent works like a Proxy between the VNC server and ZAPTEST application. However, we should enable “Allow loopback connections” in the VNC server. Now we can add a new connection to our virtual machine via the ZAP Agent. We will just set a different port number as defined in the ZAP Agent. Now we can see the same dialog as with a mobile device. Let’s select the chrome browser and provide the URL from our test script. Our windows machine is ready for test execution. Let’s connect an iPad device to our PC and demonstrate the M-RUN execution on the iPad and Windows devices. Open the “Connected devices” tab and click the refresh button. Select the iPad device and configure it! We will use ZAP Browser with the same initial URL. Now, when Windows and iPad are connected and the setup is complete, we can run our test case. ZAPTEST will perform a special set of commands for selecting combo boxes on the iPad device. At the end of the execution, we can recheck each executed step in the Results. Now it’s time to setup VNC Server on Mac and Linux machines. Mac OS has a built-in VNC server. To enable it, open “System Preferences” and then open the “Sharing” page. On this page we will enable Remote Management service, then Click the “Computer Settings…” button and set the VNC password. That’s it! You can find the IP address on the configuration page. The port is 5900. Let’s check this connection with ZAPTEST. Click the “Create New Connection” button and provide your mac host ip and the VNC password. It works. It’s time to configure a Linux system. First we will install a VNC server. We will take the server which can connect to the current X-session. It’s x11vnc. Open the terminal and install the package: different Linux systems could have different package managers. Here we are using Ubuntu Linux, but if you have other systems please check the documentation of your distribution. This server has a lot of settings, we will launch this server for the current demo session without parameters. Please check the package documentation to get full information about it. Let’s open another terminal window to obtain the IP address. We should use the “ifconfig” command. Now that we have obtained the host and port numbers, let’s go back to the ZAPTEST machine and test it. Click the “Create New Connection” button and crunch in the numbers for the Linux machine. Since we didn’t set the password on Ubuntu, we can type anything into the password field here. It works. OSX and Linux systems don’t have a special agent. It means that each time we should prepare these machines before running the test. Ideally, we can write a special script to do this, but for now we will do it manually. Let’s start from the Linux system. We will open the Chrome browser with the demo webpage. That’s it, our Linux system is ready for test-execution. Under OSX system, we will use the Firefox browser. Here we should open our demo website. After preparing our systems, we can run the script: Using the Dashboard we can monitor each step on all connected computers. When done, we can check the Results. ZAPTEST Free Edition supports only two connections, while the Enterprise edition unlocks unlimited connection capabilities and allows execution of one script on unlimited devices at the same time. Here’s an example of an Enterprise edition execution. We have connected and launched a single script on 7 devices: iPad, iPhone, Android Phone, Tablet, Windows, OS X, and a Linux system. Using the Dashboard we can see the overall progress. Each device has it’s own color representation, so we can track each step on all devices in the script view. At the end ZAPTEST generates a full report about the execution process for each device. Thank you for using ZAPTEST.

Contact Us

Tower Place 100

3340 Peachtree Rd NE #1800 

Atlanta, GA 30326 USA

(404) 814-5227