To ensure that the story is bug free and that it also meets the requirements as laid out in the High Concept Document. To do, I can carry out Unit Testing on the individual sections and Integration Testing to ensure it all works together.

Unit Testing

Unit Testing is where you can test each individual “module” of your code to see if it works as intended. This could be done via black¬†box (where you only care about input and output) or white box (where you monitor what happens to reach the result) testing. Unity has a built in unit tester which is what will be used in this case.

For this test, I will be testing that the sorting of the log entries in the UI is correct.

To start, I created a new test script under the Editor folder so that it is not packaged into any build versions. I then created a function and gave it the [Test] attribute which tells Unity that this function is a function that should be run during testing.

For this, I use the AAA method of testing which is Arrange (setup the required objects), Act (do the actions to change the objects) and Assert (check that the actions have changed the objects as expected). It is a very self contained testing method which has a form of built in setup and teardown.

A nice thing about using the built in Unity testing is that it also has a GUI so I can see the test status as well run them as I want. There is also a command line interface option too for more automated solution.

Integration Testing

System testing is effectively a combination of unit tests and ensuring that they all work together. This type of testing can also be used to see if the code style is consistent and meets a predefined pattern. To do this test, it will be done as a black box test.

I will be testing to see if the code style across the entire project is consistent using Resharper to find issues and correct them as required.

Resharper makes it very easy to inspect the code for possible issues as well as solve them quickly. To generate the results above, I ran it’s code inspector on our project and this is what it returned. I can then go through the list and manually edit the files to fix the issues however this can be extremely time consuming.

A feature of Resharper is to run a “code cleanup” which will format a file to the code style and remove any redundant code as well as fix many of the issues automatically.

Leave a Comment

Your email address will not be published. Required fields are marked *