Friday, May 20, 2016

Getting Abstract...

After I had my first glimmerings of OOP, my next learning was an extrapolation of having code in the window classes.

I didn't know about abstractions or encapsulations yet, but I knew that having all these functions was producing too many things to take care of.

I also knew that, if I put code into the window definitions, then the tests wouldn't have to know how to do a thing, only which window to ask to do it. It wasn't until quite some time later that I was told that this was both abstraction and encapsulation. I had learned to decouple the tests from the interface being tested. Yay!

In my current position, our tests make use of page objects to accomplish this same thing. And it's a decent start. One of our rules is tests never touch controls directly, they call functions in the page object. A good idea.

One of the things I observe in the code I've inherited joining my current gig was that often, instead of clicking a link, the tests here would call a function like page.click_link_to_next_page()

I'm looking to change this, because this means the test is still coupled to the interface, but now we wrap the selector in a function. Which actually doesn't accomplish the goal.

Coming next.. about rules and whys.


No comments:

Post a Comment