How to write a simple test case for users by using drupal_mail() function? I have written a custom module for sending email to registered users.
And I want simple test case for that users email module.

In this module I am taking a user from database and selected users preferred language and sending emails.

Same as I want .test file, I don't know how to write .test file for this module.

I am using the SimpleTest module, version 7.x-2.x (in Drupal 7).
Finding documentation about the SimpleTest module has never been obvious (also because using the Read Documentation link on the module's project page causes a 404-error ...).

Here are some pointers I've found so far:


The article about A Drupal Module Developer's Guide to SimpleTest (not sure right now how accurate it still is, but at least it outlines the main steps). Note this part in it: "... make a simple list of things that your module does. This list will translate directly to SimpleTest tests.".
The article about "How to: Write Automated Tests for Drupal", in one of it's comment near the bottom it says:


  As of now, it's the same API for the Drupal 7 core module and the Drupal 6 contributed module (http://drupal.org/project/simpletest), so this tutorial should work for both.

The SimpleTest Example that comes with the Examples module, and also includes a .test file (something you refer to in your question also). In other words: the best available documentation on this is "read the source".


Be aware: 


Make sure to you take into account what's written in API.txt, i.e.:


  ... Provides a reference of the API changes between SimpleTest 7.x-1.x included with Drupal 7 core and SimpleTest 7.x-2.x.
  
  Modules that provided 2.x compatible tests are required to add the following attribute to their info file: testing_api = 2.x.


So SimpleTest requires a version number in the .info file, which you specify by adding that testing_api = 2.x in your .info file.
This module has Maintenance status: Unknown, Development status: Unknown


Note: As of D7, there is the PHP Unit Testing Framework module (namespace = testing). Refer to the Community Documentation about Testing (D7 and D8) / SimpleTest (D6) for quite some more details on all this.