Often when you're inching forward within an ASP.NET project you'll find yourself repeating actions over and over again to get to a certain page, often three or four actions in to the application. As someone who hates repetitive actions this is what I do.
(These examples are in VS2005, but will work in VS2003, although the property dialogs have changed)
I use Watir to automate the clicks that will get me to where I'm going and set my Watir script to startup when I press F5 to start my project debugging.
In this example, I have a script called justsignon.rb that signs on, visits the customer's accounts page, then goes to their Account History page. It's that page that I am currently debugging so I want to automatically show up there in a certain state when I start debugging.
require 'watir'
include Watir
require 'test/unit'
class WatirMakerRecorded < Test::Unit::TestCase
def test_recorded
ie = IE.new
ie.goto('http://localhost:4970/MobileDemo/default.aspx')
ie.text_field(:name, 'userTextBox').set('testuser1')
ie.text_field(:name, 'passwordTextBox').set('123456')
ie.button(:name, 'signInCommand').click
ie.link(:text, /Hanselman/).click
ie.link(:text, "Account History").click #UPDATE - the debugger will detach if the spawned process ends, so wait for ENTER
gets
end
As I move forward in my development process I use different scripts to get me to different states. This easily adds up to as much as 15 minutes to a half hour of rote "monkey clicking" that is usually wasted time.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.