uid |
---|
Uno.Authoring.Tests |
This tutorial will walk through how to create an Uno application with tests.
Note
Make sure to setup your environment first by following our instructions.
The generated solution will contain:
- MyProjectName - for application logic, and other constructs like view models and services, as well as the pages, controls, and other views that make up the UI of the application.
- MyProjectName.Tests and MyProjectName.UI.Tests - for writing unit and UI tests respectively.
-
Select a target from the drop-down as pictured below
-
Click the "play" button, or press F5 to start debugging. The project will be compiled and deployed based on the target platform. For more detailed instructions specific to each platform, refer to the Debug the App documentation.
-
Right click the project inside Tests\MyProjectName.Tests to open the context menu
-
Select Run Tests
The application will be compiled and the test cases will run.
Tip
If the 'Run Tests' menu item doesn't exist, you need to Rebuild the solution to get Visual Studio to detect the available tests.
-
As demonstrated on step 3, select the WebAssembly target from the drop-down.
-
Press Ctrl + F5 to start the WASM project without debugging.
-
Once the application is compiled, it will launch inside your default browser. Take note of the URL which should look something like this: https://localhost:5000/Main
-
Find the project Tests\MyProjectName.UI.Tests and locate the Constants.cs file.
-
Open Constants.cs and update the WebAssemblyDefaultUri constant.
It should appear similar to this:
public readonly static string WebAssemblyDefaultUri = "https://localhost:5000/";
-
Go back to the project Tests\MyProjectName.UI.Tests and right click. Then, Run Tests.