I've been trying to make unit-testing a more regular part of my work
flow - using qUnit so far. I've found it helpful for developing self-
contained projects, for instance jQuery plug-ins. I'm struggling with
working with third-party APIs, though.

The specific case is working with Facebook. I do a fair amount of
Facebook projects at work, but I always find working with the API very
frustrating. To reduce my stress level, I'm trying to abstract out a
lot of my frequent calls into my own custom wrapper around their API.
I've been using test-driven-development to lend some structure to my
development.

Where I run into problems is that since this is a wrapper, a lot of my
code ultimately depends on things completely out of my controls, such
as whether a user is logged-in to Facebook or not.

Conceptually, I realize that what I really want to test is my code -
not the Facebook API. For instance, I would want to test "if I make
call A when user is logged in, is Condition B returned?" and not "when
I call the FB.login() method, is a session cookie is returned?"

Since I can't programmatically log-in to Facebook, though, I'm finding
that I need to integrate some manual tester-interaction into my unit
tests. For instance, a page of all the tests I can run without being
logged in, then asking the tester to click a log-in button to proceed
to the next set of tests.

This hybrid automated/manual testing feels off to me, but maybe that's
just the way you have to do such thing? Any thoughts on this from the
group, either about developing with Facebook JS interactions in
specific, or with third-party APIs in general? I know sometimes the
answer to is to mock your third-party interactions, but when working
so closely with an API, that doesn't seem realistic or appropriate.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to