8000 Mobilis Emulation · mobilis/mobilis Wiki · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Mobilis Emulation

thomaswalther edited this page Apr 3, 2013 · 10 revisions

Table of Contents

Overview

Defining the communication interface

The communication between emulation clients and emulation server is defined by an MSDL (see MSDL Specification). If you want to extend the functionality, you can extend the emulation.msdl located in the folder Emulation/GWTEmulationServer/src/META-INF.

Defining the script syntax

The script syntax is defined in the XMLEmulationScript.xsd located in the folder Emulation/GWTEmulationServer/src/script-utils. You can use this schema to create your own test scripts. Examples can also be found in that folder.

Main functions

The main functions of the script are listed below:

defining test-clients

You can define a variable for one test-client with the instance-function or a group of clients with the instanceGroup-function. These variables are used by other functions to define the destination of the commands.

<instance varName="CLIENT" appNS="test.client.package" instanceId="1"/>
<instanceGroup varName="CLIENT_GROUP" appNS="test.client.package" firstInstanceId="1" instanceCount="8"/>

start- and stop-functions

You can handle the start and stop of the emulation with the following functions.

<start instance="CLIENT" />
<stop instance="CLIENT_GROUP" />

defining emulation commands

AppCommands are used to define emulation commands. Optionally you can add parameters to the command.

<appCommand instance="CLIENT_GROUP" methodName="testMethod" async="true">
  <parameter>
    <string>test_string</string>
    <boolean>true</boolean>
    <int>42</int>
    <double>42.0</double>
  </parameter>
</appcommand>

The server waits for the client to acknowledge an AppCommand. By setting the async flag, you control if the client sends the acknowledgment right after receiving or after execution of the command. If set to true the client immediately sends it, otherwise the client sends it after execution of the command. Default is false.

wait command

That command sets the time in milliseconds the server waits before executing the next command.

<wait time="15000" />

control structures

At the moment, the only control structure is the for-loop. You can use any function in that loop.

<for times="6">
  <appCommand instance="CLIENT" methodName="testMethod" />
</for>>

Generation of the Mobilis Beans

The server- and client-side beans can be generated with the MSDL2JavaServer.xslt and MSDL2JavaClient.xslt located in the folder Emulation/GWTEmulationServer/xslt. See Mobilis Service Generation and Development for information about generating the beans.

Server-side implementation

In order to run the emulation server you have to configure the xmpp and the database connection. After that you have to build and deploy the server.

The xmpp connection is configured in the file EmulationConnection.java in the folder Emulation/GWTEmulationServer/src/de/tudresden/inf/rn/mobilis/gwtemulationserver/server/utils. (In future releases this should be in a configuration file)

The database connection is configured in the file persistence.xml in the folder Emulation/GWTEmulationServer/src/META-INF.

If you configured this you can use the build-script in folder Emulation/GWTEmulationServer to compile the sources and pack the war-file. Now you can deploy the war-file in your Tomcat Server (tested with version 7).

Note: To build the server the GWT SDK must be installed. (download here)

Start an emulation run

At first you have to upload your script under the tab Skripte. Here you can see all uploaded scripts.

Next step is to start the emulation under the tab Emulation. The first thing here is to select your script and connect your devices. You can see how many devices are connected and how many devices are defined in the seleceted script.

After that you assign the the script variables to the connected devices.

In the end you can see your emulation run under the tab Logs.

Client-side implementation

As you can see the Android part is separated in two two components. The Emulation App (later called Mobilis Emulation Starter) and the Robotium App. For now there is only one MXA component, but in future the emulation connection should be separated from the app connection.

The Emulation Starter is used to connect the device to the server and to receive the start command. For that an installed MXA (see MXA) should be on your device. In the settings you have to configure the JID of the emulation server. There are no other prerequisites.

The Robotium app, like the name says, uses Robotium to handle the control of the app under test. Because robotium is build on top of the Android Instrumentation Framework, this part must run in the same context as your app under test and you have to ensure that it is signed with the same keystore as your app.

The Robotium app receives the command from your script and handles the execution. You can see examples in the file MainTest.java in the folder MobilisXHunt/MobilisXHunt_Android_Emulation/MobilisXHunt_Android_Emulation/src/de/tudresden/inf/rn/mobilis/android/xhunt/emulation.

Demo of an emulation run

You can see a demonstration of an emulated XHunt run here.

Clone this wiki locally

0