Skip to content

Commit eb3662d

Browse files
akoclaude
andcommitted
Add mx create-project + mx check testing pattern to test-mdl skill
Document headless validation workflow: create a fresh blank project with mx create-project, apply MDL changes, validate with mx check. Includes CE0066 scenario test example and updated checklist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0b3d9c2 commit eb3662d

1 file changed

Lines changed: 70 additions & 3 deletions

File tree

.claude/skills/test-mdl.md

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,73 @@ Execute MDL commands against the test project:
3535
./bin/mxcli -p mx-test-projects/test1-go-app/test1-go.mpr exec reference/mendix-repl/examples/doctype-tests/domain-model-examples.mdl
3636
```
3737

38-
### 4. Verify in Studio Pro
38+
### 4. Validate with mx check (Headless)
39+
40+
Use `mx check` to validate projects without Studio Pro. This catches consistency errors (CE0066, CE1613, etc.) that would otherwise only show up when opening in Studio Pro.
41+
42+
```bash
43+
# Find the mx binary
44+
MX=~/.mxcli/mxbuild/*/modeler/mx
45+
46+
# Check the project
47+
$MX check /path/to/app.mpr
48+
```
49+
50+
Expected output for a clean project:
51+
```
52+
Checking app for errors...
53+
The app contains: 0 errors.
54+
```
55+
56+
### 5. Isolated Testing with mx create-project
57+
58+
For testing changes in isolation without modifying existing test projects, create a fresh blank project:
59+
60+
```bash
61+
# Create a fresh Mendix project in a temp directory
62+
cd /tmp/test-workspace
63+
$MX create-project
64+
65+
# This creates a full Mendix project structure:
66+
# App.mpr, mprcontents/, javascriptsource/, javasource/, etc.
67+
# IMPORTANT: Run from the target directory — it creates files in the CWD.
68+
69+
# Apply MDL changes
70+
mxcli exec script.mdl -p /tmp/test-workspace/App.mpr
71+
72+
# Validate
73+
$MX check /tmp/test-workspace/App.mpr
74+
```
75+
76+
This pattern is ideal for:
77+
- **Regression testing**: verify a fix doesn't break `mx check`
78+
- **BSON validation**: confirm serialized structures are valid Mendix format
79+
- **Security testing**: verify GRANT/REVOKE produce correct access rules (CE0066)
80+
- **CI pipelines**: headless validation without Studio Pro
81+
82+
#### Example: CE0066 scenario test
83+
84+
```bash
85+
# Fresh project
86+
cd /tmp/ce0066-test && $MX create-project
87+
88+
# Apply changes and validate
89+
cat > /tmp/test.mdl << 'EOF'
90+
CREATE MODULE ROLE MyFirstModule.Admin;
91+
CREATE OR MODIFY PERSISTENT ENTITY MyFirstModule.Order (
92+
Code: String(50),
93+
Total: Decimal
94+
);
95+
GRANT MyFirstModule.Admin ON MyFirstModule.Order (CREATE, DELETE, READ *, WRITE *);
96+
ALTER ENTITY MyFirstModule.Order ADD ATTRIBUTE Status String(50);
97+
EOF
98+
99+
mxcli exec /tmp/test.mdl -p /tmp/ce0066-test/App.mpr
100+
$MX check /tmp/ce0066-test/App.mpr
101+
# Expected: 0 errors
102+
```
103+
104+
### 6. Verify in Studio Pro
39105

40106
After executing MDL:
41107
1. Open the MPR file in Mendix Studio Pro
@@ -132,6 +198,7 @@ go build -o bin/mxcli ./cmd/mxcli
132198
- [ ] MDL script executes without errors
133199
- [ ] `go build ./...` succeeds
134200
- [ ] `go test ./...` passes
135-
- [ ] Studio Pro opens project without errors
136-
- [ ] Created elements appear correctly in Studio Pro
201+
- [ ] `mx check` passes on a fresh project with the changes applied (0 errors)
202+
- [ ] Studio Pro opens project without errors (if available)
203+
- [ ] Created elements appear correctly in Studio Pro (if available)
137204
- [ ] BSON mapping documentation updated if new patterns discovered

0 commit comments

Comments
 (0)