Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate testing DAP features #14025

Closed
tsmaeder opened this issue Jul 25, 2019 · 2 comments
Closed

Investigate testing DAP features #14025

tsmaeder opened this issue Jul 25, 2019 · 2 comments
Assignees
Labels
area/languages Issues related to Language extensions or plugins integration. kind/task Internal things, technical debt, and to-do tasks to be performed.

Comments

@tsmaeder
Copy link
Contributor

Investigate writing automated tests as requested in #13897

The goal of this issue is to come up with a way to write tests for VS Code extensions that provide debug adapters.

We'd have to be able to script

  1. Setting up a workspace
  2. Creating debug configurations and launching debuggees (and connecting to them)
  3. Exceute debug protocol actions
  4. Intercepting and verifying results of those debug actions

I would prefer to write the scripts based on a API, not based on UI interactions

@tsmaeder tsmaeder mentioned this issue Aug 7, 2019
20 tasks
@tsmaeder tsmaeder mentioned this issue Aug 14, 2019
24 tasks
@tolusha
Copy link
Contributor

tolusha commented Aug 14, 2019

It is possible to initialize and control debug session using Theia frontend API [1]
Here is the testing workspace [2]

[1] https://github.com/theia-ide/theia/blob/ab/api-tests/packages/apt-tests/src/browser/debug-tests.ts
[2] https://github.com/theia-ide/theia/tree/ab/api-tests/packages/apt-tests/testWorkspace

The next step is to create a test suite like VS Code does [3] and run it using launch configuration [4]

[3] https://github.com/microsoft/vscode/tree/master/extensions/vscode-api-tests
[4] eclipse-theia/theia#4224 (comment)

@tolusha tolusha self-assigned this Aug 23, 2019
@tolusha tolusha added area/languages Issues related to Language extensions or plugins integration. team/languages kind/task Internal things, technical debt, and to-do tasks to be performed. labels Aug 23, 2019
@tolusha
Copy link
Contributor

tolusha commented Aug 23, 2019

The work is done here https://github.com/theia-ide/theia/tree/ab/theia-tests/packages/theia-tests

Workflow is the following:

  1. Start Theia
  2. Open Theia project
  3. Run the configuration below
{
      "name": "Launch Theia Tests",
      "type": "node",
      "request": "launch",
      "args": [
        "${workspaceFolder}/examples/browser/src-gen/backend/main.js",
        "${workspaceFolder}/packages/theia-tests/testWorkspace",
        "--port",
        "3030",
        "--hostname",
        "0.0.0.0"
      ],
      "env": {
        "THEIA_DEFAULT_PLUGINS": "local-dir:${workspaceFolder}/plugins"
      },
      "stopOnEntry": false,
      "sourceMaps": true,
      "outFiles": [
        "${workspaceFolder}/../.js"
      ]
    }
  1. Opens browser:
    http://localhost:3030/?runTests
    ?runTests is a crucial thing which tells TestRunner to start tests.

  2. Wait until tests are finished

root INFO -------------------------------------------------------------
root INFO Results:
root INFO Test run: 2 Passed: 2 Failures: 0
root INFO -------------------------------------------------------------

screencast-localhost_3000-2019 08 23-14_45_09

Implementation details.

Tests are run when test environment is set [1]. TestRunner [2] scans test classes [3] for test methods and run them one by one.

[1] https://github.com/theia-ide/theia/blob/ab/theia-tests/packages/theia-tests/src/browser/theia-tests-frontend-module.ts
[2] https://github.com/theia-ide/theia/blob/ab/theia-tests/packages/theia-tests/src/browser/framework/test-runner.ts
[3] https://github.com/theia-ide/theia/blob/ab/theia-tests/packages/theia-tests/src/browser/framework/test-case.ts

TODO

  1. Move theia-test extension to https://github.com/eclipse/che-theia/tree/master/extensions
  2. Run tests inside Eclipse Che

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/languages Issues related to Language extensions or plugins integration. kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

No branches or pull requests

2 participants