Take a look at the mlaunch
tool by Thomas Rueckstiess. Once you download different versions of the binaries from the download page as suggested in the comments (and put them somewhere that makes sense on your system) you can then use mlaunch
to start identical configurations for testing by specifying a different binary path (and data directory, port etc. if running multiple in parallel).
If extra tools are not what you are looking for you can achieve similar results using the internal test commands provided by MongoDB, though please note that these commands are currently considered internal for testing purposes, are not documented, and can be changed (or stop working) at any time (I have tested recently on 2.4 and 2.6 versions and can confirm that they work for those versions as of writing this answer).
For example, if you want to set up a 2 shard cluster, where each shard was a replica set, you could do the following:
// start a shell from the command line, do not connect to a database
./mongo --nodb
// using that shell start a new 2 shard cluster (this will take a while)
cluster = new ShardingTest({shards : 2, rs : true});
// once that is finished, start a new shell and connect to the mongos (leave previous shell running to monitor logs etc.)
./mongo --port 30999
MongoDB shell version: 2.6.0
connecting to: 127.0.0.1:30999/test
mongos>
Repeat and re-use as needed with whatever version you wish, to shut it down, simply Ctrl-C
the original shell (where things are hopefully still logging).
Similarly, if you just want a replica set to test with:
// start a shell from the command line, do not connect to a database
./mongo --nodb
var rst = new ReplSetTest({ name: 'testSet', nodes: 3});
rst.startSet();
// this next line can be hard to type with logging scrolling by, so copy & paste is your friend if you have trouble
rst.initiate();
// start a new shell and connect to the set
./mongo --port 31000
MongoDB shell version: 2.4.9
connecting to: 127.0.0.1:31000/test
testSet:PRIMARY>