Running canopy tests with FAKE
FAKE can be used to run a variety of different testing frameworks. In this tutorial we are looking at Canopy support.
Setup your canopy project
Consider a simple canopy program.fs
file:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: |
|
Although Selenium (which is the framework behind canopy) supports all browsers you might want to run your tests with the headless browser PhantomJS. To grab the latest version just install the NuGet package:
1:
|
|
Normally canopy loads PhantomJS.exe
from C:\
but in our case we want to use the installed one so we have to override the path in our test script and set the current path as location of PhantomJS.exe
.
Run canopy tests in FAKE
The target in FAKE basically hosts the website in IIS Express and starts the canopy tests. IIS Express requires a configuration template ("iisexpress-template.config"
) which can be copied from %ProgramFiles%\IIS Express\AppServer\applicationhost.config
.
This sample target will require the FAKE.IIS package
to be installed and referenced in your script, though the package isn't required to run Canopy tests.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: |
|
Please note that HostWebsite starts the IIS Express process asynchronous and does NOT wait until the IIS Express successfully started. Issue #403
type TimeSpan =
struct
new : ticks:int64 -> TimeSpan + 3 overloads
member Add : ts:TimeSpan -> TimeSpan
member CompareTo : value:obj -> int + 1 overload
member Days : int
member Divide : divisor:float -> TimeSpan + 1 overload
member Duration : unit -> TimeSpan
member Equals : value:obj -> bool + 1 overload
member GetHashCode : unit -> int
member Hours : int
member Milliseconds : int
...
end
--------------------
TimeSpan ()
TimeSpan(ticks: int64) : TimeSpan
TimeSpan(hours: int, minutes: int, seconds: int) : TimeSpan
TimeSpan(days: int, hours: int, minutes: int, seconds: int) : TimeSpan
TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int) : TimeSpan