Why I don’t record automated tests

Recently it was pointed out to me that Playwright has a test generator and that I could use it to record tests. Many automated testing tools include a tool or extension that can be used to record tests. I don’t find them useful. 

My experience of using tools to record tests is that they record steps that work if they are played back immediately, but only if they are played back immediately. The recorded steps will be flaky. Every test automation tool I have used has needed additional steps to control the test flow. The recorded steps tend, to either need additional steps to wait for an element to be present or additional steps to wait for an action to finish. 

Test automation code should also be modularised, and recorded steps are not modularised.

The test automation engineer needs to create libraries of modules or functions, possibly in a Page Object Model, so that the code can be easily maintained and tests developed quickly. Steps that have been recorded need to be refactored into modules or functions. It is quicker to write the module or function than to record steps and refactor them.

If you record the steps you don’t learn how to develop tests yourself. Recently I was developing a test with Playwright and could not get the test to do what I wanted with built-in locators. I tried using CSS selectors instead of the built-in locators and could not get them to do what I wanted. So, I read the code in the front-end repo and worked out which element of the DOM I needed to interact with and which action I should use. While working out how to interact with the DOM I learned a lot about the application I am testing and about Playwright. If I had used the recorder all I would have learned would have been how to use the recorder.

The main reason to not use a recorder is that you want to develop your test automation skills. Instead of using a recorder I used the learning resources to learn how to automate tests. I now have more skills and am continuing to learn about test automation. 

I started test automation by using free resources like these:

There are many other great resources too.

Published by Mike Harris

Mike has been working in testing for 20 years and is the lone tester for Geckoboard. He has been a Test Lead and has also worked as a part of waterfall, lean and agile teams. He has a B.Sc.(HONS) from Middlesex University and is an Associate of the University of Hertfordshire. He has set up and led a Testing Community of Practice and been part of a successful agile transition. He is Vice-Chair of the British Computer Society’s Specialist Interest Group in Software Testing. He also contributed to the e-books Testing Stories and How Can I test This? and has had articles published by the Ministry of Testing, LambdaTest and The QA Lead.

Leave a comment

Design a site like this with WordPress.com
Get started