### Start VectorCAST Data Server Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/README.md Start the VectorCAST data server using the provided Python script. Ensure the VECTORCAST_DIR environment variable is set to your VectorCAST installation path. ```bash vpython c:\rds\vector-vscode-vcast\python\vcastDataServer.py ``` -------------------------------- ### C++ Coded Test Example with vUnit and vmock Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Demonstrates writing C++ coded tests using the vUnit framework and mocking functions with vmock. Includes setup for mock sessions and assertions. ```cpp // manager_tests.cpp - Coded test file #include // Mock function generated via "// vmock" auto-completion int vmock_database_get_price(::vunit::CallCtx<> vunit_ctx, int item_id) { // Return a fixed price for testing return 1000; // Enable Stub: vmock_session.mock(&get_price).assign(&vmock_database_get_price); // Disable Stub: vmock_session.mock(&get_price).assign(nullptr); } VTEST(ManagerTests, AddIncludedDessertSteakCombo) { // Setup mock session auto vmock_session = ::vunit::MockSession(); // Create test order struct order_type test_order; test_order.Entree = STEAK; test_order.Salad = CAESAR; test_order.Beverage = MIXED_DRINK; test_order.Dessert = NO_DESSERT; // Execute function under test Add_Included_Dessert(&test_order); // Verify expected dessert VASSERT_EQ(test_order.Dessert, PIE); } VTEST(ManagerTests, AddIncludedDessertLobsterCombo) { struct order_type test_order; test_order.Entree = LOBSTER; test_order.Salad = GREEN; test_order.Beverage = WINE; test_order.Dessert = NO_DESSERT; Add_Included_Dessert(&test_order); VASSERT_EQ(test_order.Dessert, CAKE); } VTEST(ManagerTests, AddIncludedDessertNoMatch) { struct order_type test_order; test_order.Entree = CHICKEN; test_order.Salad = CAESAR; test_order.Beverage = SODA; test_order.Dessert = NO_DESSERT; Add_Included_Dessert(&test_order); VASSERT_EQ(test_order.Dessert, NO_DESSERT); } ``` -------------------------------- ### Install npm Dependencies Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Install all necessary Node.js dependencies for the end-to-end tests by running `npm install` within the `internal/e2e` directory. ```bash npm install ``` -------------------------------- ### Install vsce Globally Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/README.md Install the 'vsce' tool globally, which is required for packaging the VS Code extension. ```bash npm install -g @vscode/vsce@^2.15.0 ``` -------------------------------- ### Add Coded Test Include Path to c_cpp_properties.json Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/README.md Example configuration for c_cpp_properties.json to include the vUnit header path for IntelliSense in coded test files. Ensure the path matches your VectorCAST installation. ```json { "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "C:/VectorCAST/vunit/include" ], ... } ] } ``` -------------------------------- ### VectorCAST Test Script Example Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt An example of a VectorCAST test script (`.tst` file) utilizing Language Sensitive Editing (LSE) features. It defines test cases for the `Add_Included_Dessert` function, including setup values, expected outcomes, and requirement keys. ```tst -- Test Case Script for Add_Included_Dessert -- -- Environment: MANAGER -- Unit: manager -- Function: Add_Included_Dessert -- -- Type 'vcast-test' to get the framework of a new test inserted -- Then use the LSE features of the extension to fill-in values TEST.SCRIPT_FEATURE:MIXED_CASE_NAMES TEST.SCRIPT_FEATURE:MULTIPLE_UUT_SUPPORT TEST.UNIT:manager TEST.SUBPROGRAM:Add_Included_Dessert TEST.NEW TEST.NAME:test-steak-caesar-mixed-drink-gets-pie TEST.NOTES: Verify that an order with steak, caesar salad, and mixed drink receives pie as the included dessert. TEST.END_NOTES: TEST.REQUIREMENT_KEY:FR27 TEST.VALUE:manager.Add_Included_Dessert.Order.Entree:STEAK TEST.VALUE:manager.Add_Included_Dessert.Order.Salad:CAESAR TEST.VALUE:manager.Add_Included_Dessert.Order.Beverage:MIXED_DRINK TEST.EXPECTED:manager.Add_Included_Dessert.Order.Dessert:PIE TEST.END TEST.UNIT:manager TEST.SUBPROGRAM:Add_Included_Dessert TEST.NEW TEST.NAME:test-lobster-green-wine-gets-cake TEST.NOTES: Verify that an order with lobster, green salad, and wine receives cake as the included dessert. TEST.END_NOTES: TEST.REQUIREMENT_KEY:FR27 TEST.VALUE:manager.Add_Included_Dessert.Order.Entree:LOBSTER TEST.VALUE:manager.Add_Included_Dessert.Order.Salad:GREEN TEST.VALUE:manager.Add_Included_Dessert.Order.Beverage:WINE TEST.EXPECTED:manager.Add_Included_Dessert.Order.Dessert:CAKE TEST.END ``` -------------------------------- ### VectorCAST Data Server Initialization and State Management (TypeScript) Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt TypeScript code for initializing and managing the VectorCAST Data Server within an extension. Includes functions for starting, stopping, and toggling the server state. ```typescript // Data server initialization in the extension import { initializeVcastDataServer, serverProcessController, serverStateType, toggleDataServerState } from "./vcastDataServer"; // Initialize server on extension activation await initializeVcastDataServer(); // Server state management await serverProcessController(serverStateType.running); // Start server await serverProcessController(serverStateType.stopped); // Stop server // Toggle server state via status bar click await toggleDataServerState(); ``` -------------------------------- ### Create VectorCAST Environment Script Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt An example of an environment script generated by the VectorCAST Test Explorer extension. This script defines the test environment settings, including coverage type, stubbing behavior, and search paths. ```bash # Environment script generated by extension (MANAGER.env) ENVIRO.NEW ENVIRO.NAME: MANAGER ENVIRO.COVERAGE_TYPE: Statement+Branch ENVIRO.WHITE_BOX: YES ENVIRO.STUB: ALL_BY_PROTOTYPE ENVIRO.SEARCH_LIST: /path/to/source ENVIRO.STUB_BY_FUNCTION: manager ENVIRO.END ``` -------------------------------- ### Run VectorCAST Data Server Client Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/README.md Run the client script to interact with the VectorCAST data server. This command should be executed after the server has been started. ```bash vpython c:\rds\vector-vscode-vcast\tests\clicast-server\client.py ``` -------------------------------- ### Check GCC Installation Path Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Verify if the GCC compiler is accessible in the system's PATH environment variable by running `which gcc` in the command prompt. ```bash which gcc ``` -------------------------------- ### vTestInterface Python API Command Line Usage Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Examples of using the vTestInterface Python script via the command line to interact with VectorCAST environments. Covers getting environment data, executing tests, and generating reports. ```python # Example: Using vTestInterface modes via command line # Get environment data vpython vTestInterface.py --mode getEnviroData --path /path/to/MANAGER # Execute a specific test vpython vTestInterface.py --mode executeTest --path /path/to/MANAGER \ --test "vcast:MANAGER|manager|Add_Included_Dessert|test-steak-caesar" # Generate test execution report vpython vTestInterface.py --mode report --path /path/to/MANAGER \ --test "vcast:MANAGER|manager|Add_Included_Dessert|test-steak-caesar" # Get MCDC coverage report for a specific line vpython vTestInterface.py --mode mcdcReport --path /path/to/MANAGER \ --options '{"unit": "manager", "line": 15}' # Get lines with MCDC coverage vpython vTestInterface.py --mode mcdcLines --path /path/to/MANAGER # Parse coded test file vpython vTestInterface.py --mode parseCBT --path /path/to/MANAGER \ --options '{"codedTestFile": "/path/to/manager_tests.cpp"}' ``` -------------------------------- ### Check VectorCAST Installation Path Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Verify if the VectorCAST `clicast` executable is accessible in the system's PATH environment variable by running `which clicast` in the shell. ```bash which clicast ``` -------------------------------- ### Configure VectorCAST Test Explorer Settings Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Configure the VectorCAST Test Explorer extension by specifying installation paths, test directories, coverage options, and enabling AI features like Reqs2X. This JSON configuration is typically placed in `.vscode/settings.json`. ```json // .vscode/settings.json { "vectorcastTestExplorer.vectorcastInstallationLocation": "/opt/vectorcast/2024", "vectorcastTestExplorer.unitTestLocation": "./unitTests", "vectorcastTestExplorer.configurationLocation": "/path/to/CCAST_.CFG", "vectorcastTestExplorer.showReportOnExecute": true, "vectorcastTestExplorer.decorateExplorer": true, "vectorcastTestExplorer.verboseLogging": false, "vectorcastTestExplorer.useDataServer": true, "vectorcastTestExplorer.build.coverageKind": "Statement+Branch", "vectorcastTestExplorer.build.enableCodedTesting": true, "vectorcastTestExplorer.reqs2x.enableReqs2xFeature": true, "vectorcastTestExplorer.reqs2x.provider": "openai", "vectorcastTestExplorer.reqs2x.openai.apiKey": "your-api-key", "vectorcastTestExplorer.reqs2x.openai.modelName": "gpt-4o" } ``` -------------------------------- ### VectorCAST Data Server Communication Protocol (Python) Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Defines the JSON-based request and response formats for communicating with the VectorCAST Data Server via a TCP socket. Shows example structures for actions and data exchange. ```python # Server communication protocol (TCP socket) # Request format: JSON with action and parameters { "action": "getEnviroData", "enviroPath": "/path/to/MANAGER", "options": {} } # Response format: JSON with status and data { "status": "success", "data": { "enviroName": "MANAGER", "unitData": [...], "testData": [...] } } ``` -------------------------------- ### Configure C/C++ IntelliSense for Coded Tests Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Use this JSON configuration in `.vscode/c_cpp_properties.json` to set up IntelliSense for C/C++ coded tests with VectorCAST. It includes paths for both Linux and Windows environments, specifying compiler paths, C/C++ standards, and IntelliSense modes. ```json // .vscode/c_cpp_properties.json { "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**", "${env:VECTORCAST_DIR}/vunit/include" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "linux-gcc-x64" }, { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "C:/VectorCAST/vunit/include" ], "defines": ["_DEBUG", "UNICODE", "_UNICODE"], "compilerPath": "C:/MinGW/bin/gcc.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 } ``` -------------------------------- ### Run Vitest Unit Tests Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/README.md Execute the vitest-based unit tests by running this command in the repository root. Coverage information will be available at `coverage/index.html`. ```bash npm test ``` -------------------------------- ### Build the VS Code Extension Package Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Create the VSIX package for the VectorCAST extension, along with `extension.js` and `server.js`, by running `npm run package` in the repository's root directory. ```bash npm run package ``` -------------------------------- ### Configure VS Code Debugger for VectorCAST Harness Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Sets up the `.vscode/launch.json` file to enable debugging of VectorCAST test harnesses within VS Code. Ensure the `type` is set to `cppdbg` and paths are correctly configured. ```json // .vscode/launch.json { "version": "0.2.0", "configurations": [ { "name": "VectorCAST Harness Debug", "type": "cppdbg", "request": "launch", "program": "${command:vectorcastTestExplorer.debugProgramPath}", "args": [], "stopAtEntry": false, "cwd": "${command:vectorcastTestExplorer.debugEnviroPath}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] } ``` -------------------------------- ### Run WebdriverIO Tests Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Execute WebdriverIO tests using the command line. This command specifies the configuration file and the specific test spec file to run. ```bash npx wdio run test/wdio.conf.ts --spec ./test/specs/vcast.test.ts ``` -------------------------------- ### Generate Tests from Requirements Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Use this option to automatically generate tests based on defined requirements. Ensure the VectorCAST environment is set up correctly. ```text VectorCAST -> Generate Tests from Requirements ``` -------------------------------- ### Define Mock for Function using vmock Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/README.md Use '// vmock ' followed by function name to trigger IntelliSense for creating function stubs. The extension generates the stub declaration and a usage hint for VTEST. ```cpp int foo (int param) { return param; } ``` ```cpp // vmock foo foo int vmock_foo_foo(::vunit::CallCtx<> vunit_ctx, int param) { // Enable Stub: vmock_session.mock (&foo).assign (&vmock_foo_foo); // Disable Stub: vmock_session.mock (&foo).assign (nullptr); } ``` -------------------------------- ### Re-build Environment Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Rebuild the VectorCAST environment after adapting the code to match new requirements. This step is crucial for the updated code to be recognized and tested correctly. ```text VectorCAST -> Re-build environment ``` -------------------------------- ### C Source File for Testing Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt A C source file containing the function `Add_Included_Dessert` which is intended to be tested using VectorCAST. This serves as the unit under test. ```c // manager.c - Source file to be tested #include "ctypes.h" void Add_Included_Dessert(struct order_type *Order) { if (Order->Entree == STEAK && Order->Salad == CAESAR && Order->Beverage == MIXED_DRINK) { Order->Dessert = PIE; } else if (Order->Entree == LOBSTER && Order->Salad == GREEN && Order->Beverage == WINE) { Order->Dessert = CAKE; } else { Order->Dessert = NO_DESSERT; } } ``` -------------------------------- ### VectorCAST Manage Project Integration Commands Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Provides TypeScript functions for interacting with VectorCAST Manage projects, including building environments, executing incremental builds, and managing test suites. ```typescript // Manage project commands import { buildProjectEnvironment, buildExecuteIncremental, createTestsuiteInCompiler, addCompilerToProject, importEnvToTestsuite, deleteEnvironmentFromProject } from "./manage/manageSrc/manageCommands"; // Build a specific environment in a Manage project await buildProjectEnvironment( "/path/to/project.vcm", "GNU_Native/TestSuite1/MANAGER", "/path/to/MANAGER" ); // Incremental build and execute await buildExecuteIncremental( "/path/to/project.vcm", "GNU_Native/TestSuite1", ["/path/to/MANAGER", "/path/to/DATABASE"], nodeId ); // Create a new test suite await createTestsuiteInCompiler( "/path/to/project", "GNU_Native", "RegressionTests" ); // Import environment to test suite await importEnvToTestsuite( "/path/to/project.vcm", "GNU_Native/TestSuite1", "/path/to/MANAGER.env" ); ``` -------------------------------- ### Enable ATG Features for vcast24 Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md To test ATG features specifically available in VectorCAST 24, set the `ENABLE_ATG_FEATURE` environment variable to "TRUE". ```bash ENABLE_ATG_FEATURE=TRUE ``` -------------------------------- ### Create VTEST with Mocked Function Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/README.md Utilize the generated mock function and VTEST macro to assert expected behavior. The 'vmock_session.mock' line assigns the mock function, and 'VASSERT_EQ' checks the result. ```cpp VTEST(fooTests, simpleTest) { auto vmock_session = ::vunit::MockSession(); vmock_session.mock (&foo).assign (&vmock_foo_foo); VASSERT_EQ (foo(1), 100); } ``` -------------------------------- ### Populate Requirements Gateway Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Update the requirements gateway with changes made to the requirements file. This ensures that subsequent test generation reflects the latest requirement specifications. ```text VectorCAST -> Populate RGW from Requirements ``` -------------------------------- ### Edit Test Script Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Open a generated test script to review requirement traceability and test case descriptions. This helps in understanding what specific behavior each test validates. ```text VectorCAST -> Edit Test Script ``` -------------------------------- ### Run Specific Test Group Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md To execute a single test group, set the `RUN_BY_GROUP` environment variable to "True" and specify the desired group name with `RUN_GROUP_NAME`. ```bash RUN_BY_GROUP: "True" RUN_GROUP_NAME: ``` -------------------------------- ### Retrieve Code Coverage Data Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Fetches and displays statement, branch, and MC/DC coverage data for a specified file. Ensure the vcastTestInterface module is correctly imported. ```typescript // Coverage data interface interface coverageDataType { crc32Checksum: number; // Source file checksum for validation covered: number[]; // Line numbers with coverage uncovered: number[]; // Line numbers without coverage partiallyCovered: number[]; // Lines with partial coverage (branches) } // Get coverage data for a specific file import { getCoverageDataForFile } from "./vcastTestInterface"; const filePath = "/path/to/manager.c"; const coverageData = getCoverageDataForFile(filePath); if (coverageData.hasCoverageData) { console.log(`Covered lines: ${coverageData.covered.join(', ')}`); console.log(`Uncovered lines: ${coverageData.uncovered.join(', ')}`); console.log(`Partially covered: ${coverageData.partiallyCovered.join(', ')}`); } else { console.log(`Status: ${coverageData.statusString}`); } ``` ```typescript // Toggle coverage display import { toggleCoverageAction, updateDisplayedCoverage } from "./coverage"; await toggleCoverageAction(); // ctrl-shift-c shortcut ``` -------------------------------- ### Configure Reqs2X AI Test Generation Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Enables AI-powered requirements and test case generation. Configure settings in `settings.json` with your Azure OpenAI details and desired generation options. ```json // Reqs2X configuration in settings.json { "vectorcastTestExplorer.reqs2x.enableReqs2xFeature": true, "vectorcastTestExplorer.reqs2x.provider": "azure_openai", "vectorcastTestExplorer.reqs2x.azure.baseUrl": "https://your-instance.openai.azure.com", "vectorcastTestExplorer.reqs2x.azure.apiKey": "your-api-key", "vectorcastTestExplorer.reqs2x.azure.deployment": "gpt-4o-deployment", "vectorcastTestExplorer.reqs2x.azure.modelName": "gpt-4o", "vectorcastTestExplorer.reqs2x.decomposeRequirements": true, "vectorcastTestExplorer.reqs2x.generationLanguage": "en" } ``` -------------------------------- ### Generate Mock Session Variable Snippet Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/README.md Type 'vsession' to trigger a code snippet that generates the 'auto vmock_session = ::vunit::MockSession();' line for setting up mock sessions. ```cpp auto vmock_session = ::vunit::MockSession(); ``` -------------------------------- ### Requirements Excel File Format Source: https://context7.com/vectorgrp/vector-vscode-vcast/llms.txt Defines the expected format for requirements stored in an Excel file for Reqs2X integration. Ensure columns like ID, Title, Description, and Function are present. ```markdown # Requirements Excel file format (reqs.xlsx) | ID | Title | Description | Function | |------|------------------------|--------------------------------------------------|-----------------------| | FR27 | Add Included Dessert | If order is steak+caesar+mixed drink -> pie | Add_Included_Dessert | | | | If order is lobster+green+wine -> cake | | | | | Otherwise no dessert | | | FR28 | Calculate Total | Sum all item prices with tax | Calculate_Total | ``` -------------------------------- ### C Code Snippet for Dessert Assignment Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Adapt the C code to match the updated dessert requirement. This involves changing the assignment of the dessert type in the code. ```c Order->Dessert = CAKE; ``` ```c Order->Dessert = PIE; ``` -------------------------------- ### Define Test Groups in `specs_config.ts` Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/tests/internal/e2e/README.md Structure end-to-end tests into named groups within `specs_config.ts`. This allows for selective execution of test suites by setting environment variables. ```typescript "" [ ] ``` -------------------------------- ### Delete Generated Tests Source: https://github.com/vectorgrp/vector-vscode-vcast/blob/main/docs/reqs2x/reqs2x_documentation.md Remove previously generated tests before regenerating them to reflect updated requirements. This ensures a clean slate for new test generation. ```text VectorCAST -> DeleteTests ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.