![]() They can be useful for setting the game's state before running tests. Helper functions are latent commands that perform no tests. Searching the Unreal codebase for uses of ADD_LATENT_AUTOMATION_COMMAND turns up a lot of interesting things showing how it is used:ĭEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER ( FBUISetupHero, ABUIHero *, Hero ) bool FBUIHeroDrinkPotion :: Update () Helper Functions We will be using it to make sure that each part of the test is only started once the previous one has finished. Previously we could do all our testing in a single function, but now that we need parts of it to wait for gameplay code, we need to change our approach.ĪutomationTest.h has a macro ADD_LATENT_AUTOMATION_COMMAND(), that creates a new instance of the class in the parentheses, and adds it to a list of commands to be performed in-order. Unreal calls these functions latent functions. For our tests to work with these delays we will need to change our tests to be able to wait until conditions are fulfilled. Gameplay code does not always execute instantaneously, there are often animations, delayed callbacks and load times. Now we want to test a larger chunk of gameplay code or an entire game using the Functional Testing framework. In the Introduction to Testing tutorial, we created a simple unit test that instantiated a class, tested it, and cleaned up. In this tutorial we will focus on using Unreal's Functional Test framework rather than Gauntlet. Because Gauntlet tests run on full builds, they are perfect for tests that measure performance and throw errors when FPS drops below a threshold.Functional Tests work both in-editor and from the command line.Functional Tests cannot as far as I know. Gauntlet tests can be run on any platform PC, console, mobile.This means every time you update your game and wish to re-run tests, you have to make a full build in order to run the Gauntlet tests. Gauntlet only works on full builds, it does not run in the editor.Gauntlet on the other hand, is Unreal's newer testing framework that focuses on testing gameplay rather than individual units. The Functional Test framework is great for writing small unit tests, and not bad for larger integration tests. This tutorial should help you create a suite of simple tests and helper functions that you can compose into complex functional tests for your game.īut first, let's discuss Unreal's two testing frameworks: Functional Tests and Gauntlet. So you've written a simple functional test and now you want to scale it up to test large parts of your gameplay code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |