mardi 7 mars 2017

Cucumber/Automation testing: How to approach the overall concept using javascript functions?

Firstly let me say that I'm new to javascript and just starting out. This may be a broad question, but I would really like to get an answer so I can understand the whole concept/approach. I'm reading this book called More Agile Testing and there's a paragraph about automation testing and page object pattern and how it's very useful to write your automated test cases in a way so if something changes on the actual UI, I would only need to change that object/function and every other test cases that uses that object/function will continue to work after that one change.

Here's an example of what I'm thinking, let's say I have the following cucumber scenario

Given I'm on some page
When I login
Then I must see some other page

So that's a scenario above.

Should I implement my code for login like some kind of function that receives two parameters for login and password and click on needed fields/buttons on the UI. And if I have that function I would simply use When('something'), function login() etc.

And for future if I would need to use login in other test cases, I would use that function in given or when statements.

Is this the right way to go about it ?

Aucun commentaire:

Enregistrer un commentaire