ACF-Team / ACF-3

ACF
MIT License
69 stars 56 forks source link

Add GLuaTest #314

Closed brandonsturgeon closed 1 year ago

brandonsturgeon commented 1 year ago

Hello folks!

Today I'd like to propose the addition of GLuaTest to the ACF-3 project.

GLuaTest is an automated testing framework for Garry's Mod.

The Pitch πŸ’Ό

Automated testing is an industry-standard practice in professional settings. We don't need to be as strict about it in the context of Garry's Mod, but there are a lot of benefits to writing good and full tests for your project:

- Greater confidence in your code 😏

Maintaining a large Garry's Mod project can be nerve-racking. Any mistakes or breaking changes are met with scathing, harsh reviews, and excellent new features are met with silence.

This can lead to a situation where developers are very cautious about adding new features or making changes because they're worried about what could happen if they make a mistake.

Being confident in your code means you can move faster and be more proactive about changing the addon for the better.

- Faster Debugging πŸ›

In any system, things will break. Even the most robust and well tested system will see bugs and misbehaviors slip through. It's just the nature of Software Development.

Having a test suite set up can make the process of debugging and fixing the issue much faster. Seeing which tests pass can help you narrow down your scope of the problem.

- Faster Development πŸƒ

In Garry's Mod, there are two schools of thought when it comes to development:

If you're writing good tests, you can lean more on the latter, and focus on writing the code + automated tests for your new feature. When you open a PR, the test suite will tell you what works and what doesn't.

Assistance πŸ†˜

Because of my close proximity to the ACF project, I can offer my full support to your testing efforts. I can help you write new tests, I can improve GLuaTest to fit your use case better, I can help you fix existing tests - literally anything you need, I've got you.

I'm in the development channel on Discord, so you can always ping me about anything related to testing.

The PR πŸ‘‡

I included a pretty reasonable amount of base-level test coverage

I've tried to write tests for a spread of functions. I'm no mathematician or physicist, so I steered clear of the math-heavy functions. Those should be tested by people who know the problem better than me.

What I've provided in this PR should be enough to copy-paste some basic test coverage for other methods/features.

If accepted, I encourage you to branch out and explore what other kinds of tests could work for ACF.

You could spawn Engines, Ammo Boxes, Guns, etc. and actually test them for real - it's just Garry's Mod Lua afterall!

You can read more about GLuaTest and how it works here: https://github.com/CFC-Servers/GLuaTest

I'll start a discussion over in Discord too.