Blog

30 Days of Agile Testing! Day twenty-four.

Day 24:
Look for a task that can be automated


This is kind of cheating. We have a script that I use a lot - so it’s already automated - but I want to make it even *easier*.

We use Typescript for writing our automation suite. This means files with the extension ‘.ts’
Typescript, when compiled, creates a bunch of other files - like so.

ts.png

This makes navigating my IDE a little unwieldy!

We already have a script called nuke.sh that clears these files out for you. (At this point, I should probably mention, I’m using a mac)

It looks like this:

find . -name ".js.map" -type f -delete
find . -name "
.d.ts" -type f -delete
find . -name "*.js" -type f -delete

It means opening a command window, finding the script, and running it.
Sounds simple, but I’m too lazy to do even that. I want to do it with one click!

Fortunately, that’s really easy.


First I need to change the script slightly so that it switches to the right directory first.

Like so:

cd ~/development/tests
find . -name ".js.map" -type f -delete
find . -name "
.d.ts" -type f -delete
find . -name "*.js" -type f -delete

Second, I need to rename the file to a `.command` file - this is a file that MacOS will know to open and run in terminal.


Finally, the file needs to be executable!
This is also done from terminal by using the following command:

chmod +x nuke.command

Nuke.jpg

Oh there’s one more step… it needs a cool icon…

...like this!

 

 

And that’s it - want to see it go?

nuke.gif

It might not look like much, but it’s going to save me a few clicks!

- JE