How to connect to the server from the tests¶
Let’s say that you have a game working with AltUnity Tester on an Android phone and want to run the test from a computer. On the Android device the server is running on port 13000(default port but can be changed). To connect to the server you have two options:
Connect through port forwarding¶
Connect the device with a USB cable to the computer. Then forward the port that the game is running on, in this case, 13000, to a port that is free on your computer. Then you can instantiate the driver on Localhost and the free port on your computer that you set.
Connect directly through IP¶
Instantiate the driver giving the port that the game is running on and the device IP. In this case, the device and the computer must be in the same network or have public IPs.
After you have done the port forwarding, you can use the driver in your tests to send commands to the server and receive information about the game.
The same steps are valid if you want to test on an iOS device. If you want to test a build on the same computer, then you just have to instantiate the driver to connect to Localhost and the port on which the game is running.
Connect multiple mobile devices¶
2 devices, each with one AltUnity server
1 computer with two drivers
Then, in your tests, you will send commands from each of the drivers.
The same happens with n devices, repeat the steps n times.
If you want to run two builds on the same device you will need to change the port. For example, you will build a game that runs on 13000 and another one that runs on 13001.
For port fowarding we are using the following commands:
adb [-s UDID] forward tcp:local_port tcp:device_port
iproxy LOCAL_TCP_PORT DEVICE_TCP_PORT [UDID]
To install IProxy use the following command:
brew install libimobiledevice