Develop

Meta XR Simulator No-Code Automation Testing

Updated: Apr 22, 2026
Outdated XR Simulator Version
This information applies to an older version of the XR Simulator, for new projects use the Standalone XR Simulator which supports any OpenXR application.

Overview

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:
  1. Record tests.
  2. Replay and generate the expected test result.
  3. Transfer your game and test files to your test machine and run the test.
  4. Compare test results.

Prepare test

Tests can be recorded on a developer’s local computer.

Record tests

  1. Install and set up the Meta XR Simulator with your development environment. For more info, see Getting Started with Meta XR Simulator.
  2. Run your game in Meta XR Simulator.
  3. Click Session Capture > Record to start a recording.
  4. Select a VRS file to record to (for example, recording.vrs):
    • Notice that Session Capture is now in the Recording state
  5. Use a mouse and keyboard (or a connected controller) to interact with your game.
  6. Take snapshots by pressing Take Snapshot(s) at key spots. These will later be used to verify the test result.
  7. When you are done recording, click Stop Recording.
  8. 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

  1. Run your game again on Meta XR Simulator.
  2. Start a replay by clicking Session Capture > Replay.
  3. In the prompt window, select a Recording VRS file to replay.
  4. In the second prompt window, select a VRS file to save the replay (for example, replay_target.vrs).
  5. Meta XR Simulator will automatically run the recording.
  6. Once done, click Session Capture > Stop Replay.
  7. Repeat the above steps to generate a replay VRS file for each recording. The replay_target.vrs file contains the expected test result – screenshots.

Execute automation tests

The following steps demonstrate how to execute a recorded test from the previous section. While these steps can be automated with scripts, this document outlines them step-by-step so you can customize and align them with your CI process.

Transfer the recording.vrs and replay_target.vrs files to the test machine along with your game

  1. Set up the Meta XR Simulator on the test machine. For more info, see Getting Started with Meta XR Simulator.
    • Visit this page to find the direct download for the latest Meta XR Simulator
    • Only the MetaXrSimulator folder is needed. Copy it to somewhere convenient, like C:\Projects\MetaXRSimulator (this location will be assumed for the rest of this document).
    • Run the Synthetic Environment server: cd C:\Projects\MetaXRSimulator\.synth_env_server; ./synth_env_server.exe Bedroom
    • Set the Windows environment variable XR_RUNTIME_JSON to C:\Projects\MetaXRSimulator\meta_openxr_simulator.json.
  2. Add the following session_capture block into %AppData%\Roaming\MetaXR\MetaXrSimulator\persistent_data.json, inside the top-level {} object.
    On the test machine, the automated replay generates a new output file (replay_new.vrs), which is later compared against the baseline replay_target.vrs that you transferred.
     "session_capture": {
       "delay_start_ms": 1000,
       "exec_state": "replay",
       "quit_buffer_ms": 1000,
       "quit_when_complete": true,
       "record_path": "C:\\open\\test_recordings\\recording.vrs",
       "replay_path": "C:\\open\\test_recordings\\replay_new.vrs"
     }
    
  3. Run your game in Unreal Engine:
    "Path to Unreal\UnrealEditor.exe" "Path to Test Project\test.uproject" -Game -ExecCmds="Automation RunTests Project.Functional Tests; quit" -Unattended -TestExit="Automation Test Queue Empty" -ReportExportPath="C:\temp\Reports" -Log -Log=RunTests.log
    
    Alternatively, compile your Unreal game to a standalone executable, which runs the tests automatically.
  4. Repeat the above steps to run all your recordings.

Compare test results

  1. Copy replay_target.vrs and replay_new.vrs to a folder, for example c:/test_result
  2. Copy vrs_pixmatch.py and requirements.txt from the scripts/ folder of the Meta XR Simulator download package to a folder, for example c:/test_result
  3. Run the following 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 in the scripts/ folder of the Meta XR Simulator package.
  4. The command compares snapshots and prints the result to the console. Difference images for any failed comparisons are saved to the specified output path.

Update the test

If a game object has been changed from red to green, the test will fail. In this case, the recording is still valid, so you only need to run a replay locally to generate a new replay_target.vrs file to transfer to the test machine (or CI). However, if the entire game interaction has changed and the recording is no longer valid, then you need to record a new test.

Test with synthetic environments

Synthetic environments are rooms for you to test your game. They can be launched through the following commands:
  • cd C:\Projects\MetaXRSimulator\.synth_env_server; ./synth_env_server.exe Bedroom
  • cd C:\Projects\MetaXRSimulator\.synth_env_server; ./synth_env_server.exe GameRoom
  • cd C:\Projects\MetaXRSimulator\.synth_env_server; ./synth_env_server.exe LivingRoom