Skip to content

Separate test runner API #127096

@connor4312

Description

@connor4312

From discussion offline:

@jrieken: I still haven’t started nit-mode but things are looking much better. One thing that occurred to me is about createTestRun. Its comment says that a label can be used to distinguish different platforms on which the test run. I wonder if that’s enough? Not all tests run on all platforms (like for us only things from /browser/ or below run in safari) and it doesn’t offer a way for users to say “Re-run/run in Firefox”. Is it that a test run must always occur on all platforms? Should TestItem.runnable list “test runners”? What’s your take on this? Has this been already discussed and decided?
@connor4312: This is something the playwright team brought up as well, more around wanting to allow users to select what browsers they want to run on. Perhaps we can introduce a new "configurations" concept, where there is a set-like object of them on controllers. The UI could provide a way to run subsets of configurations (or the entire list of configurations) which could be passed in the test run request. Wrt items that only run on one platform, I think the way to do those right now would be marking them as "skipped" when run on platforms where they aren't valid. Not sure I want to add a bunch of complexity to the current "runnable" boolean...

Perhaps this could be something like this:

export class TestRunner<T = any> {
	name: string;
	runHandler: (request: TestRunRequest<T>) => void;
	constructor(name: string, runHandler: (request: TestRunRequest<T>) => void);
}

/**
 * Interface to discover and execute tests.
 */
export interface TestController<T = any> {
	registerTestRunner(runner: TestRunner<T>): Disposable;

With explicit handlers, this calls into question the need to do the magic matching on the request in createTestRun. However there is still the case of createTestRun being used to publish test runs without a run actually being executed in the vscode UI.

Metadata

Metadata

Assignees

Labels

apiinsiders-releasedPatch has been released in VS Code InsiderstestingBuilt-in testing support

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions