Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test Profile App Unit Test Code Coverage
# Tizen Native Application Unit Test With Code Coverage


> [!NOTE]
> [NOTE]
>
> Before you run the Unit Test and Code Coverage, make sure:
> - You have an Emulator or a connected target device running.
Expand Down
42 changes: 42 additions & 0 deletions docs/application/vstools/getting-started/web-app-unit-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Tizen Web Application Unit Test

> **[NOTE]**
>
> Before running the **Web Unit Test**, make sure:
> - You have an **Emulator** or a connected **target device** running.
> - If you don’t have a web application project to test, you can create one using the **Project Wizard** with a template or sample project.
> For more details, see [Web Application Development](../Tizen/web.md).

---

## Configuring a Web App for Web Test

### Step 1: Create a Tizen Web Unit Test
1. In **Visual Studio**, right-click on your **Web project name**.
2. Select **Create Tizen Web Unit Test**.
3. Choose the **.js** file where your test cases are written.
4. Select the test cases you want to include.
5. *(Optional)* Choose **Create Setup** or **Create Teardown** if needed.
6. Enter a name for the test file and click **OK**.

![Create Web Unit Test](media/create_web_unit_test.png)

![Web Unit Test Dialog](media/web_unit_test_dialog.png)
---

### Step 2: Modify the Generated Test File
- A folder named **`webunittest`** will be created in your project.
- Inside this folder, a file named **`tests/mainTests.js`** (or your chosen test file name) will be automatically generated.
- Modify this file to define or customize your test cases as needed.

![Run Web Unit Test](media/run_web_unit_test.png)
---

### Step 3: Run the Tizen Web Unit Test
1. Right-click again on your **Web project name**.
2. Select **Run Tizen Web Unit Test**.
3. The test will execute on your selected emulator or connected device.
4. Once complete, the test results will be displayed in the output window in a tree format. It shows the passed tests with a green icon and failed tests with a red icon. When you click on certain the test result, it will take you to the tastcase in the generated test file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be like this: Upon double click on the failed test case, the cursor will navigate to the line the test case failed


![Web Unit Test Result](media/web_unit_test_result.png)
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add functionality of double click on failure to get to failed line

43 changes: 38 additions & 5 deletions docs/application/vstools/tools/unit-test-with-code-coverage.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,43 @@
# Unit Test with Code Coverage

The Code Coverage is a profiling tool used to determine the coverage details of Tizen Native Applications. It helps you to understand the code quality of your application. The Code Coverage tool finds the parts of the code covered during the execution of the unit test cases. A program with high code coverage (measured in percentage) implies that most of the source code is covered during testing, and the source code has a lower chance of containing undetected software bugs.
**Code Coverage** is a profiling tool used to measure how much of your application's source code is executed while running unit tests. It helps evaluate **code quality** and identify untested parts of your codebase.

The code coverage tool in the Tizen Extension for Visual Studio is based on the `llvm-cov` tool. Using the Code Coverage tool, you can detect parts of code that are not covered by a unit test, and ensure that the uncovered code does not cause errors at runtime. The Code Coverage tool supports functional, statement, and branch coverage.
A higher coverage percentage indicates that most of your source code has been tested, which reduces the likelihood of undetected software bugs. By using **Unit Tests**, you can verify the correctness of your code, improve reliability, and maintain high software quality.

With a Unit Test, you can verify that your code works well, and increases its reliability. Tizen Studio Extension for VS provides the creating, building, and editing tools for unit tests, and a view for checking and analyzing the test results.
It uses the `gtest` framework to make and launch the test cases. To manage your test cases, you can use the test explorer view.
The **Tizen Studio Extension for Visual Studio** provides tools for:
- Creating, building, and editing unit tests
- Running and analyzing test results
- Measuring and visualizing code coverage

Get started with [Unit test code coverage information of native application on VS](../getting-started/test-profile-app-unit-test-code-coverage.md)
---

## Native Application

For **Native Applications**, the Code Coverage feature in the **Tizen Extension for Visual Studio** is powered by the **`llvm-cov`** tool.
It helps you:
- Detect code segments that are not covered by unit tests
- Ensure that uncovered code does not cause runtime issues
- Measure different types of coverage:
- **Functional coverage**
- **Statement coverage**
- **Branch coverage**

The extension uses the **Google Test (gtest)** framework to create and execute test cases.

> 📘 **Learn more:**
> Get started with [Unit Test With Code Coverage for Native Applications on Visual Studio](../getting-started/test-profile-app-unit-test-code-coverage.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the get started with like before

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation has changed to the right, check why?


---

## Web Application

For **Web Applications**, you can also create and run unit tests within the **Tizen Extension for Visual Studio**.
These tools allow you to:
- Write test cases for web projects
- Execute them on an emulator or target device
- View and analyze test results directly in Visual Studio

> 📘 **Learn more:**
> Get started with [Unit Test for Web Applications on Visual Studio](../getting-started/web-app-unit-test.md)

---