The popup killer from hell
Tags: automation, testing, codinghorror, ranorex
Published: 2019-09-07 00:11:47

---
title: The popup killer from hell
published: true
description: a coding horror story
tags: automation,testing,codinghorror,Ranorex
---

Back when I worked at my first programming job, we had a distinct lack of unit tests in our legacy codebase. Every change had to go by QA, because even a single line change could ruin everyone's day. In an attempt to fix this management hired an automation engineer to write a gigantic automation suite. They used Ranorex to automate mouse clicks like a real human user - click on this button, then that, scroll down, click here, etc.  Unfortunately Ranorex frequently failed for bizarre hard-to-debug reasons. Sometimes it would fail to find an element that was staring it in its face. Other times it would simply fail because why not? 

Popups were one such cause of failure. Ranorex would be happily moving the mouse, when BOOM - popup. With the popup covering up the application or demanding focus ranorex would simply fail. My coworker blamed IT for causing the popups, but eventually got tired of navigating IT bureaucracy and decided to go nuclear on the problem - he made a script that would kill EVERYTHING except for a few whitelisted processes.

I'll leave you a few seconds to think about how this could go wrong.....


So one day I started debugging the automation and everything except Visual Studio suddenly died. I stared at the screen in horror[^1]. What on earth happened? Then I realized - *the popup killer!* Of course! It launched in a seperate process and because I stopped debugging in the middle of the run the class cleanup was skipped. 

Well, no matter. I would fix it but in the meantime I'd just reopen up chrome... it closed. I reopened chrome again, it closed again. Click close Click close. I tried opening up notepad. Same thing. Oh god. I tried opening the task manager and it was murdered right before my eyes. But I was able to open up the command line. I ran `tasklist` to find the popup killer process followed by `taskkill` to kill it but taskill itself was killed before it could even run! 

Things were looking grim. 

The class cleanup code killed the process by creating a file called `killthekiller`. The popup killer looked for this and committed suicide when it saw it. But for some reason when i created the file nothing happened. As a final resort I tried using C# code in Visual Studio's [immediate window](https://docs.microsoft.com/en-us/visualstudio/ide/reference/immediate-window?view=vs-2019). This didn't work either - I don't remember why. Now I was **totally** screwed. I had to restart the computer.

💀💀💀💀💀💀💀💀💀💀💀💀💀💀


After restarting, I made some changes to the code. I put all sorts of programs in the whitelist and I changed the class cleanup to directly kill the process. The problem was fixed. But the memory of it will remain scarred into my brain.

I now work for [15Five](https://www.15five.com). We have a comprehensive unit test suite growing in coverage each month. Besides the occasional timezone issue tests are pretty stable. Sometimes I miss my old coworkers. But let me tell you: I do NOT miss Ranorex.

[^1]: To be honest, this was about a year ago and I don't quite remember how I reacted. I'm using artistic license `¯\_(ツ)_/¯`