From 7e7ffcd8925df5224cd05bf7d01c9794a089b971 Mon Sep 17 00:00:00 2001 From: James Frowen Date: Wed, 8 Apr 2020 16:24:39 +0100 Subject: [PATCH] Adding report to performance test readme --- Assets/Mirror/Tests/Performance/README.md | 43 +++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Tests/Performance/README.md b/Assets/Mirror/Tests/Performance/README.md index 0acfed77f..690c6e4a6 100644 --- a/Assets/Mirror/Tests/Performance/README.md +++ b/Assets/Mirror/Tests/Performance/README.md @@ -2,9 +2,8 @@ Performance tests require `com.unity.test-framework.performance` - #### Install Unity Performance Testing Extension -When using 2019.1 or earlier you have to manually add these to your `manifest.json` or copy from `Packages/manifest.json` +When using 2019.1 or earlier you have to manually add these to your `manifest.json` or copy from Mirror's `Packages/manifest.json` - Open `manifest.json` - Add @@ -12,7 +11,7 @@ When using 2019.1 or earlier you have to manually add these to your `manifest.js { "dependencies": { "com.unity.test-framework.performance": "0.1.50-preview", - /// other dependencies + "other dependencies here" }, "testables": [ "com.unity.test-framework.performance" @@ -20,6 +19,44 @@ When using 2019.1 or earlier you have to manually add these to your `manifest.js } ``` +## Run Tests from CLI + +[Unity CLI Documentation](https://docs.unity3d.com/2018.4/Documentation/Manual/CommandLineArguments.html) + +Options: +- `-testResults` Where results are saved +- `-testPlatform` Use `editmode` or `playmode` to pick which tests to run +- `-testCategory` Comma separated list of test categories +- `-testsFilter` Comma separated list of test names +- `-logFile` change log path, Default path `%LOCALAPPDATA%\Unity\Editor\Editor.log` + +Example of running Benchmark tests from cli +``` +Unity.exe -testResults /path/to/send/results.xml -runTests -testPlatform playmode -projectPath G:\UnityProjects\Mirror -batchmode -testCategory Benchmark +``` + +## Create a Performance Benchmark Report + +To use Performance Benchmark Reporter you must have: + - [.NET core SDK](https://dotnet.microsoft.com/download) + - [Performance Benchmark Reporter DLL](https://github.com/Unity-Technologies/PerformanceBenchmarkReporter/releases) + - `test-framework.performance` Package at version `0.1.50` or earlier (available Unity versions 2018.3 or 2018.4) + +The Performance Benchmark Reporter does not work with newer versions of the test-framework because unity has modified the results XML. The Reporter is open source so it is possible to modify it to work with later versions at some point in the future. + + +### Run the Performance Benchmark Reporter + +1. Run the performance tests to create a `TestResults.xml` +2. If running from editor, move the generated `TestResults.xml` file +3. Change branches and run performance tests again +4. Once all results are collected run the Performance Benchmark Reporter DLL +5. Open the "UnityPerformanceBenchmark" html file that is created to view the report + +``` +dotnet UnityPerformanceBenchmarkReporter.dll --baseline=D:\UnityPerf\baseline.xml --results=D:\UnityPerf\results --reportdirpath=d:\UnityPerf +``` + ## Links