Documentation for ProjectSettings/Settings.json

I found there is a “useProjectSettings” option which use ProjectSettings/Setting.json file as configuration

Using Code Coverage in batchmode | Code Coverage | 1.2.2 (unity3d.com)

But i didn’t find any example that shows how Settings.json looks like.

So… is there any example or documents for Settings.json?

Hi. It seems like the path for Settings.json file has changed but docs weren’t updated - I’ll open a bug to fix that.
File is located in <project_root>/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json. It stores settings for code coverage window. My advice would be to not change file directly, but to use code coverage window to make the changes you need.

when i run code coverage via command line, i pass -useProjectSettings, but it seems nothing happened…It didn’t use settings which i set in code coverage window…

Could you give me a sample how to use the useProjectSettings command

useProjectSettings is one of the coverage options, so you need to pass it as a parameter for the coverageOptions argument. Like this: -coverageOptions "useProjectSettings" You can find more examples on how to use coverage options and generate coverage in batchmode here.

HI… i have tried -coverageOptions "useProjectSettings" , but no luck

The whole comand using is
unity.exe -runTests -batchmode -projectPath .\TestProjects\CodeCoverage\ -testResult D:\SDK_YTestFramework\result.xml -testPlatform PlayMode -logFile D:\Unity.log -enableCodeCoverage -coverageResultPath D:\CodeCoverage - coverageHistroyPath D:\CodeCoverage -coverageOptions “useProjectSettings”

After running this command, there are several issues:

  1. Test result didn’t shown in D:\SDK_YTestFramework\result.xml, it was saved in D:\SDK_YTestFramework\TestProjects\CodeCoverage\TestResults-638170665428637916.xml
  2. Code Coverage report wasn’t be generated in D:\CodeCoverage\ folder.

Here’s my Settings.json found in ProjectSettings, and manifest i am using, and the command log file

8947764–1227912–Settings.txt (2.74 KB)
8947764–1227915–packages-lock.txt (10 KB)
8947764–1227918–Unity.txt (597 KB)

Hi @Tuncle . Regarding your first point, you have a typo in your command line - instead of testResult it should be testResults (plural).

Second point, however, appears to be a bug. As a workaround, toggle Auto Generate Report off and on again so Settings.json would be updated with a missing entry. Alternatively, you can add it manually:

{
                "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
                "key": "AutoGenerateReport",
                "value": "{\"m_Value\":true}"
}

Edit: I’ve opened a bug which can be tracked here Unity Issue Tracker - useProjectSettings does not generate report until Auto Generate Report is toggled off and on again

1 Like