Before we dive into the flow, let's discuss what a function unit test file is. A function unit test file is a file that contains test cases for functions within the user's content file. The content of the file can be functional requirements (spec), diagrams, or code (function logic).
Installation and execution steps:
Step 1: Add API key for ChatGPT
Open Visual Studio Code (VS Code).
Press "Ctrl+Shift+P" (Windows) or "Cmd+Shift+P" (Mac) to open the Command Palette.
Type "askGpt: Add API key for ChatGPT" and select the command from the displayed list.
Enter the API key for ChatGPT when prompted.
Step 2: Open the file to create a function unit test
Open the file you want to create a function unit test for.
Ensure that the file has the functions that need to be tested.
Select the content you want to make and highlight it.
Step 3: Run the "askGpt: Create function unit test for this file" command
Press "Ctrl+Shift+P" (Windows) or "Cmd+Shift+P" (Mac) to open the Command Palette.
Type "askGpt: Create function unit test for this file" and select the command from the displayed list.
Type the file type you want to execute.
Wait for the command to execute and queue the processing.
Congratulations! You have successfully created an automatic function unit test for your content file with the help of ChatGPT.