How are you guys doing functional tests for Shopify apps requiring OAuth?

387 views
Skip to first unread message

Leonard Teo

unread,
Aug 27, 2012, 3:35:58 PM8/27/12
to shopify-a...@googlegroups.com
Hi guys,

What's the best strategy for writing functional tests when dealing with OAuth API authentication with Shopify? Obviously, when I do an OAuth authentication, it tries to redirect me to my test store to login. Just curious if there is any way of writing a fully automated functional test for all this.

Thanks,

Leo

Lars Grammel

unread,
Aug 27, 2012, 3:46:48 PM8/27/12
to shopify-a...@googlegroups.com
Hey Leo,

I have just looked into this for my own app. The "Continuous
Deployment" book recommends to stub external systems (i.e. the Shopify
API) for acceptance testing, and to write separate integration tests
that verify that the Shopify API hasn't changed. This has the
advantage that you can test failure scenarios as well (e.g. fake
network timeouts), and you don't put load on the Shopify servers for
testing. This strategy has worked well for me so far.

Lars
> --
>
>
>



--
Lars Grammel

http://larsgrammel.de
http://twitter.com/lgrammel

Edward Ocampo-Gooding

unread,
Aug 27, 2012, 5:06:07 PM8/27/12
to shopify-a...@googlegroups.com
+1 to this. The App Store is actually an app itself, and I test it out as Lars mentions.
--

Christopher Saunders

unread,
Aug 27, 2012, 5:22:01 PM8/27/12
to shopify-a...@googlegroups.com
If you are looking for some specific tools here are some that I've been using:

When mocking API calls (for example using ShopifyAPI::<Whatever>) I just use Mocha/RSpec mocks.  Typically I'm just checking to make sure that these things are being called properly.

If for whatever reason I'm making HTTP requests outside of the shopify_api gem I use FakeWeb.  It works pretty well, although it sometimes feels a bit limited.

--
Chris // API and Integrations Developer @ Shopify

--
 
 
 

Edward Ocampo-Gooding

unread,
Aug 27, 2012, 5:25:03 PM8/27/12
to shopify-a...@googlegroups.com
I use WebMock now, but if I were to do it again, I would seriously look at https://github.com/bblimke/webmock as its error messages are way better.

I would also take a look at using https://github.com/myronmarston/vcr 
--
 
 
 

Christopher Saunders

unread,
Aug 28, 2012, 7:42:15 AM8/28/12
to shopify-a...@googlegroups.com
I use WebMock now, but if I were to do it again

Do you mean FakeWeb or is there another web mock library just like there's a state_machine and statemachine gem >:/

I believe I used WebMock on a personal project, and yeah it was pretty solid.  It also appears to be actively maintained, which is always a good think too.

--
 
 
 

Edward Ocampo-Gooding

unread,
Aug 28, 2012, 10:02:09 AM8/28/12
to shopify-a...@googlegroups.com
FakeWeb and WebMock are different, yes :)
--
 
 
 

Reply all
Reply to author
Forward
0 new messages