It's tricky with Common Test, but it's possible to use embedded EUnit test cases to test private functions in a module. You can then test the public interface using Common Test. Rebar will automagically discover embedded test cases when you run rebar test
.
Here's an example:
-module(example).
-export([public/1]).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
%% This function will be tested externally using Common Test
public(Foo) ->
private(Foo + 42).
%% This function is not reachable to CT, so it will be tested using EUnit.
private(Bar) ->
Bar * 2.
%%% Tests
-ifdef(TEST).
private_test() ->
?assertEqual(10, private(5)),
?assertEqual(0, private(0)).
-endif.
On a side note, you might find Meck to your liking if you need to mock away a module (or parts thereof) when testing with EUnit.
For a gentle introduction to EUnit, see the Learn You Some Erlang chapter.