Join us for office hours !


We highly recommend working in the style of test-driven development when creating probot apps. It is frustrating to constantly create real GitHub events in order to test an app. Redelivering webhooks is possible and can be accessed in your app's settings page under the Advanced tab. We do offer the above documented simulate method to help make this easier; however, by writing your tests first, you can avoid repeatedly recreating actual events from GitHub to check if your code is working.

For our testing examples, we use jest, but there are other options that can perform similar operations. Here's an example of creating a robot instance and mocking out the GitHub API:

// Requiring probot allows us to mock out a robot instance
const {createRobot} = require('probot')
// Requiring our app
const app = require('')
// Create a fixtures folder in your test folder
// Then put any larger testing payloads in there
const payload = require('./fixtures/payload')

describe('your-app', () => {
  let robot
  let github

  beforeEach(() => {
    // Here we create a robot instance
    robot = createRobot()
    // Here we initialize the app on the robot instance
    // This is an easy way to mock out the GitHub API
    github = {
      issues: {
        createComment: jest.fn().mockReturnValue(Promise.resolve({
          // Whatever the GitHub API should return
    // Passes the mocked out GitHub API into out robot instance
    robot.auth = () => Promise.resolve(github)

  describe('your functionality', () => {
    it('performs an action', async () => {
      // Simulates delivery of a payload
      // payload.event is the X-GitHub-Event header sent by GitHub (for example "push")
      // payload.payload is the actual payload body
      await robot.receive(payload)
      // This test would pass if in your main code you called `context.github.issues.createComment`

A good testing example from update-docs can be found here, and another one from owners can be found here.

Found a mistake or want to help improve this documentation? Suggest changes on GitHub

Get occasional updates on new apps & features.


with by @bkeepers

Code licensed ISC Docs licensed CC-BY-4.0