Overview of Smart Device Unit Tests
Use smart device unit tests to test methods that are part of your smart device project. The term smart device unit test applies to any unit test that is created in a smart device test project. For more information, see Smart Device Test Projects.
Creating Unit Tests
When you create a unit test in a smart device test project, the test is different in the following ways:
The smart device unit test references the .NET Compact Framework and device Unit Test Framework instead of the full .NET Framework and Unit Test Framework. For more information, see Unit Testing Framework (Devices).
The smart device unit test runs on a device or emulator under the smart device host process instead of on a desktop computer under the default or Internet Information Services host process. For more information, see How to: Specify a Test Run Configuration.
Note
Smart device unit tests must run under the Smart Device host and cannot run under the Default or ASP.NET host. For more information, see How to: Specify a Test Run Configuration.
By running on a device or emulator, your tests have access to the same device specific APIs, such as Microsoft.WindowsMobile, as your smart device applications.
You can create a smart device unit test in two ways:
Generate it from code in your smart device project.
Add a new unit test to smart device test project from the Add New Test dialog box.
Both methods are described in How to: Create a Smart Device Unit Test.
Running Unit Tests
You run a smart device unit test the same way you run other types of tests. For more information, see How to: Run Selected Tests.
Visual Studio runs tests on the device selected in the active test run configuration and not on the device selected in the Device toolbar. For more information, see How to: Specify a Test Run Configuration.
- Also, when you run tests, Visual Studio does not automatically deploy and install the .NET Compact Framework or SQL Server Compact to the target device or emulator. Your emulator or device must have them installed before running a test. For more information, see How to: Install the .NET Compact Framework on a Device and How to: Install SQL Server Compact 3.5 on a Device.
See Also
Tasks
Walkthrough: Creating and Running a Smart Device Unit Test
How to: Debug while Running a Smart Device Unit Test