Our tests in the jstests/core/ directory tend to take one of the following two forms.
Tests drop the collection that they act as one of their first operations so that they may be re-run without having to clear the data directory. This poses an issue for the current implementation of the sharded_collections_jscore_passthrough suite because the test will proceed with the collection not being sharded after the collection has been dropped. We should consider overriding DBCollection.prototype.drop() (or the Mongo.prototype.runCommand() equivalent) in implicitly_shard_accessed_collections.js to gain coverage in running a variety of operations against a sharded collection.
Note: the value previously returned by the DB.prototype.getCollection() is cached, the DB.prototype.getCollection() function will not be called a second time.