我建议不要使用实际的 SimpleDB 服务来对您自己的代码进行单元测试。您将测试您的代码 + SimpleDB 客户端 + 网络 + SimpleDB 本身。您需要的是模拟 SimpleDB 客户端来运行单元测试。这样,您只测试需要测试的代码。测试驱动的开发要求您不要测试数据库是否在您的代码的单元测试中工作。
如果您正在测试您自己的 SimpleDB 客户端代码,您可以使用模拟 SimpleDB 服务或类似M/DB的东西,它是您可以在本地运行的 SimpleDB 克隆。
But this brings up a larger issue because SimpleDB provides eventual-consistency and not read-your-writes consistency. Your code will absolutely need to be able to deal with the fact that a newly added item will not immediately be returned from a get or a query.
I have no reason to think that your code can't handle it. I'm just saying that as a general rule when you run into problems like these with tests, it hints at issues that need to be considered with the code being tested. You may find that you want either a general layer of caching between your app code and SimpleDB or you may want a session cache that can provide read-your-writes consistency.