Keep your eyes on the ball....Always
The other day, a developer and myself were called out (nicely, of course) by our manager and another developer colleague. The SUT had a web page with a link named "Main Menu" on all of our page so that the the users - developers, testers, tech writer, salespersons, CEO, etc- could return to the entry page after performing an action. A few weeks ago, some developers and I discussed this and thought it sufficient to put this in until we came up with a better solutiuon. There were two problem with this, 1) there was not a story card for this and 2) the entire team was not aware of this conversation. To further complicate this, the developer and I wrote a test that coupled to this "Main Menu" link.
Here is a snippet of the Selelnium test that shows coupling:
_selenium.Click("link=Main Menu");
_selenium.WaitForPageToLoad("30000");
_selenium.Click("link=Create Workgroup");
_selenium.WaitForPageToLoad("30000");
_selenium.Type("workgroup_Name", "Physician Support Group");
_selenium.Click("//input[@value='Save']");
_selenium.WaitForPageToLoad("30000");
Assert.IsTrue(selenium.IsTextPresent("Workgroup has been created"));
Here is the new code snippet after I refactored the class which removed the "Main Menu" coupling:
_selenium.Open(UrlUnderTest("workgroups/new.htm"));
_selenium.WaitForPageToLoad("30000");
_selenium.Type("workgroup_Name", "Physician Support Group");
_selenium.Click("//input[@value='Save']");
_selenium.WaitForPageToLoad("30000");
Assert.IsTrue(_selenium.IsTextPresent("Workgroup has been created"));
Now, as a tester, I should have thrown in my flag and said something since there was no story card. But, given the fact there is a human-element, sometimes a "feauture" gets put into the application, knowing that it may be short-term, as was the case with "Main Menu" example. I spoke to a tester-colleague, Jim Matthews, about this, and he agreed with me that sometimes, non-malicious "feautures" are introducued to assist in the testing and display of applications, even though there is no story-card.
Now, I have no problem with taking reponsibility for something that I did incorrect, afterall, I am human and make mistakes. The great part about this, was that it was a low-level lesson to learn from and it took less than 30 minutes to refactor the class, test it and commit it to the repository. However, what if this had been something that we forgot about until 6 months later, whether the developers forgot to remove the link or I wrote many more tests which coupled to it? This could have been a potential refactoring nightmare.
OK. Lesson learned. My eyes are on the ball...Always.