Overview: running, debugging and generating¶
Audience: everyone · ~4 min read · Prerequisites: Quick start
The short path: model, check, test, generate¶
This is the whole loop in seven steps. Each step names the menu item to use; the topic pages below go deeper.
- Open or create a model. File > Samples > Load Sample… for an example, or New model… in the Explorer (Projects and models). Problems appear while you type, and the status bar counts them.
- Ask "is it healthy?" once. Run > Execute > Verify Model runs the checks, the tests and a generator dry run
together and prints one line in the status bar, for example
✗ 1 problem · no tests · generator ✓. - Fix what it names. If a Run or Verify is refused, the message names the first error and the editor jumps to it; click the Output line to jump again. Warnings never block.
- Add a test without setup. Run > Execute > Pin Current Behaviour as Test creates the tests root for you if there is none, and records what the model does today as a passing case (Writing and running tests). The Explorer badge next to the model turns ✓ (○ means "passed, but no tests yet").
- Run the tests. Run > Execute > Run Tests; each assertion in the tests root is marked green or red, and a failed comparison shows Expected and Actual side by side.
- Look at the output. Run > Execute > Run Program (F5) runs it, Run Generator (F6) shows the generated text, Open Preview (F4) shows an HTML preview; Run > Generate > Generate Model writes the files (Generators and Open Preview, Multi-file generation).
- Do the same in CI.
strukts verify --project-dir .gives the same verdict and an exit code (The strukts CLI).
Keep Verify in mind as the one command you repeat: Run > Execute > Verify Model.
Where to go next¶
| I want to... | Go to |
|---|---|
| Find out in one step whether my model is healthy (checks, tests, generator) | Verify |
| Press Run and see output, understand input, time limits and built-in functions | Running a model |
| Pause at a breakpoint and step through | The Debugger |
| See the generated code, or a live preview | Generators and Open Preview |
| Write generated files to disk | Multi-file generation |
| Copy, filter and save output, and decode a message | Output, Terminal and error messages |
| See why Run refuses to start | Problems panel and checks |
| Write tests, measure coverage, run mutations | Writing and running tests, Mutation runs and coverage |
| Query the model from a console | Model Console and the query language |
Verify: is this model healthy?¶
Run > Execute > Verify Model (or Verify Project for every model of the open project) answers the question in one step instead of three. It runs, together and without stopping at the first failure:
- the checks (the same pass as the Problems panel: constraints, types, data flow),
- every test suite of the model (Tests),
- a generator dry run: the generator runs and its output is thrown away, so nothing is written to disk.
The result is one line in the status bar, for example ✗ 2 problems · 12/14 tests · generator ✓. A part that did
not run says so (no tests, generator –) rather than looking like a pass. Warnings alone do not fail a
verification. When something failed, the pane for the first failing part opens: Problems for check errors, the
Tests pane for failed tests, the generated tab for generator errors. Click the status-bar entry to verify the open
model again. In a project, a model whose language is not loaded yet this session is skipped and counted in the
message; open it once to include it.
The headless equivalent for CI is strukts verify (The strukts CLI).
How programs run¶
Run > Execute > Run Program (F5) runs the open root: a language with a real runtime (Core) is generated to Python and run by a real Python 3 (the one on the machine running the IDE, else the built-in Pyodide Python); every other language, and the debugger, uses the built-in evaluator. Errors block a run. Details, time limits and the built-in function table are in Running a model.
Data-flow analysis¶
Possibly-uninitialized variables and unreachable code are reported as problems while you edit. See Problems panel and checks. Static analysis in general (checks, constraints, types) starts at Problems panel and checks.
Debugger¶
Breakpoints, Step, Continue, Pause, Stop and the Variables table: The Debugger.
Generators and previews¶
Run Generator (F6) shows generated text; Open Preview (F4) runs an HTML preview in a sandbox or shows a run's output. See Generators and Open Preview; writing files: Multi-file generation.
Version control¶
Git (stage, commit, branches, history, the tree-aware diff) has its own pages: Source Control pane and Model-aware diff and merge.
From the command line (CI and build tools)¶
The strukts command line runs the checker, generators and test runner headlessly for every project. See
The strukts CLI, Exit codes and JSON output and
CI recipes, Gradle and Bazel.