Google App Scripts Test Runner - Lightweight test utilty for GAS projects
First install UnderscoreGS GAS library. Then either copy contents of Test.gs file into your project or into a new GAS library to be imported into your project.
- First write the unit test function which is any function that begins with "test"
// Test functions should return true for a pass or false for a fail.
function testSquare() {
const input = 10
const expectedOutput = 100
const actualOutput = square(input)
return expectedOutput === actualOutput
}
- Write the function.
function square(input) {
return input * input
}
- Execute runTests()