Basic setup for tests

133 views
Skip to first unread message

David West

unread,
Feb 22, 2016, 2:56:26 PM2/22/16
to martianproxy-users
I have a web app with an external service.

I want to swap that external service out with Martian in my tests.

What do you recommend?

I could:

- leave a martian proxy instance running and configure all my application instances in a particular environment to hit the proxy instead of the regular service.

- have my tests in their setups start up the proxy and make calls to the app with parameters that make the app hit the proxy

- any other possible config...

I want to know how you typically use it.

This idea of using a proxy in tests is very new to me, and I would like some practical advice that gives an overview of how everything works.

Where are the good resources I can read to get educated about how to do this well?

Bramha Ghosh

unread,
Feb 24, 2016, 1:54:15 PM2/24/16
to David West, martianproxy-users
Hi David,
I suggest starting up the proxy and configuring it for each test.  Martian starts up and shuts down pretty quickly, so I wouldn't expect to see that much overhead added by doing it this way.  If you wanted to go down the single instance of Martian route, you'd need to differentiate the traffic from each test with a header, and then set up header filters in Martian - it's a bunch of work, and it may not really buy you anything.  I really think the simpler approach is a Martian test.

So, it the Setup() method of the test, you'll want to start up the proxy and send it the correct JSON configuration.  If you're using it to mock out external services, you're looking at a response modifier to specify the mocked response, and a skip roundtrip request modifier to bypass the request to the actual external service.  You should be fine with the proxy running local to the test.

I don't know that there are a ton of soup to nuts type of resources on how to do this, but this is a talk from last year's GTAC about how LinkedIn is using a proxy to mock external HTTP service: https://developers.google.com/google-test-automation-conference/2015/presentations#Day2LightningTalk2 This might help clarify some of the concepts we're dealing with.

Let me know if you run into any issues with the configuration or any other issues!

Bramha




--
You received this message because you are subscribed to the Google Groups "martianproxy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to martianproxy-us...@googlegroups.com.
To post to this group, send email to martianpr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/martianproxy-users/44bcdf91-e625-4193-abac-a497d694a7f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

j...@google.com

unread,
May 13, 2018, 9:30:18 AM5/13/18
to martianproxy-users
For others who come across this thread: you can find a record/replay proxy built on martian at https://github.com/GoogleCloudPlatform/google-cloud-go/tree/master/httpreplay
Reply all
Reply to author
Forward
0 new messages