Skip to content

bzielinskib/vscode-ceedling-test-adapter

 
 

Repository files navigation

Ceedling Test Explorer for Visual Studio Code

Run your Ceedling tests using the Test Explorer UI.

Screenshot

Features

  • Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state
  • Adds CodeLenses to your test files for starting and debugging tests
  • Adds Gutter decorations to your test files showing the tests' state
  • Adds line decorations to the source line where a test failed
  • Shows a failed test's log when the test is selected in the explorer
  • Lets you choose test suites that should be run automatically after each file change

Getting started

  • Install the extension and restart VS Code
  • Open the workspace or folder containing your Ceedling project
  • Configure your project.yml path in the VS Code's settings if required see below
  • Configure the shell path where ceedling is installed in the VS Code's settings if required (It might be required on Windows) see below
  • Enable the xml_tests_report Ceedling plugin in your project.yml see the ceedling doc
  • Open the Test view
  • Run your tests using the Run icons in the Test Explorer or the CodeLenses in your test file

Configuration

Options

Property Description
ceedlingExplorer.projectPath The path to the ceedling project (where the project.yml is) to use (relative to the workspace folder). By default (or if this option is set to null) it use the same path as the workspace folder.
ceedlingExplorer.shellPath The path to the shell where ceedling is installed. By default (or if this option is set to null) it use the OS default shell.
ceedlingExplorer.debugConfiguration The Debug configuration to run during debugging. See Debugging for more info.
ceedlingExplorer.prettyTestLabel The test label is prettier in the test explorer, that mean the label is shorter and without begin prefix. E.g. inactive test_BlinkTaskShouldToggleLed, active BlinkTaskShouldToggleLed
Inactive:
prettyTestLabelInactive
Active:
prettyTestLabelActive
ceedlingExplorer.prettyTestFileLabel The test file label is prettier in the test explorer, that mean the label is shorter, without begin prefix, path and file type. E.g. inactive test/LEDs/test_BlinkTask.c, active BlinkTask
Inactive:
prettyTestFileLabelInactive
Active:
prettyTestFileLabelActive
ceedlingExplorer.testCommandArgs The command line arguments used to run ceedling tests. The first argument have to litteraly contain the ${TEST_ID} tag. The value ["test:${TEST_ID}"] is used by default. For example, the arguments "test:${TEST_ID}", "gcov:${TEST_ID}", "utils:gcov" can be used to run tests and generate a gcov report.

Commands

The following commands are available in VS Code's command palette, use the ID to add them to your keyboard shortcuts:

ID Command
test-explorer.reload Reload tests
test-explorer.run-all Run all tests
test-explorer.run-file Run tests in current file
test-explorer.run-test-at-cursor Run the test at the current cursor position
test-explorer.cancel Cancel running tests

Debugging

To set up debugging, create a new Debug Configuration. ${command:ceedlingExplorer.debugTestExecutable} can be used access the .out test executable filename being ran. Depending on your Ceedling configuration these can be found in projectPath/build/test/out/. Then, edit the ceedlingExplorer.debugConfiguration settings with the name of the Debug Configuration to run during debug.

Note: Individual test debugging is not supported. Instead the entire test file will be ran, so skip or remove breakpoints accordingly.

Example configuration with Native Debug (webfreak.debug):

{
    "name": "Ceedling Test Explorer Debug",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "C:/MinGW/bin/gdb.exe",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

Known issues

  • Cannot use both the junit ceedling plugin and the xml plugin required by this extension because they are using the same ouput filename by default. If the version of the ceedling you are using is greather than 0.28.3, you should be able to configure the output filename. #20

Troubleshooting

If you think you've found a bug, please file a bug report.

About

Ceedling Test Adapter for the VS Code Test Explorer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%