Help Yourself Perform Tasks With Personal Shortcut Commands

In a recent automation work I’ve been asked to take part in, running a single test safely, according to peers, generally follow a three-step process:

  1. Delete existing feature files:  rm -rf *.feature
  2. Create updated feature files:  PROJECT_DIRECTORY=../<dir> APP=<app> TEST=automated ruby create_tests.rb, where app is the name of the app you want to test
  3. Run the desired specific test:  cucumber --tags @<tag>

This means I have to re-run these three steps over and over for every single test I want to review. That can get tiring easily, especially if I have to re-type them repeatedly, or even if I copy-paste. Using the arrow keys in the terminal helps, but sometimes commands can get lost in the history and then it becomes a bit of a hassle to find them.

There should be a way for me to run an automated check I want to review, given just the app name and the test tag. It would be nice if I can run a specific test using a shorter command but still following the same process as provided.

I decided to set aside a little bit of time to write a personal script, and used Makefile because I’ve had experience with that before.

My personal short command for running a test:  make test app=<app> tag=<tag>

And here’s what the script looks like, which runs the known commands step-by-step plus displays some information on what’s currently happening:

Now I won’t have to worry about remembering what commands to type in as well as the sequence of the commands. I can give more focus on actually reviewing the test itself, which is what’s more important.

Advertisements

Five People and Their Thoughts (Part 8)

Sharing a new batch of engaging videos from people I follow, which I hope you’ll come to like as I do:

  • Workarounds (by Alan Richardson, about workarounds, how you can use them in testing, custom-using tools, moving boilerplate to the appendix, bypassing processes that gets in the way, understanding risks and value, technical skills, and taking control of your career)
  • 100% Coverage is Too High for Apps! (by Kent Dodds, on code coverage, what it tells you, as well as what it does not tell you)
  • Open Water Swimming (by Timothy Ferriss, about fears, habits, total immersion swimming, Terry Laughlin, compressing months of conventional training into just a few days, and the power of micro-successes)
  • How To Stop Hating Your Tests (by Justin Searls, representing Test Double, on doing only three things for tests, avoiding conditionals, consistency, apparent test purpose, redundant test coverage, optimizing feedback loops, false negatives, and building better workflows)
  • Meaning of Life (by Derek Sivers, about a classic unsolvable problem, using time wisely, making good choices, making memories, the growth mindset, inherent meaning, and a blank slate)