Behat how to capture data from one site to fill in fields on another site in a scenario test

791 Views Asked by At

I am new to Behat scenario testing and wanted to know how to or best practice to capture/store data from one site to use on another site to fill in user information. For example site 1 can create a user profile such as user ID and password. Site 2 take user ID and password from site 1 and use it on site 2 to fill in the requested ID and password logging the user into the site.

I can do this with java and selenium web driver and with a string name from site 1 and call that string in site 2 at the user id location with “send keys (string)”. What is the best way to do this with behat PHP scenario and feature context setup?

I have also reviewed on this site "How to test with behat two sites in the same test, which helps with the first stage of the scenario, but not the filling in data on site two.

1

There are 1 best solutions below

2
On

First please tell version of behat. It is big diffrence between v2.5 and v3.0. Do you use Mink? In that case you have CSSSelector to extract values. Next you need to save them. You could do this in context saving as value in given step, but for everytime you will repeat this for others data.

To feel data of form in other you simply write create form in context, but still you repeat this for each form.

I created some universal lib for holding data and sending this to scenarion. Still in dev, but could help: clipboard