docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    TestMustExpectAllLogs attribute

    The presence of this attribute causes the Test Runner to expect every single log. By default, the Test Runner only fails on error logs, but TestMustExpectAllLogs fails on warnings and info level messages as well. It is the same as calling the method LogAssert.NoUnexpectedReceived at the bottom of every affected test.

    Assembly-wide usage

    You can apply this attribute to test assemblies (that affects every test in the assembly), fixtures (affects every test in the fixture), or on individual test methods. It is also inherited from base fixtures.

    The MustExpect property (true by default) lets you enable or disable the higher level value.

    For example when migrating an assembly to this more strict checking method, you might attach [assembly:TestMustExpectAllLogs] to the assembly itself, but then whitelist failing fixtures and test methods with [TestMustExpectAllLogs(MustExpect=false)] until you have migrated them. This also means new tests in that assembly would have the more strict checking.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)