2
votes

I've created a gmail addon which uses oauth to make external api calls using UrlFetchApp and then uses cards with CardService to show some info.

It all works but there's no documentation on the gmail addon page about how to test the addon. My goal is to write some unit and integration test for my addon core working and have it run on ci services such as Travis. There are many classes the addon uses which are only available in the app script environment such as CardService, OAuth2, GmailApp so mocking all of their functions is quite a bit of work.

Has anybody developed gmail addon with tests which can run on ci services?

1

1 Answers

3
votes

GMail add-ons are relatively new to the GSuite ecosystem so you're unlikely to find mocks for it. However, there have been attempts to build Test frameworks for Apps Script.

There is an "awesome list" of GAS resources maintained by Alexander Ivanov on Github with a section dedicated to testing. See link below:

https://github.com/oshliaer/google-apps-script-awesome-list#testing

In its current state it may be difficult to set up Apps Script for continuous integration but with the planned language upgrade to Chrome's V8 engine that may soon change.