Getting Started
An overview of Persimmon, how to download and use.
Creating project(or Getting sample project)
Now create a project and install Persimmon from NuGet (and enable NuGet Package Restore), or download sample project.
Getting Persimmon console runner
Run the command below:
1:
|
|
The first step
You can write the tests by using test
computation expression and assertion functions.
1: 2: 3: 4: 5: |
|
Executing test
Run the command below:
1:
|
|
Omitting test name
Open UseTestNameByReflection
module:
1: 2: 3: 4: 5: |
|
Testing exceptions
trap
computation expression can catch exceptions.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: |
|
Parameterized tests
Persimmon supports parameterized tests.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: |
|
namespace Persimmon
val ( some variable name ) : TestCase<unit>
val test : name:string -> TestBuilder
val assertEquals : expected:'a -> actual:'a -> AssertionResult<unit> (requires equality)
module UseTestNameByReflection
from Persimmon.Syntax
from Persimmon.Syntax
val ( first test example ) : TestCase<unit>
val test : TestBuilder
exception MyException
val ( exception test ) : TestCase<unit>
val f : (unit -> int)
val raise : exn:System.Exception -> 'T
val e : exn
val trap : TrapBuilder
custom operation: it ('b)
Calls TrapBuilder.It
Calls TrapBuilder.It
property System.Exception.Message: string with get
val typeof<'T> : System.Type
System.Exception.GetType() : System.Type
property System.Exception.StackTrace: string with get
System.String.Substring(startIndex: int) : string
System.String.Substring(startIndex: int, length: int) : string
System.String.Substring(startIndex: int, length: int) : string
val ( case parameterize test ) : seq<TestCase<unit>>
val parameterizeTest : ('a * 'a -> TestCase<unit>) (requires equality)
val x : 'a (requires equality)
val y : 'a (requires equality)
val parameterize : ParameterizeBuilder
custom operation: case ('a)
Calls ParameterizeBuilder.Case
Calls ParameterizeBuilder.Case
custom operation: run ('a -> TestCase<'b>)
Calls ParameterizeBuilder.RunTests
Calls ParameterizeBuilder.RunTests
val inputs : int list
val ( source parameterize test ) : seq<TestCase<unit>>
val parameterizeTest : (int -> TestCase<unit>)
val x : int
custom operation: source (seq<'a>)
Calls ParameterizeBuilder.Source
Calls ParameterizeBuilder.Source