Okay, okay, I get it. You're a big strong engineer and you don't need a README.
Here's the bare minimum you need to get started
Create the basic test structure:
-- lua/tests/project_name/main.lua
return {
groupName = "MyProject",
cases = {
{
name = "Should create project tables",
func = function()
expect( MyProject ).to.exist()
end
},
{
name = "Should not load modules automatically",
func = function()
expect( MyProject.Modules ).to.beNil()
end
}
}
}
- Here's a list of the keys the outermost table (the "Test Group") accepts
- Here's a list of the keys the items inside of the
cases
table (the "Test Cases") accept - There are a number of different expectations you can use inside of your test functions
Sidenote: There are a lot of ways to structure the test file. Play around with some different methods to see what works for you!
name: GLuaTest Runner
on:
pull_request:
jobs:
run-tests:
uses: CFC-Servers/GLuaTest/.github/workflows/run_tests.yml@main
# The entire 'with' block and every item in it are optional
with:
# Relative path to a supplemental startup config file for the test server
server-cfg: lua/tests/my_project/test.cfg
# Relative path to a text file with your dependencies
# Example contents:
# CFC-Servers/logger@lua
# FPtje/DarkRP
requirements: lua/tests/my_project/deps.txt
# The gamemode for the test server to run (defaults to sandbox)
gamemode: darkrp
# Workshop collection ID
collection: 1234
# Passwordless Private key with access to your private requirements
ssh-private-key: "${{ secrets.GLUATEST_PRIVATE_KEY }}"
# A GitHub Personal Access Token with access to your private requirements
github-token: "${{ secrets.GLUATEST_TOKEN }}"
That's it! You have a working automated test runner for your project.
Check out the README for more details about before/after functions and how to make async tests.