Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Running automated tests for multiplayer games could help you replicate hours of gameplay in minutes, but it can be a real challenge for most of us due to a more complex setup. Read more about how you can start to run automated tests in the article!
Game’s features not working, UI not displaying the content properly for the device’s resolution and operating system, inactive buttons and game glitches, will all lead to an overall bad gaming experience for the users. With record-low user tolerance, bad reviews and game uninstalls are inevitable.
Extensive testing helps studios and game developers to spot the pain points and to remove them. Manual testing could be quite a Herculean task, if it’s not paired with automated testing.
Running automated tests for multiplayer games could help you replicate hours of gameplay in minutes, but it can sound like a real challenge for most of us due to a more complex setup. For multiplayer games, you need to set up multiple devices which means a higher chance to make a mistake. You also need a really good understanding of the games flow to know the state in which the games are all the time during testing, to make sure that you are testing what you intended to test.
So we decided to write an article on how to make the setup to run tests on two devices in parallel. For our tests, we have used AltUnity Tester, an UI test automation framework, downloadable from the Unity Asset Store.
We chose the “Tanks!!! Reference Project” sample from Unity Asset Store as it has a multiplayer component where you compete against other opponents in a match. It runs on the following platforms: Windows, Mac, Android and iOS.
See below the required steps for running automated tests on an Unity multiplayer game.
The first step is to build the game with AltUnity Tester on the desired platform, you can build it on any setup. We wrote some scripts for two different setups:
2 Android devices
one Android, one iOS device
Now that we have the builds, let’s see how we are going to communicate with the build to perform the actions written in the tests. There are two ways to do that.
You can forward the device port to your computer port so that you can connect on localhost. This means that your devices need to be connected to your computer. More information about this can be found here.
Connect directly to the device by giving the device’s IP. This means that the devices need to be in the same network as your computer.
We wrote a simple test to see that two devices can play a match together. We start by sending the commands to the players to create and join the server. Once the “players” are in the game we send commands to find each other and to shoot until one of the players wins.
Check out the video below for more info about the setup and test flow:
In our repository, you will find more shell scripts that will install the game on the device, forward the port and run the tests mentioned above which also include the test we discussed above.
We encountered some issues with the sample when building for Android. Some of the packages are deprecated. To solve the problem, we removed all the deprecated references from the project. The main feature that we are interested in was not affected so it wasn’t a problem for us. On our git repository, you can find the Unity project with the deprecated part removed.
You might want to change the services to your organization so other users don’t influence your tests. Check this video to see how.
Leave a comment at this article, if you have any questions regarding automated testing for Unity multiplayer games.
Read more about:
BlogsYou May Also Like