Skip to content
This repository

So, here is my test that I wrote …

-module(login).
-export([start/0]).
start() ->
    boss_web_test:get_request("/login", [], 
        [ % We are checking for some basic information here, loading ok, presence of links and form elements
            fun(Res) -> boss_assert:http_ok(Res) end,
            fun(Res) -> boss_assert:link_with_text("Register if you don't have an account.", Res) end,
            fun(Res) -> boss_assert:tag_with_text("label", "Username:", Res) end,
            fun(Res) -> boss_assert:tag_with_text("label", "Password:", Res) end,
            fun(Res) -> boss_assert:tag_of_type("input", "submit", Res) end,
            fun(Res) -> boss_assert:tag_of_type("input", "text", Res) end,
            fun(Res) -> boss_assert:tag_of_type("input", "password", Res) end
        ],
        [ % Here are the continuations, once we've passed the first check for completeness
    %% No continuations just yet …        
        ]).

and here is what it produces:

RACKBookPro: 09:46:19 ~/Programming/Erlang/ChicagoBoss/qr$ time ./rebar boss c=test_functional
==> erlcron (boss)
==> qr (boss)
Starting boss and waiting all apps to initilize...

=INFO REPORT==== 12-May-2012::09:59:30 ===
Starting Boss in development mode....

=INFO REPORT==== 12-May-2012::09:59:31 ===
Starting master services on nonode@nohost

=INFO REPORT==== 12-May-2012::09:59:31 ===
Loading routes from "./cb_admin/priv/cb_admin.routes" ....

=INFO REPORT==== 12-May-2012::09:59:31 ===
Loading routes from "../qr/priv/qr.routes" ....

=INFO REPORT==== 12-May-2012::09:59:31 ===
Loading routes from "../qr/priv/qr.routes" ....
["login"]

Running: "login"
Root test                                                     7 passed
======================================================================
Passed: 7
Failed: 0

real    0m4.149s
user    0m2.417s
sys     0m0.290s

The example listed above will NOT work on your system. I extended the test framework with tests for "tag_of_type" as a learning exercise. My code is not nice and will not be published. :)

If you want to use the code example as shown above, remove the lines that start with "boss_assert:tag_of_type" and it might work on your provided login form.

Anyhow, the framework is nice and fast and it would be cool to have more boss_asserts for more UI elements. I envision tests for content of text field, class names, type of input fields and the like.

Bring your ideas forward, talk about it at the Mailing List and we might end up with a great and fast Erlang powered testing framework.

Something went wrong with that request. Please try again.