1) Structure
vendor/
plugins/
yourplugin/
test/
helper.rb
your_test.rb
database.yml
schema.rb
init.rb
Rakefile
2) Rakefile
3) helper.rb
4) your_test.rb
5) schema.rb
6) Running tests
Go to your plugin root folder and run
$ rake test
To see full example, refer to http://github.com/balepc/ip_geolocation/
Here are some other useful links:
Rails plugin testing guide
Another guide