Skip to content

Commit

Permalink
Introduce focus tests via README
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Huning committed Jul 9, 2012
1 parent 2fc2122 commit d82e261
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -77,6 +77,32 @@ etest has no concept of fixtures like eunit. If you need some
data over and over inside of your tests, you can define macros or
functions instead and call them from within your tests.


## Focus Tests

From time to time you might want to run a single test case out of your suite to quickly pin down where the underlying program fails. Thus we introduced the concept of _Focus Tests_, where you would _mark_ one or more test cases with the prefix `focus_`, then upon running your tests only the marked cases will be executed.

Example:

```erlang
-module(my_focus_test).
-compile(export_all).

% Include etest's assertion macros.
-include_lib("etest/include/etest.hrl").

% This case will be ignored.
test_bar() ->
% ...
?assert_equal(false, true).

% This case will be run.
focus_test_foo() ->
% ...
?assert(true).
```


## Demo

There is a quick screencast on vimeo that shows how to use etest in your
Expand Down
2 changes: 1 addition & 1 deletion src/etest_runner.erl
Expand Up @@ -64,7 +64,7 @@ testfuns(Module) ->
end,

IsFocus = fun({FunName, _}) ->
nomatch =/= re:run(atom_to_list(FunName), "^focustest_")
nomatch =/= re:run(atom_to_list(FunName), "^focus_test_")
end,

TestFuns = case lists:filter(IsFocus, Exports) of
Expand Down

0 comments on commit d82e261

Please sign in to comment.