mickael
mickael

Reputation: 2095

Cucumber/Ruby: is it possible to intercept HTTP requests/responses from browser?

I'm starting with Cucumber & Ruby and wondering if the following is possible.

I'm at a page and I know that when I click link, that's going to send a request looking like: http://example.com?param1=value1&param2=value2

Is it then possible to intercept that call and retrieve it's parameters by using Ruby? or if not, any other idea about how to get those values through an automated test?

Upvotes: 2

Views: 1824

Answers (1)

Andrei Botalov
Andrei Botalov

Reputation: 21096

What you want to do is called test recording. Test recording has many disadvantages and it's not a good idea to use it, see:

I doubt that there is a tool that can generate Cucumber features automatically. Cucumber features are meant to be used as a requirements storage, a mechanism to collaborate with stakeholders and a living documentation. It's overhead to use Cucumber if you don't need any of those sides. I can't imagine test recording tool that will generate features looking good enough to be used for these purposes.

Maybe there is a tool that will generate features or plain Ruby (e.g. Capybara) tests. But I doubt it's needed as Capybara tests are quiet easy to write and tests created using test recording tool will be hard to maintain.

Upvotes: 0

Related Questions