docs.unity3d.com
    Show / Hide Table of Contents

    Test Generation

    Recorded playback files & Automated Runs can be transformed into Unity Test Framework tests automatically with the click of a button. A simple test can be generated, which creates a C# test that points to recording file or recording asset, and invokes it in the same manner as a local editor-based run. Playback files can also be converted into a "full" test script where every distinct action taken is a separate line of code. This allows for extensive customization and enhancement of automatically-generated tests.

    Test Generation Window

    Located under Automated QA > Test Generation..., this window displays a list of json recording files, of which you can select any number of associated checkboxes. With a selection ready, you can then generate a C# script from the files.

    When selecting recordings for test generation, any existing generated tests for the selected recording(s) will be examined for customizations/edits. If any edits are found, you will be notifed and allowed to choose which edited files you want to overwrite or ignore before finalizing your test generation request.

    The two options are Simple Tests & Full Tests.

    Simple Test

    Consists of a C# script and test with a reference to an associated recording. There is minimal room for customization of the test, as every step performed by the recording is still contained in the referenced recording file, rather than being executed by C# code in the generated test.

    Full Test

    Consists of a test script and "Step" file(s). Every recording and child segment(s) of a recording selected for test generation will have the actions it performs converted into a line of C# code. References to each of these actions is stored as a TouchData object in a Step file, and each Step file is associated with the recording or segment that defined its TouchActions. This more detailed script allows for significant customization, including adding assertions or logic before and after each action performed, or adding additional actions to perform, along with easy access and modification of the underlying TouchAction data that defines performed actions.

    Automated Runs that contain a "RecordedPlaybackAutomator" will have the associated recording file broken down into individual steps in the same way that a Full test is generated directly from a recording file.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023