Meta XR Simulator No-Code Automation Testing
Updated: Jun 10, 2024
You can run automation tests for Unity and Unreal Engine projects with Meta XR
Simulator. This introduces a new way to test many manual tests, particularly
smoke tests and regression tests. This is a zero-code, record-and-replay
approach utilizing “snapshots” to verify test results.
These are the steps to set up and run automated tests for your game:
Record tests.
Replay and generate the expected test result.
Transfer your game and test files to your test machine and run the test.
Compare test results.
Tests can be recorded on a developer’s local computer.
Run your game in Meta XR Simulator.
Click Session Capture > Record to start a recording.
Select a VRS file to record to (for example, recording.vrs):
- Notice that Session Capture is now in the Recording state
Use a mouse and keyboard (or a connected controller) to interact with your
game.
Take snapshots by pressing Take Snapshot(s) at key spots. These will
later be used to verify the test result.
When you are done recording, press the Stop Recording button.
Repeat the above steps to make a new recording for other test cases. Each
test case is recorded and saved into a VRS file.
- Replay recordings to generate the expected test result
Replay recordings to generate the expected test result
Run your game again on Meta XR Simulator.
Start a replay by clicking Session Capture > Replay.
In the prompt window, select a Recording VRS file to replay.
In the second prompt window, select a VRS file to save the replay (for
example, replay_expected.vrs).
Meta XR Simulator will automatically run the recording.
Once done, press Session Capture > Stop Replay.
Repeat the above steps to generate a replay VRS file for each recording. The
replay.vrs file contains the expected test result – screenshots.
Copy replay_expect.vrs and replay_new.vrs to a folder (for example,
c:/test_result)
Copy vrs_pixmatch.py and requirements.txt to a folder (for example,
c:/test_result)
Run below commands to compare the test results:
## Prepare requirements.txt for windows:
findstr /v "vrs==1.0.4" c:\test_result\requirements.txt > c:\test_result\tmp.txt
move c:\test_result\tmp.txt c:\test_result\requirements_windows.txt
## Download pyvrs
mkdir c:/tmp
cd c:/tmp
git clone https://github.com/facebookresearch/pyvrs.git
cd pyvrs
git submodule sync --recursive
git submodule update --init --recursive
## Build and Run Pyvrs via Pixi
## Install pixi (details can be found: https://pixi.sh/latest/#__tabbed_1_2)
iwr -useb https://pixi.sh/install.ps1 | iex
pixi run install_pyvrs
pixi task add run_test "python c:/test_result/vrs_pixmatch.py c:/test_result/replay_new.vrs c:/test_result/replay_target.vrs --threshold 0.2 --diffs_output_path c:/test_result"
pixi task add pip_install "pip install -r c:/test_result/requirements_windows.txt"
pixi run pip_install
pixi run run_test
- More detailed information about the command can be found in the readme.md file
under the scripts folder.
- The above command will verify the test result and output the final result.