Sunday, August 7, 2016

AUTOMATION 21: Stick it under version control!

Since my last article, I've been busy getting a Github account, and putting some of the examples I've produced into repositories.

Github is a combination of version control system, with also some features of cloud storage in terms of ease of sharing and collaborating with others across the world.

There have been two reasons why I've been driven to set up a Github account,

Reason 1 - easier to share examples

I've had a couple of private comments on my blog that some of the coding examples haven't been easy to read on some smartphones.  There's obviously a limitation to what I can do there, because I use a lot of what comes "out the box" on blogger.

Hence - being able to point to code on Github is handy for people who want to try out my examples.

Reason 2 - version control really is a must for automation

I've been using this automation as a great excuse to discuss what we're doing in automation across the world.  And one very strong theme I keep hearing is "treat it like production code. Put it under version control".

If your automation uses a language, there is good solid sense to this.  A work colleague of mine told me "treat it like production - every time you touch it, make it better" and yet at the same time "be daring, but keep it clean".

Cautious coders tend to change as little as they can, and comment out parts of the code they're replacing.  This can be well meant, but over time, the code can be so filled with elements of what the code used to do, but was never cleaned up, that it becomes messy.  Messy code is harder to maintain.

The only way you can really be daring is knowing "well if I mess this up, I'll just go revert to my working backup".

Find me on Github

My code for unit testing a dice class is here.

My first Selenium test for checking web content page for the word "aardvark" is here.

My second Selenium test for entering an anonymous comment and previewing the content is here.


Extension material

Get yourself set up on Github for when you're experimenting with the automation we've done so far.  The best material I've seen for this is here.

No comments:

Post a Comment