I'm new to the Android platform, but am looking into doing some development for Android 2.x, with the hope of publishing an app to the Android App Market eventually. I'd like to be able to test my app on "real" hardware, but I already have an iPhone, which is plenty expensive itself, and I don't want to pay for an entire second cell phone plan just to test my code. So my question is, is it possible to buy an unlocked Android phone and operate it entirely over wi-fi? If so, what features (besides the obvious, like making calls), will I be missing out on?
Yes, it is possible, but it might be tricky depending on the phone.
For instance, I bought a T-Mobile G1 (not the Android Dev Phone version) and had to have a SIM card in it. You can either borrow a friend's or you can do what I did, which was buy a prepaid-SIM card. It cost less than $40. If you have a friend's SIM card that has a data plan, then you can activate the phone. But if you don't want to have to have a SIM card in the phone anymore, you'll have to root the phone and install CyanogenMod on it.
Now if you bought a pre-paid SIM card, then you can activate the phone over wifi by following these steps (this is specific to the G1).
A G1 is probably the cheapest phone you can get if you're only wanting to use it as a hardware testing device. On ebay it is around the $100-150 range.
Why don't you download and install the Android SDK?
The SDK contains an emulator that can simulate pretty much every aspect of the device.
As others have said, a pay-as-you-go SIM is a good solution for any phone. In the UK at least, you can pick up a free SIM card easily. Vodafone or O2 will send you one if you ask them or you can probably get one at any number of local shops. Just be aware that some handsets are locked to particular networks, so you will either need to get a SIM from that network or pay to have your phone unlocked.
However, some phones will work fine without a SIM. I use an HTC Legend for development without a SIM and there is no problem. I just use Wi-Fi and, since it can't make calls, it is effectively just a pocket computer.
Prepaid is the way to go. You can purchase a T-Mobile prepaid phone for $20-$30, sometimes they even throw in a free $25 refill card. The phone comes with a free SIM card with $3 worth of air time (10 minutes). You need to refill your prepaid phone every 90 days for at least $10 each time, or if you want to avoid the hassle, you can refill $100 which is good for a year and achieve the gold status, thereafter any amount you refill will be good for up to a year. If you already own a T-Mobile phone, you might be able to just spend $7 on the prepaid site to purchase a T-Mobile Prepaid SIM Card Activation Kit.
There do exist phones that aren't even capable of accepting a SIM card. Phones meant to be used on Sprint and Verizon networks typically don't even have GSM capabilities. They'll start up just fine without one (obviously). For example, my HTC Evo doesn't have a SIM card slot -- this would be an expensive option though, I'm sure you could find cheaper phones.
The HTC Magic "Vodafone edition" at least requires a SIM card, even if it has been unlocked to use any operator. If there is no SIM present then a modal dialog (that cannot be closed) is shown that requests you to insert a SIM card.
Update: The SIM is only required to fill in the Google Account details (even if you do this over Wifi, as I did). Once the phone is "activated" in this way, you can run it SIM-free.
I was able to do quite a bit on my phone before the activation was completed using wifi. There are some things you might not be able to test, such as app behavior after/during a call interruption, however, for the most part, the functionality available using wifi mode is sufficient. You can test call interruption type of behaviors using the android emulator.
You may also want to note that many cell phone companies, including but not limited to att, have significantly cheaper rarely-advertised "data only" plans, should you discover you really do need to do testing using a real cell-phone network (eg: if you made a multi-media app, testing over wifi might perform differently than over the air). Pre-paid plans sometimes also include data-plan airtime as another option to consider, if needed.