I am having a real hard time figuring out how to get unit tests working for Unreal. I have found the very brief docs on “Automation Testing”, which seems woefully out of date. I’ve got a very simple test written, just trying to see if a UWorld can be found. It compiles (after a lot of figuring things out), but my test doesn’t show up in the Editor.
But you can only access the Automation window from the editor, so how are you ever supposed to run an ATF_Game test if they don’t show up? I was assuming they would show up and in order to run them it would start the game.
In any case thanks for your comments, and I will take another stab at things this weekend.
Hmm interesting. Ok if you launch your game by using the Project Launcher to build and run, then it shows up as a new Session you can connect to in the Session Frontend, and when you do that then the ATF_Game tests will show up. Apparently running PIE does not work, neither does running standalone from the play buttonm, which is a real bummer. It only seems to work if you do a complete build and launch from the Project Launcher. Having to do a complete build every time is going to slow things down
Hey John, what was the latest on this? Looking into the automation system myself and was wondering if you still needed to do a full build to run ATF_Game tests. Why did you want to run with that in particular, rather than just tagging it ATF_Editor? Just making sure I’m on the same page.
EDIT: As a follow-up, a comment on the bottom answer of this Answerhub post says:
Another useful resource here, talking about running all automation tests for a project via cmdline, etc. Read the later answers for more details.
I was considering the following; a little C# desktop application that could pull in a list of tests for a given project, and then present them as options (or even just the overarching categories), allowing you to tick them and hit ‘test’. It then ‘builds’ the project in the selected configuration (rather than a full rebuild/cook like the Frontend, i.e. only the changes to the tests would need to be compiled) via UAT/UBT cmdline, and then runs the selected tests. Not sure how you’d get the results back - would be nice to be able to interpret them graphically, but I really don’t want to have to deal with that.
This would at least make running tests less painful, and the app wouldn’t be so crazy. There is, of course, still no mocking of classes (I’ll be making a lot of my class’ ‘brains’ as non-UObjects for this reason). Anyways, thoughts?
EDIT: Alternative; have someone make unit tests hot-reload.