CARVIEW |
chaliy / fsspec
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (2)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
Yet another Unit Testing/BDD framework for F#. Inspired by RSpec syntax. — Read more
name | age | message | |
---|---|---|---|
![]() |
.gitignore | Thu Apr 22 12:59:56 -0700 2010 | Added build script [chaliy] |
![]() |
Readme.markdown | Sun Feb 21 11:25:04 -0800 2010 | Some non notable addtions to the readme file [chaliy] |
![]() |
build.ps1 | Thu Apr 22 12:59:56 -0700 2010 | Added build script [chaliy] |
![]() |
lib/ | Thu Apr 22 12:59:56 -0700 2010 | Added build script [chaliy] |
![]() |
src/ | Thu Apr 22 12:59:56 -0700 2010 | Added build script [chaliy] |
FsSpec
FsSpec is about writing executable specs in F#. Main intent is to provide readable DSL. Hope this tool will be able to achieve this.
Syntax
Syntax is inspired by RSpec. Specification of the Calculator could look like this:
do describe "Calculator" (fun unit ->
it "should add two integers" (fun unit ->
let res = Calc.Add 2 2
res.should_be_equal_to 4
)
it "should devide two integers" (fun unit ->
let res = Calc.Div 2 2
res.should_be_equal_to 1
)
)
Another syntax is:
module ``Calculator Specification``
open FsSpec
module ``Describe simple opertions`` =
let ``add two integers`` = spec {
let res = Calc.Add 2 2
res.should_be_equal_to 4
}
let "devide two integers`` = spec {
let res = Calc.Div 2 2
res.should_be_equal_to 1
)
I think second syntax eventually becomes main.
Usage
There are two scenarious, first is to write specs as simple app. Thou runnig specs means run app:
- Reference FsSpec.dll
- Write specification
You can find example of this usage in src/Example
or src/SuiteExample
.
Another option is to use built-in runner
- Reference FsSpec.dll
- Write specifications
- Add FsSpec.Runner.Run() to your main method
Example of this usage located in src/CompiledSuiteExample
.
Examples
There are three examples come out of the box.
First one is located at /src/Example
, this is simple compiled spec. To run this spec, compile and run as regular command line app.
Second example on the other hand is implemented as bunch of F# scripts. You can find it at /src/SuiteExample
. Because of nature of the script, you do not have to compile it. Just execute Run.cmd. Should work.
And finally third example. You can find it in src/CompiledSuiteExample
. It describe specification that could be runned with built-in runner.
References
Introduction post (outdated) - FsSpec: Introducing yet another Unit Testing/BDD framework for F#
Other simmilar tools
- FsUnit - is native F# DSL around existing .NET unit-testing frameworks;
- FsCheck - is a F# port of Haskell's QuickCheck;
Roadmap
- TeamCity integration;
- Remove dependency to PowerPack;
- New asserions and possible new syntax;
- Colored output;
- © 2010 GitHub Inc. All rights reserved.
- Terms of Service
- Privacy
- Security