Tutorial 6: Spec Testing¶
Duration: 1 hour
Prerequisites: Tutorials 1-5 completed
What you'll learn: Property-based testing, spec tests, test generation, and verification
Overview¶
USL provides powerful testing capabilities including property-based testing, example-based tests, and formal verification.
Writing Spec Tests¶
spec PostTests {
test "creating post increments post count" {
let initialCount = count(Post)
let post = createPost("Test", "Content")
assert count(Post) == initialCount + 1
assert post.status == PostStatus.Draft
}
property "published posts have content" {
forall post in Post where post.status == PostStatus.Published {
len(post.content) > 0
}
}
}
(Full testing tutorial content...)