Let's write unit tests for AzerothCore #3981
FrancescoBorzi
started this conversation in
News & Blog
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction about test automation
WoW emulation projects are great, but in my opinion, they've always lacked a solid test automation suite.
We've always relied on manual testing. At AzerothCore we test PRs before merging them to master, this is already better than merging untested changes, but still not enough.
Why test automation? Because every time you modify your software, you never know if you are breaking any existing functionality unless you manually test everything again and again. When you have automated tests in place, you are still not 100% sure about not breaking existing stuff, but at least they can give you some assurance.
I think Keira3 could be seen as a good example of a software that has test automation in place: per every commit/PR, we run in our CI a set of automated tests that automatically check if the most important features of the app are still working. If something is broken, the CI will fail.
It would be great to have something similar for the main core, right?
Unit testing
Unit testing is a specific kind of test automation
Compared to other levels of test automation, unit testing is usually faster, cheaper and easier to implement/maintain. So let's start with that.
Writing unit tests for AzerothCore
Typically a software should be built together with its test suite, however, that was not the case for the projects AzerothCore was based on. As a result, we have a huge codebase that is entirely not unit tested.
We've added the base unit test setup (using the Googletest framework) for AzerothCore, as well as some examples about how to write unit tests. You can find all instructions here:
https://www.azerothcore.org/wiki/unit-testing
We need the help of contributors to write more unit tests and cover as much code as possible with automated tests.
Personal gain
I can assure you that any decent software development company requires its own developers to write unit tests. If you are going to an interview for a software engineer role, knowing how unit tests work it's a big plus for you (for many companies it's actually a must).
So, I promise: writing unit tests for AzerothCore will not only be good for the project but also for your professional skills.
Beta Was this translation helpful? Give feedback.
All reactions