Search Unity

Feedback Documentation for ProjectSettings/Settings.json

Discussion in 'Testing & Automation' started by Tuncle, Apr 13, 2023.

  1. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23
  2. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    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.
     
  3. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23
    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
     
  4. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    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.
     
  5. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23
    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
     

    Attached Files:

  6. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    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:
    Code (JavaScript):
    1. {
    2.                 "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
    3.                 "key": "AutoGenerateReport",
    4.                 "value": "{\"m_Value\":true}"
    5. }
    Edit: I've opened a bug which can be tracked here https://issuetracker.unity3d.com/product/unity/issues/guid/COV-25
     
    Last edited: Apr 18, 2023
    Tuncle likes this.