Skip to content

QL Test Explorer should discover tests via codeql resolve tests #595

@dbartol

Description

@dbartol

Is your feature request related to a problem? Please describe.
The current implementation of Test Explorer finds QL tests by looking for packs from the current workspace that are available on the CLI's library path (usually via .codeqlmanifest.json), then looking for tests within those packs. This misses tests in packs that aren't specified in .codeqlmanifest.json, even though packs containing only queries and tests, or even packs containing only tests, have no other reason to be specified in the manifest.

Describe the solution you'd like
Instead of searching for registered packs, the Test Explorer should just invoke codeql resolve tests from the root of the workspace.

Additional context
A related concern exists about how the Test Explorer tree displays the tests. It currently has one top-level node for each pack, which will then expand to a directory tree containing the individual tests and test directories. It has been suggested that it would be better to have the Test Explorer tree show the actual directory tree, similar to the file Explorer tree. Directories containing no tests would not be shown, and any directory containing only a single other test directory would be combined with the contained test directory:

Original file system:

root
+ A
  + A1
    - test_a1.ql
  + A2
    - test_a2.ql
+ B // No tests under here
  + B1
    + foo.txt
+ C  // Only one subdirectory contains tests
  + C1  // Only one subdirectory contains tests
    + D
      - test_d1.ql
      - test_d2.ql

Test Explorer tree:

root
+ A
  + A1
    - test_a1
  + A2
    - test_a2
+ C/C1/D
  - test_d1.ql
  - test_d2.ql

If the above would be a better way to display the tests, it might be worth switching to that when implementing the codeql resolve tests code, rather than having to figure out how to map the output of codeql resolve tests back to packs.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions