Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test plan for TypeSpec extension #5552

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
92cb05d
Create create-typespec-project-test-plan.md
xiaohua899 Jan 8, 2025
4b50312
Update create-typespec-project-test-plan.md
xiaohua899 Jan 9, 2025
c5e3807
Add files via upload
xiaohua899 Jan 9, 2025
43bc7bf
Update generate-openapi3-from-typespec-test-plan.md
xiaohua899 Jan 9, 2025
7c1ffab
Update generate-client-code-from-typespec-test-plan.md
xiaohua899 Jan 13, 2025
aee5de9
Update generate-openapi3-from-typespec-test-plan.md
xiaohua899 Jan 13, 2025
4823f3d
Update generate-server-stub-from-typespec-test-plan.md
xiaohua899 Jan 13, 2025
8670bf6
Update import-typespec-from-openapi3-test-plan.md
xiaohua899 Jan 13, 2025
4530d27
Add files via upload
xiaohua899 Jan 14, 2025
a97df0d
Add files via upload
xiaohua899 Jan 15, 2025
25db294
Update test plan for TypeSpec extension
xiaohua899 Jan 16, 2025
090a634
Update test plan for TypeSpec extension
xiaohua899 Jan 16, 2025
34426cb
Merge branch 'patch-1' of https://github.com/xiaohua899/typespec into…
xiaohua899 Jan 16, 2025
a8b4d2a
Update create-typespec-project-test-plan.md
xiaohua899 Jan 16, 2025
89bedb6
Update typespec-extension-basic-features-test-plan.md
xiaohua899 Jan 16, 2025
f8fb563
Update generate-from-typespec-test-plan.md
xiaohua899 Jan 16, 2025
5a101d7
Update create-typespec-project-test-plan.md
xiaohua899 Jan 16, 2025
434a83d
Update create-typespec-project-test-plan.md
xiaohua899 Jan 16, 2025
7fefbca
Update generate-from-typespec-test-plan.md
xiaohua899 Jan 16, 2025
47b7123
Update typespec-extension-basic-features-test-plan.md
xiaohua899 Jan 16, 2025
879f81c
Update create-typespec-project-test-plan.md
xiaohua899 Jan 16, 2025
36482c6
Update create-typespec-project-test-plan.md
xiaohua899 Jan 16, 2025
492ea6f
Update generate-from-typespec-test-plan.md
xiaohua899 Jan 16, 2025
56fee8e
Update test plan for TypeSpec extension
xiaohua899 Jan 17, 2025
a3e5c94
Update test plan for TypeSpec extension
xiaohua899 Jan 17, 2025
e4bf3f6
Update create-typespec-project-test-plan.md
xiaohua899 Jan 17, 2025
0b02248
Update create-typespec-project-test-plan.md
xiaohua899 Jan 17, 2025
7d34012
Update create-typespec-project-test-plan.md
xiaohua899 Jan 17, 2025
d022215
Update test plan for TypeSpec extension
xiaohua899 Jan 22, 2025
8a0c301
Update import-typespec-from-openapi3-test-plan.md
xiaohua899 Jan 22, 2025
b35df44
Update test plan for TypeSpec extension
xiaohua899 Jan 23, 2025
c925bd2
Update test plan for TypeSpec extension
xiaohua899 Feb 8, 2025
6b1de13
Update test plan for TypeSpec extension
xiaohua899 Feb 11, 2025
2965d6c
Update test plan for TypeSpec extension
xiaohua899 Feb 12, 2025
ee28a79
Update test plan for TypeSpec extension
xiaohua899 Feb 14, 2025
8234e31
Update test plan for TypeSpec extension
xiaohua899 Feb 14, 2025
69649cd
Update import-typespec-from-openapi3-test-plan.md
xiaohua899 Feb 14, 2025
49596c8
Update test plan for TypeSpec extension
xiaohua899 Feb 18, 2025
9ff806d
Update test plan for TypeSpec extension
xiaohua899 Feb 19, 2025
5273902
Update test plan for TypeSpec extension
xiaohua899 Feb 20, 2025
b66084c
Update test plan for TypeSpec extension
xiaohua899 Feb 28, 2025
16fb6ca
Update test plan for TypeSpec extension
xiaohua899 Mar 7, 2025
b089101
Update test plan for TypeSpec extension
xiaohua899 Mar 14, 2025
a3bc3ac
Update test plan for TypeSpec extension
xiaohua899 Mar 14, 2025
8463a65
Update test plan for TypeSpec extension
xiaohua899 Mar 14, 2025
acd5ed1
Update generate to emit
v-xuto Mar 21, 2025
4ca0dec
Update emit pictures
v-xuto Mar 25, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- typespec-vscode
---

Added test plan for TypeSpec extension
28 changes: 28 additions & 0 deletions packages/typespec-vscode/test/manual/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contribute to TypeSpec Extension Manual Testing

This section describes manual testing of the TypeSpec extension.

## Test Environment

- Windows
- Linux

## Prerequisite

- Install [Node.js 20](https://nodejs.org/download/) or above. (Verify by running `node --version`)
- Install Npm 7 or above. (Verify by running `npm --version`)
- Install [TypeSpec Compiler CLI](https://typespec.io/docs/): `"npm install -g @typespec/compiler"`. (Verify by running `tsp --version`)

## Test Cases

There are four cases for TypeSpec extension manual testing. Click the corresponding links for specific test steps.

- [Create TypeSpec Project from A Template](https://github.com/microsoft/typespec/tree/main/packages/typespec-vscode/test/manual/create-typespec-project-test-case.md) - New TypeSpec projects can be created using a variety of templates for specific purposes.

- [Generate from TypeSpec](https://github.com/microsoft/typespec/tree/main/packages/typespec-vscode/test/manual/generate-from-typespec-test-case.md) - Different emitter types can be used to generate different codes to meet specific purposes.
- [Import TypeSpec from OpenAPI3](https://github.com/microsoft/typespec/tree/main/packages/typespec-vscode/test/manual/import-typespec-from-openapi3-test-case.md) - Using the OpenAPI3 TypeSpec emitter, you can import a TypeSpec file from a specified OpenAPI3 document.
- [TypeSpec Extension Basic Features](https://github.com/microsoft/typespec/tree/main/packages/typespec-vscode/test/manual/typespec-extension-basic-features-test-case.md) - The TypeSpec for VS Code extension provides TypeSpec language support for VS Code.

## Issue Report

If you find any problems during testing, please submit the [issue](https://github.com/microsoft/typespec/issues).
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# Create TypeSpec Project from A Template Test Scenario

New TypeSpec projects can be created using a variety of templates for specific purposes. TypeSpec supports the following non-branded templates:

- Generic REST API
- TypeSpec library
- TypeSpec emitter

Selecting a template involves:

- Installing required libraries
- Initializing essential project files with a specified folder structure
- Configuring output settings for a designated emission purpose

## Test Environment

- OS : Windows or Linux
- Template : Generic REST API, TypeSpec library, TypeSpec emitter ...

> Note: The extension should support all test cases in VS Code for Windows and Linux.

## Prerequisites

Install TypeSpec Compiler before starting to write TypeSpec.

- [Node.js 20+](https://nodejs.org/download/)
- Npm 7+
- [Install TypeSpec Compiler CLI](https://typespec.io/docs/): `"npm install -g @typespec/compiler"`

## Test Cases

1. [Create TypeSpec project related to non-branded templates](#test-case-1-create-typespec-project-related-to-non-branded-templates)
2. [Create TypeSpec project related to Azure Data/Mgmt Plane](#test-case-2-create-typespec-project-related-to-azure-datamgmt-plane)

## Test Steps

### Test Case 1: Create TypeSpec project related to non-branded templates

#### Step 1: Install the typespec extension.

_Option 1_. Install using .vsix file:
Click `Extension` -> `…` -> `Install form VSIX...`. Choose the `.vsix` file you want to install locally.

![alt text](./images/InstallTypespec_VSIX.png)

_Option 2_. Install typespec with vscode extension marketplace:
`Extension` -> input `TypeSpec` -> `Install`

![alt text](./images/InstallTypespec_ExtensionMarketplaceTest01.png)

#### Step 2: Trigger Create TypeSpec Project

_Option 1_. Clicking "Create TypeSpec Project" button/link in the "No Folder Opened" View of Explore.

![alt text](./images/TriggerCreateTypeSpecProject_NoFolderOpened.png)

_Option 2_. Typing `>TypeSpec: Create TypeSpec Project` in the _Command Palette_.

![alt text](./images/TriggerCreateTypeSpecProject_CommandPalette.png)

#### Step 3. Select a folder as the root folder for the new TypeSpec project.

Click the `Create TypeSpec Project` command, and a folder selection interface will appear. Select a folder.

- Select a non-empty folder. _(Single choice)_ `Y/N`

**Validate:** Will it appear: `The folder selected is not empty. Are you sure you want to initialize a new project here?`

![alt text](./images/CreateTypeSpecProject_VerifyFolderIsEmpty.png)

- Select a empty folder.
If the folder is empty, skip the query and go to the next step.

#### Step 4. After successfully installing TypeSpec Compiler, will go through the questions of `tsp init`.

1. Select a template _(Single choice)_.

**Validate:** There should be a prompt "Please select a template", and should see four options: `Generic REST API`, `TypeSpec library`, `TypeSpec emitter`.

![alt text](./images/CreateTypeSpecProject_SelectTemplate.png)

2. Input project name - _(Text input)_ by default, it is the project root folder name.

![alt text](./images/CreateTypeSpecProject_InputProjectName.png)

3. Select emitters. _(Multiple choice)_

> Note: `Select emitters` is required only when you select `Generic REST API`. This step will not appear if you select other templates.

**Validate:** Will it appear: `Select emitters?` and emitter type.

![alt text](./images/CreateTypeSpecProject_GenericRESTAPI_SelectEmitters.png)

4. Click `OK` and the project will be created, the folder structure will be set up, dependencies will be installed, and tspconfig.yaml will be updated.

**Validate:** Verify that the project was created correctly and the dependencies are installed.

- Install Dependencies

![alt text](./images/CreateTypeSpecProject_InstallDependencies.png)

- Folder structure

- For `Generic REST API`, the folder structure.

![alt text](./images/CreateTypeSpecProject_CreateSucceedFolder_GenericRESTAPI.png)

- For `TypeSpec library`, the folder structure.

![alt text](./images/CreateTypeSpecProject_CreateSucceedFolder_TypeSpecLibrary.png)

- For `TypeSpec emitter`, the folder structure.

![alt text](./images/CreateTypeSpecProject_CreateSucceedFolder_TypeSpecEmitter.png)

#### Step 5. Choose how to open the project.

After the project is created successfully, the user can choose `Add to workspace` or `Open in New Window`.

![alt text](./images/CreateTypeSpecProject_OpenProject.png)

### Test Case 2: Create TypeSpec project related to Azure Data/Mgmt Plane

Configure more initialization templates.

#### Step 1 are the same as [Test Case 1](#step-1-install-the-typespec-extension).

#### Step 2. Config settings "initTemplatesUrls".

1. Open settings.

![alt text](./images/CreateTypeSpecProject_testcase2_opensettings.png)

2. Add configuration as below and save.

```JSON
"typespec.initTemplatesUrls": [
{
"name": "Azure",
"url": "https://aka.ms/typespec/azure-init"
}
]
```

#### Step 3: Trigger Create TypeSpec Project

See [step 2 of test case 1](#step-2-trigger-create-typespec-project) for details.

#### Step 4: Select a folder as the root folder for the new TypeSpec project.

See [step 3 of test case 1](#step-3-select-a-folder-as-the-root-folder-for-the-new-typespec-project) for details.

#### Step 5: Create a template.

1. Select a template _(Single choice)_.

**Validate:** There should be a prompt "Select a template", and should see more options.

![alt text](./images/CreateTypeSpecProject_SelectMoreTemplate.png)

2. Input project name - _(Text input)_ by default, it is the project root folder name.

![alt text](./images/CreateTypeSpecProject_InputProjectName.png)

3. Input your `service namespace` or `ARM Resource Provider Name` - _(Text input)_ requires Pascal format.

- For Data Plane API - Input service namespace.

![alt text](./images/CreateTypeSpecProject_InputServiceNamespace.png)

- For ARM API - Input ARM Resource Provider Name.

![alt text](./images/CreateTypeSpecProject_InputARMResourceProviderName.png)

4. Press "Enter" and the project will be created.

**Validate:** Verify that the project was created correctly.

![alt text](./images/CreateTypeSpecProject_TestCase_2_CreateSucceedFolder.png)

> Note: The name of the created file will change depending on the template used, it may be client.tsp, or employee.tsp.

#### Step 6. Choose how to open the project.

See [step 5](#step-5-choose-how-to-open-the-project) of test case 1 for details.

## Issue Report

When an error is detected, it's necessary to document the findings by using the following form:

| No | Title | Template | Issue Description | Repro Steps | Expected Results | Actual Results | Comments |
| --- | :---------------------------------: | :--------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------: | :--------: |
| 1 | e.g. Create typespec project failed | Generic REST API / TypeSpec library / TypeSpec emitter | Create project feature is not supported by the current TypeSpec Compiler (ver <= 0.63.0). Please upgrade TypeSpec Compiler and try again. | 1. Typing `>TypeSpec: Create TypeSpec Project` in the _Command Palette_. <br> 2. Select an empty folder as the root folder for the new TypeSpec project. <br> 3. Select a template. | There should be a prompt "Select a template", and should see three options: `Generic REST API`, `TypeSpec Library (With TypeScript)`, `TypeSpec Emitter (With TypeScript)`. | Create project feature is not supported by the current TypeSpec Compiler (ver <= 0.63.0). Please upgrade TypeSpec Compiler and try again. | Issue link |

## Test Results Summary

The test results will be presented in the following form:

| NO | Test Cases | Platform | Template | Result | Issues | Comments |
| --- | :-------------------------------------: | :-----------: | :---------------------------------------------------------: | :----: | :----: | :------: |
| 1 | Create TypeSpec Project from A Template | Windows/Linux | Generic REST API | | | |
| 2 | Create TypeSpec Project from A Template | Windows/Linux | TypeSpec library | | | |
| 3 | Create TypeSpec Project from A Template | Windows/Linux | TypeSpec emitter | | | |
| 4 | Create TypeSpec Project from A Template | Windows/Linux | (rest-api-spec repo) Azure Data Plane Service Project | | | |
| 5 | Create TypeSpec Project from A Template | Windows/Linux | (rest-api-spec repo) Azure Resource Manager Service Project | | | |
| 6 | Create TypeSpec Project from A Template | Windows/Linux | (stand alone) Azure Data Plane Service Project | | | |
| 7 | Create TypeSpec Project from A Template | Windows/Linux | (stand alone) Azure Resource Manager Service Project | | | |
Loading
Loading