Fun With Fluent Testing with Andrew Krug
Are you still unsure about whether automation is really software development? In this episode Andrew Krug, founder of LazyCoder.io, shares some test automation techniques as well as some reasons why you should considers yourself a developer. Andrew asserts that if the main program you’re leaving open on your computer all day is an IDE, you're a developer. Still not convinced? Listen up and discover how to take your automation developer skills using Fluent Testing Techniques to a higher level. Check it out!
About Andrew Krug
Andrew Krug is the founder of LazyCoder.io
Quotes & Insights from this Test Talk
- Testing for my mind it's more of writing your tests so that they are all essentially like exactly like the test cases you currently have written just with code instead. So test should sound very English it should be very clear to everyone who's looking at your test what the test itself is actually doing. And that pretty much sums it up.
- Fluent pattern is to not constantly initialize new objects in your code. So you would have methods return either an instance of themselves like you're doing an action on a page like go find this row. OK when you find this row and you want to do something on this road and you're just in a table or something like that you're still on the same page you haven't moved yet. But then when you do an action that's going to take you to another page on that method that you call within your test will actually take you initialize a new page or you're going to and then give you that object already initialize which is technically method cascading. And those two are like the biggest two patterns that are pattern both method chaining and cascading that allow you to quickly write the different tests and keep it clean.
- Method Chaining is when obviously when you chain methods together but it's all typically on the same page. So if you have like a page or has a table on it. Typically anything to do on a road you have a method that returns said row but you still left the page so you still have options to like click for example the search bar or view of filters at the top you can still click it once you find that row. And that's just within the same class Method Cascading though is creating a new object. So like when you're never getting into a new page and then that is the return value for the method. So you can create a new object and then pass it on return it to you. So you use it in the next class.
- It is to a degree over engineering it. However the benefits come from when you actually go back and have to go back to an old test and trying to figure out what is it doing. The test is very is just like English. Just instead of spaces you have periods because of the chaining and cascading that's occurring. But then it's much easier to like refactor and everything which makes your life a whole lot easier when functionality changes you just change the methods.
- I use the dictionaries a lot just to throw out specific different assertions that I'm about to assert on because I can easily just go ahead and cycle through them whatever values I need. And typically again like with those assertion methods I have on two different pages. They know exactly what values are looking for within the dictionary. So just go ahead and get it out of the dictionary. I don't worry about switching the different types. Getting it from a different area and it's always the same it's always in a dictionary that's stored at the Test level. Grab that it will grab the values that it's looking for within this one for whatever the assertion is going to be and use a value for the assertion.
- To improve your fluent testing skills or just any testing skills definitely. Well the DRY pattern which is don't repeat yourself. So look to your code you probably have done some new steps that you do a lot of times. Go ahead pull that out. Refactor it make it cleaner make it easier to maintain
If the main program you have open on your computer all day is an IDE -You’re a developer @lazycoderio #Testers #AutomationClick to tweet
Connect with Andrew Krug
May I Ask You For a Favor?
Thanks again for listening to the show. If it has helped you in any way, shape or form, please share it using the social media buttons you see on the page.
Additionally, reviews for the podcast on iTunes are extremely helpful and greatly appreciated! They do matter in the rankings of the show and I read each and every one of them.
Test Talks is sponsored by the fantastic folks at Sauce Labs. Try it for free today!