Everyone Needs Their Own QA Library
Although I've played very different roles for different companies over the years (designer, social media manager, developer), I've always been a part of the Marketing department. That means I have identified a lot of overlap in quality assurance with my work.
We, marketers, love content that doesn't have spelling errors or broken links, and does have beautiful, optimized images. We want our digital products to be responsive and functional. We want brand guidelines and writing conventions to be followed.
Guess what? We can automate these little QA checks pretty easily. Even better: You can build up an automated QA library that you can take with you from role to role or company to company.
Rules
First, to be safe, make your QA library when you're not on company time. That doesn't mean you can't try automating when you're on the clock, but you should definitely make a final version that works better when you're off work. This way if the company somehow finds out and wants to claim your code as theirs, you have the improved V2 code at home.
Don't brag. It's easy to want to show off how cool you are for automating something, but unless you think there's a really, really, good chance that talking about your automations will advance your career / accomplish another goal, just don't mention it. Your coworkers and your boss are already used to you doing things the hard way, why ruin the chance to improve your workload with less effort?
How to Start
Checklists are a great way to compile the things you / your team values in your work. You can check out my Web QA Checklist for ideas or as a starting list.
Once you have a checklist put together you can get to work on your QA library. Take an item off the list and see if you can figure out a way to automate that check. For example, checking for broken links on a webpage:
import requests
#For single links
def check_link(url):
try:
print(url)
res = requests.get(url)
res.raise_for_status()
print("Status: " + str(res.status_code))
status = str(res.status_code)
except requests.exceptions.HTTPError as e:
print(e)
status = str(e)
print('\n\n')
return status
The code snippet above is a good way to structure your library, i.e. with a group of functions that you can combine or call. In my case, I would have another function that pulls all of the links from a given page into a list that I can then loop through and check things.
I want to check the status of the URL in the href value, but I might also want to check the rel or target attributes as well, so I can perform all of those checks on that page link like this:
for url in page_urls:
status = check_link(url)
check_rel(url)
check_target(url)
I have the check_link() function return the actual status code in this instance, but perhaps a better way to structure your checks is to return True if it passes all of your rules and False if it doesn't. (Sometimes I like to know about status codes and do things with them later, so that is just a design choice you'll have to make. You can certainly have your functions print out info like status code if you won't use the status somewhere else.)
Now You've Got It!
Your QA library will become increasingly valuable as you add these checks to it. It's a constant work in progress and it can pay off big time.
I had built up a decent library when I was a junior dev and it helped me keep my precious record spotless by never having a QA strike on my work the entire time I was employed. Beyond helping my pride, when I found out I was getting laid off and then ended up in the ER due to an MS attack, that little library I had built became my saving grace as I finished up my last two months at the job. I was unable to keep pace with my previous work speed, but I knew these little scripts would keep my quality up to par.
Hopefully you won't need your library like I did, but it's a tremendous support in your work even on the good days. QA checking takes a lot of mental focus and energy, and it's just not necessary for a majority of tasks. Having the computer take that on for you so you can breathe a little easier, get up and stretch is simply invaluable.