picotest
Version, currently master branch1 version
- master branchlatestDec 29, 2019
github.com/firejox/picotest
A tiny test framework for crystal
1 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
picotest:
github: firejox/picotest
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.32.0- License
- MIT
- Author
- firejox
Dependencies
Development Dependencies
- ameba~> 0.11.0github: crystal-ameba/amebadev
README
picotest 
A tiny test framework for Crystal.
Features
- No Object class pollution
- No global macro
- Without closure overhead
- Support
assert,reject,assert_raise,reject_raisebasic assertions.
Installation
-
Add the dependency to your
shard.yml:dependencies: picotest: github: firejox/picotest -
Run
shards install
Usage
Add this into spec then Run with crystal spec
require "picotest"
Example Code
PicoTest.spec do
describe "example spec" do
it "assert true == true" do
assert true == true
end
it "reject true == false" do
reject true == false
end
describe "nest spec" do
it "catch raise" do
assert_raise(Exception) do
raise "OH NO!"
end
end
it "no raise in block" do
reject_raise do
"it is safe"
end
end
end
pending "pending test"
pending "pending with block" do
end
end
end
Before/After Hook
# The execution order is A -> D -> F -> E -> B
PicoTest.spec do
describe "context" do
before do
# A
end
after do
# B
end
describe "nested context" do
before do
# D
end
after do
# E
end
it "F" do
end
end
end
end
Async Spec
By default, each spec will run synchronously. You can make the spec run concurrently by setting sync: false. For example,
# A
PicoTest.spec sync: false do
describe "Spec A" do
it "run asynchronously" do
# do something
end
end
end
# B
PicoTest.spec sync: false do
describe "Spec B" do
it "run asynchronously" do
# do other thing
end
end
end
A and B will run concurrently.
Development
- [x]
before,afterhooks - [x] report duration of spec
- [x] run spec unit parallel in MT mode
- [ ] tag on test cases
- [ ] power assert support
Contributing
- Fork it (https://github.com/firejox/picotest/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Firejox - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Dec 29, 2019
- Crystal
0.32.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/firejox/picotest
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 1