First, we're going to talk about some of the tools in GameDriver. Now that we've added the GameDriver assembly to the project, we have the GameDriver menu. We've got the 'Getting Started' section, which shows us the version and the license validity, and has some useful references and links for you.
We have the recorder - we didn't talk about the recorder earlier with the Hierarchy Path tools, but the recorder allows us to capture our inputs as if a user were performing them. When I load up the project again using the recorder, you can see some of my inputs, the click actions. I can insert functions like 'load scene,' 'click object,' 'get object position,' etc. This is intended to provide a snapshot of what was done during my initial playthrough so that I can base my test on that.
First, I've got to open up some of the other tools here. We've got the HPath REPL, which allows me to quickly run Hierarchy Path Queries. I can just dock this wherever it's convenient so that we can use it later.
We'll open up the Hierarchy Path Debugger, which is a little bit more advanced tooling. It allows us to run and execute Hierarchy Path Queries and see not only if they're valid but be able to step through those to see where they fail and what values are returned from which objects when those queries are executed.
Then we have the Object Explorer, which is a very powerful tool that allows us to traverse the scene in a different perspective than the built-in Unity Inspector. Now, the Unity Inspector is also very powerful, but as you can see, it can be quite cumbersome to find values in a specific object. The Object Explorer allows us to quickly traverse objects in the scene and look for their components, properties, and methods so that I can just copy and paste those directly into my tests.
For example, if we take the Unity 2D rigid body and look for the fields within that, I might look for any particular value in this, such as the position, and say 'give me the Hierarchy Path in a relative or absolute form for that object.' I'll just log that here so you can see what that looks like.
When I go back to my console because I didn't copy it, you can see the path that's generated from that specific object and case. Here, we can plug that into the REPL, paste that in, and run a search, and it shows me and highlights the specific object that's returned. Now, if there are multiple of that specific object path or name, there might be an instance predicate, and it will highlight all of the objects that are returned when I run that query.
If I run this again in the Hierarchy Path Debugger, I can see where in the Hierarchy Path things fail. Let's say, for example, if I had an invalid field here, a squiggly brace, I can see specifically in the Hierarchy Path where that's invalid. I just remove that, and if I run this, it'll return the exact position or value that's associated with that property so that when I'm writing my tests, I have something to work with.
There are also some settings here. So, aside from the agent settings, we can enable trace logging, which is sometimes useful for debugging, but we'll pass on that for now.
Comments are closed.