Skip to content

Automated Tests

Sean Lip edited this page Mar 27, 2023 · 5 revisions

For automated testing, we use the Jasmine framework. The tests are located under the directory spec. Since we need to mock the GitHub APIs locally via the tests, we require sample payloads. These are stored under fixtures directory as json files. You can see an example of how the sample payloads are used in checkIssueLabelsSpec.js


The directory structure for tests is as follows:

fixtures
|-- pullRequestPayload.json: The payload which resembles the opening of a pull request.
|
spec
|-- support
|    |-- jasmine.json: The jasmine configuration file.
|-- oppiabotSpec.js: The spec file containing the tests.


A quick introduction on how to write tests using jasmine can be found here.


This project achives almost full coverage, you need to make sure that your tests are comprehensive and cover all lines and branches. In order to understand the output of the test coverage this StackOverflow answer might be helpful.