Why you should improve your test automation code – Day 5 of 30 Days of Testing

READ AND COMMENT ON ONE BLOG POST

Did you know that it’s quite easy to find great testing blogs following just one blog? 5 Blogs is the one! Everyday there is a post with 5 best blog posts read. This blog has been a huge help for my 5th day’s challenge. I got a big list of great articles and chose Learn Development Practices To Improve Your Test Automation Code by Jeroen Mengerink.

This article pretty much expressed what I’ve learned myself. I started coding at my current job wanting to automate some Web UI tests with Selenium. In first month I was googling a lot, reading practical examples and playing around with code. My main focus was to make it work: if I want it to click on a button, it should do that.

I was glad to have something to show: I could run my code and a lot of operations I used to do manually would quickly be executed in the browser. However, even if my code worked, but it was not scalable at all.

After seeing my interest in coding, company’s developers decided to help me and move my project of automated tests forward. This is how my code started to be reviewed. I must admit that I was terrified. My first pull request got around 30 comments about structure, naming, all kinds of conventions. The main advice from the developer was to read “Clean Code: A Handbook of Agile Software Craftsmanship” by Robert C. Martin.

With time passing, I did read bits of the book and started noticing patterns of what mistakes I usually do and a lot of comments under my pull requests would be known conventions which were mentioned in the book. I improved my tests according to feedback I got and… it felt great. I really value all kinds of comments as usually they are helping me and my code to be better.

Thus, I definitely can say from my own experience, that if you want to do test automation, then you have to learn some software development practises as well. This is exactly what article I’ve mentioned in the start is saying: software development conventions are very beneficial to you. I cannot agree more.

Development practises ease your automation work: it is easier to add new tests, you don’t get lost in your own code (with time it’s going to expand), it is easier to refactor your code and change it when the need comes.

Code improvements even become like an addiction in the end – you want to refactor more and more to make your code cleaner and nicer to work with. Do not forget to invest some time to that because if you don’t – you will lose way more time trying to maintain messy code.

are-you-too-busy-to-improve2.png

Advertisements

3 thoughts on “Why you should improve your test automation code – Day 5 of 30 Days of Testing

  1. Hi Lina!
    I choose your blog to comment for my Challenge Nr 5. I am scripting already some time, but my developers has very little interest about it. It sounds great about script reviews what you do – will try to implement in our place as well. One thing, what you mentioned, I already have – addiction to refactor. I have a feeling – it never will be “done”. As we want to restructure our scripts – thanks for book suggestion,

    Cheers –
    Kristine

    • Thank you, Kristine! My honor to be the blog you commented on.
      It may take time to create a habit of code review, but it can be very beneficial. So, good luck in your fight for more cleaner code!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s