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:

  1. Go to the Swagger UI and locate the POST /api/plugin/codeStores endpoint.
  2. Fill in the JSON request body with the appropriate code store details and source code.
  3. Execute the request.
  4. 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:

  1. Go to the Swagger UI and locate the POST /api/plugin/codeStores/{id}/compile endpoint.
  2. Replace {id} in the URL with the id of the code store you created in Step 1.
  3. Execute the request.
  4. 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:

  1. Go to the Swagger UI and locate the GET /api/plugin/plugins endpoint.
  2. Execute the request.
  3. 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:

  1. Go to the Swagger UI and locate the GET /api/plugin/plugins/{id} endpoint.
  2. Replace {id} with the plugin's id from the previous step.
  3. 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:

  1. Go to the Swagger UI and locate the PUT /api/plugin/codeStores/{id} endpoint.
  2. Replace {id} with the id of the code store.
  3. Update the code or any other fields in the request body.
  4. 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:

  1. Go to the Swagger UI and locate the DELETE /api/plugin/plugins/{id} endpoint.
  2. Replace {id} with the id of the plugin you want to delete.
  3. 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:

  1. Go to the Swagger UI and locate the DELETE /api/plugin/codeStores/{id} endpoint.
  2. Replace {id} with the id of the code store you want to delete.
  3. Execute the request and verify that the code store has been deleted.

Complete Flow

  1. Create a Code Store (Step 1).
  2. Compile the Code Store into a Plugin (Step 2).
  3. Retrieve the Compiled Plugin (Steps 3 & 4).
  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!