Skip to content

Fitbit Integration Tests Setup

aarondcoleman edited this page Jul 21, 2012 · 2 revisions

In order to set up the Fitbit Integration Tests you need a few things

  • NUnit installed
  • A free Fitbit developer account (dev.fitbit.com)
  • A consumer key / consumer secret, created in the Fitbit Dev site.

You'll walk through the OAuth procedure using NUnit and a web browser to finally obtain a permanent auth token that can be used to continuously test your code to and from Fitbit.

Step 1 - Configuration.cs Copy / Paste

  • ConsumerKey
  • ConsumerSecret

Now in NUnit, run the test "Can_Retrieve_Access_Token_Authorization_Url", If you inputed the Fitbit keys correctly it should succeed.

Success getting Authorization URL

Step 2 After you've authorized, Fitbit will redirect you back to a URL you provided. Notice the URL bar has new temporary keys, oauth_token=, and oauth_verifier=

This next part is time sensitive, maybe even just a minute to exchange oauth_token and oauth_verifier for permanent credentials. Copy and paste quickly.

  • Paste oauth_token and oauth_verifer in the Step 2 section of Configuration.cs
  • Run the test "Can_Retrieve_Access_Token_And_Access_Token_Secret"
  • Switch to Text Output mode. You should see the permanent keys and your user id
  • Paste all 3 in to the Step 3 section of Integration tests.

Success getting permanent auth credentials

You're done! Integration tests should run.

NOTE: This is the best way I could find to distribute integration tests without giving away a key that could be used by whomever. If anyone has a suggestion for how to minimize this, I'm up for discussion.