How do I run a scenario in vscode

Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ post on our blog.

Hello to all.

I have installed the DAML 1.8.0
also vscode and the plugin, the operating system is a ubuntu 18.04.

I follow the example tutorials and in all of them it is mentioned to execute the scenario, but they don’t say how, I don’t see the link, neither button nor command of how to do it from vscode, I would appreciate it very much the help.

Greetings

3 Likes

Hi @magzupao, welcome to the forum!

Scenarios are run automatically in VSCode. For any defnition of type Scenario a (for some type a) you will see a “Scenario results” codelens. One you click on that, a separate tab opens that displays the ledger state at the end of the scenario. Here are two screenshots that display both the link as well as the resulting tab once you click it:

Note that for new applications, I would recommend DAML Script instead of scenarios. Scenario vs Script - #3 by cocreature describes the advantages. The only difference here is that the link will be called “Script results” and the syntax for a DAML Script looks a bit different than scenarios.

You can find more information on scenarios and DAML Script and how you can inspect the results in DAML Studio in our documentation.

2 Likes

Position screenshot of the example I’m testing.

On the previous line 25, ‘Scenario results’ is not displayed and if I edit the code I have entered ‘Scenario results’ the test is not executed. What should I configure to display ‘Scenario results’?

Thanks for the help.

1 Like

The scenario results should be displayed automatically without any configuration. If they are not, then there is probably an error in starting up the language server. To debug this, click on “View -> Output” in the menu and then select “DAML Language Server” at the bottom right (highlighted in the screenshot). The output should hopefully contain an error, feel free to share it here if you can’t spot it.

If it does not contain enough information, you can enable debug logging in the VSCode extension settings:

1 Like

Finally! I can now run the test, thank you very much.

1 Like

Did you find out what the issue was?

1 Like

I did not have the DAML language server option configured.

Greetings

2 Likes