Manual Test Procedure for PluginController using Swagger - wwestlake/Labyrinth GitHub Wiki
Manual Test Procedure for PluginController Using Swagger
This guide follows a typical flow: creating a code store, compiling it into a plugin, and retrieving the compiled plugin. You can follow this procedure step by step using Swagger UI.
Endpoints
1. Create a Code Store
Step: Create a new code store by submitting code files that represent the source code for a plugin.
POST /api/plugin/codeStores
F# Sample JSON Body:
{
"name": "Sample Plugin Code Store",
"description": "This is the source code for Sample Plugin.",
"userId": "admin",
"language": "FSharp",
"codeFiles": [
{
"name": "Main.fs",
"code": "module Main\n\nlet x = 42\nprintfn \"Hello, World!\";"
}
]
}
C# Sample JSON Body:
{
"name": "Sample Plugin Code Store",
"description": "This is the source code for Sample Plugin.",
"userId": "admin",
"language": "CSharp",
"codeFiles": [
{
"name": "Main.cs",
"code": "using System; public class Program { public static void Main() { int x = 42; Console.WriteLine(\"Hello, World!\"); } }"
}
]
}
Procedure:
- Go to the Swagger UI and locate the
POST /api/plugin/codeStores
endpoint. - Fill in the JSON request body with the appropriate code store details and source code.
- Execute the request.
- Confirm the creation by noting the returned
id
in the response.
2. Compile the Code Store
Step: Compile the code store created in the previous step into a plugin.
POST /api/plugin/codeStores/{id}/compile
Procedure:
- Go to the Swagger UI and locate the
POST /api/plugin/codeStores/{id}/compile
endpoint. - Replace
{id}
in the URL with theid
of the code store you created in Step 1. - Execute the request.
- Check for errors in the response. If the compilation is successful, the plugin will be created, and the response will include the plugin information.
3. Retrieve All Plugins
Step: Retrieve a list of all compiled plugins.
GET /api/plugin/plugins
Procedure:
- Go to the Swagger UI and locate the
GET /api/plugin/plugins
endpoint. - Execute the request.
- Review the list of compiled plugins and confirm that the newly compiled plugin from Step 2 is listed.
4. Retrieve a Plugin by ID
Step: Retrieve a specific compiled plugin by its id
.
GET /api/plugin/plugins/{id}
Procedure:
- Go to the Swagger UI and locate the
GET /api/plugin/plugins/{id}
endpoint. - Replace
{id}
with the plugin'sid
from the previous step. - Execute the request and review the details of the plugin.
5. Update a Code Store
Step: Modify the existing code in the code store.
PUT /api/plugin/codeStores/{id}
F# Sample JSON Body:
{
"name": "Sample Plugin Code Store",
"description": "This is the source code for Sample Plugin.",
"userId": "admin",
"language": "FSharp",
"codeFiles": [
{
"name": "Main.fs",
"code": "module Main\n\nlet x = 42\nprintfn \"Hello, World!\";"
}
]
}
C# Sample JSON Body:
{
"name": "Sample Plugin Code Store",
"description": "This is the source code for Sample Plugin.",
"userId": "admin",
"language": "CSharp",
"codeFiles": [
{
"name": "Main.cs",
"code": "public class Program { public static void Main() { int x = 42; Console.WriteLine(\"Hello, World!\"); } }"
}
]
}
Procedure:
- Go to the Swagger UI and locate the
PUT /api/plugin/codeStores/{id}
endpoint. - Replace
{id}
with theid
of the code store. - Update the code or any other fields in the request body.
- Execute the request and verify that the code store has been updated.
6. Delete a Plugin
Step: Delete a plugin by its id
.
DELETE /api/plugin/plugins/{id}
Procedure:
- Go to the Swagger UI and locate the
DELETE /api/plugin/plugins/{id}
endpoint. - Replace
{id}
with theid
of the plugin you want to delete. - Execute the request and verify that the plugin has been deleted.
7. Delete a Code Store
Step: Delete a code store by its id
.
DELETE /api/plugin/codeStores/{id}
Procedure:
- Go to the Swagger UI and locate the
DELETE /api/plugin/codeStores/{id}
endpoint. - Replace
{id}
with theid
of the code store you want to delete. - Execute the request and verify that the code store has been deleted.
Complete Flow
- Create a Code Store (Step 1).
- Compile the Code Store into a Plugin (Step 2).
- Retrieve the Compiled Plugin (Steps 3 & 4).
- Update or Delete the Code Store or Plugin as needed (Steps 5-7).
This flow allows you to test the plugin management and code compilation features of the PluginController
in a logical order.
Let me know if you'd like more details or additional steps in this procedure!