Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your biggest win with using a functional language will come from <b>not having to use classes at all, but being able to when they are the right answer</b>. Also, F# allows for a nice <b>clean 'dsl' looking test suite because of type inference and the syntax</b>. Common actions (example: logging in) are easily abstracted into a function and called within a test. Any function that is very specific to a page can be added to that page's module along with its defining features (css selectors etc).</p> <p>Here is an example of a test written with <a href="http://lefthandedgoat.github.com/canopy" rel="noreferrer">canopy</a><br></p> <pre> test(fun _ -&gt; //description of the test describe "registering a user" //go to root url "/" //ensure that you are on the login page on "/Account/LogOn" //click the registration link click "form a[href='/Account/Register']" //verify that you were redirected on "/Account/Register" //set the value of the input to email address specified "#Email" &lt;&lt; "username@example.com" //set the value of the input to "Password" "#Password" &lt;&lt; "Password" //set the value of the input to "PasswordConfirmation" "#PasswordConfirmation" &lt;&lt; "Password" //click the register button click "input[value='register']" //verify that you were redirected on "/" //log off after test url "/account/logoff" ) </pre> <h1>More about canopy</h1> <p>I've written a Web automation framework/library in F# (also one in Ruby) and thus far, while I wouldn't consider its style to be functional, it doesn't have any classes. Almost everything is a function. Your test suite is a list of functions that are run.</p> <p><a href="http://lefthandedgoat.github.com/canopy" rel="noreferrer">github page</a><br> <a href="https://github.com/lefthandedgoat/canopy/blob/master/basictests/Program.fs" rel="noreferrer">some examples</a><br></p> <p>With &lt; 500 LoC there are only 3 modules, the main set of functions to interact with your page, a simple test runner, and some configuration variables. At this point this paradigm has worked really well for me. I don't use classes for page definitions because for me, a page definition is as simply the css selectors I use. A module with a bunch of values fulfills this need nicely.</p> <p>Give it a shot, I think you will find it to be an excellent way to accomplish your goals.</p> <p>Sorry first time post so it wont let me show more links. Look on github and you can see the source at /canopy/canopy/canopy.fs</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload