AppsScriptPulse

Unit Testing in GAS Part 4: Error Handling | ohhey[blog]

Up until now, our Calcs class has handled errors with simple true and false flags. That’s not helpful to the user. At this point, we’re ready to begin defining and testing custom errors in our functions.

QUnit allows a throws method which can check for errors in your application. This tutorial post adds some error checking to a simple Apps Script project.

Source: Unit Testing in GAS Part 4: Error Handling | ohhey[blog]

Unit Testing GAS Part 3: Adding and Testing Functions | ohhey[blog]

We’ve looked at how to install and configure QUnit and just finished writing some simple tests. In this post, we’re going to write a new method, add(a, b) in Calcs which will add the two passed parameters.

Part 3 in the unit testing series, this post looks at writing tests for new methods and some considerations for when (or when not) to use private functions in Javascript when it comes to testing.

Source: Unit Testing GAS Part 3: Adding and Testing Functions | ohhey[blog]

Unit Testing GAS Part 2: Simple Tests | ohhey[blog]

Unit tests are for single units of code. They test a specific function for a specific result…

Part two in a series on unit testing, this configures the QUnit web application and has you write simple tests against an Apps Script class.

Source: Unit Testing GAS Part 2: Simple Tests | ohhey[blog]

Unit Testing GAS Part 1: QUnit Setup | ohhey[blog]

I’m not good at writing testable code. I’m more of a ‘figure it out when it breaks’ kind of hobby programmer. The problem with this is that I am constantly making my own bugs and not really finding them until a bad time.Unit testing is the process of running automated tests against your code…

The first post in a series, this will eventually be an in-depth look at unit testing both as a habit of writing code and through the lens of large Apps Script projects.

Source: Unit Testing GAS Part 1: QUnit Setup | ohhey[blog]

Subscribe to Apps Script Pulse...