Entry point to discover and execute tests. It contains {@link TestController.items} which are used to populate the editor UI, and is associated with {@link TestController.createRunProfile run profiles} to allow for tests to be executed.
Fields
resolveHandler:(item:Null<TestItem>) ‑> Thenable<Void>
A function provided by the extension that the editor may call to request
children of a test item, if the {@link TestItem.canResolveChildren} is
true
. When called, the item should discover children and call
{@link vscode.tests.createTestItem} as children are discovered.
Generally the extension manages the lifecycle of test items, but under certain conditions the editor may request the children of a specific item to be loaded. For example, if the user requests to re-run tests after reloading the editor, the editor may need to call this method to resolve the previously-run tests.
The item in the explorer will automatically be marked as "busy" until the function returns or the returned thenable resolves.
@link items}.
Parameters:
item | An unresolved test item for which children are being
requested, or |
---|
read onlyitems:TestItemCollection
A collection of "top-level" {@link TestItem} instances, which can in turn have their own {@link TestItem.children children} to form the "test tree."
The extension controls when to add tests. For example, extensions should add tests for a file when {@link vscode.workspace.onDidOpenTextDocument} fires in order for decorations for tests within a file to be visible.
However, the editor may sometimes explicitly request children using the {@link resolveHandler} See the documentation on that method for more details.
read onlyid:String
The id of the controller passed in {@link vscode.tests.createTestController}. This must be globally unique.
dispose():Void
Unregisters the test controller, disposing of its associated tests and unpersisted results.
createTestRun(request:TestRunRequest, ?name:String, ?persist:Bool):TestRun
Creates a {@link TestRun}. This should be called by the {@link TestRunProfile} when a request is made to execute tests, and may also be called if a test run is detected externally. Once created, tests that are included in the request will be moved into the queued state.
All runs created using the same request
instance will be grouped
together. This is useful if, for example, a single suite of tests is
run on multiple platforms.
@link TestRun}. It will be considered "running" from the moment this method is invoked until {@link TestRun.end} is called.
Parameters:
request | Test run request. Only tests inside the |
---|---|
name | The human-readable name of the run. This can be used to disambiguate multiple sets of results in a test run. It is useful if tests are run across multiple platforms, for example. |
persist | Whether the results created by the run should be persisted in the editor. This may be false if the results are coming from a file already saved externally, such as a coverage information file. |
Returns:
An instance of the {
createTestItem(id:String, label:String, ?uri:Uri):TestItem
Creates a new managed {@link TestItem} instance. It can be added into the {@link TestItem.children} of an existing item, or into the {@link TestController.items}.
@link TestItemCollection} it's added to.
Parameters:
id | Identifier for the TestItem. The test item's ID must be unique in the { |
---|---|
label | Human-readable label of the test item. |
uri | URI this TestItem is associated with. May be a file or directory. |
createRunProfile(label:String, kind:TestRunProfileKind, runHandler:(request:TestRunRequest, token:CancellationToken) ‑> Thenable<Void>, ?isDefault:Bool):TestRunProfile
Creates a profile used for running tests. Extensions must create at least one profile in order for tests to be run. @link TestRunProfile}, which is automatically associated with this controller.
Parameters:
label | A human-readable label for this profile. |
---|---|
kind | Configures what kind of execution this profile manages. |
runHandler | Function called to start a test run. |
isDefault | Whether this is the default action for its kind. |
Returns:
An instance of a {