4

I have a AppEngine application that exposes some APIs. Right now I'm writing tests for those APIs but some of them enqueue tasks. I'm not sure how I can write a test case that waits for all the tasks that certain API call enqueued to finish.

Any ideas how within a test itself I can verify that certain tasks have finished?

rzajac
  • 1,591
  • 2
  • 18
  • 37

2 Answers2

8

I assume you are using testbed.

Within testbed, enqueued tasks sit there until you execute them yourself. Since the test environment is single threaded, you manually execute the tasks in the queue and you know exactly when they are done.

This answer shows you how to manually execute tasks.

Community
  • 1
  • 1
new name
  • 15,861
  • 19
  • 68
  • 114
0

The SDK comes with a testbed for some APIs, taskqueue is one of them.

Shay Erlichmen
  • 31,691
  • 7
  • 68
  • 87