Questions tagged [common-test]

Common-Test is a powerful test framework that comes with Erlang/OTP

Common test is a very powerful testing framework that can be used for systems and unit testing and even for distributed tests. Its a bit hard to learn just from the documentation but in the chapter in "Learn You Some Erlang": Common Test for Uncommon Tests there is an easy to understand introduction.

For reference find below the official manuals, but by all means read the introduction in the link above first:

47 questions
2
votes
1 answer

Using Rebar3 Common Test does not find hrl files in the include folder but eunit does

Using rebar3 eunit it is able to handle -include("some_file.hrl") in the tests, but this doesn't work with rebar3 ct. For some reason when I use rebar3 ct it tries to compile my eunit tests and fails because it can't find the .hrl files used in the…
casillic
  • 1,837
  • 1
  • 24
  • 29
2
votes
1 answer

Erlang init_per_group terminates gen_server

Common test init_per_group/2 terminates gen_server when it is started with gen_server:start_link. But it is ok to start server with gen_server:start. gen_server can be started with any of these methods (start and start_link) in init_per_suite/1 and…
Galina
  • 75
  • 1
  • 4
2
votes
1 answer

Erlang ct:run_test dependencies

I try to run common test suites from erl shell with command: > ct:run_test([{spec,"test/spec"}]). Test suite fails with an error: undefined function eredis:start_link/3 But if I type in the shell this: > eredis:module_info(). I can see that…
Galina
  • 75
  • 1
  • 4
2
votes
1 answer

Erlang Common Test coverage specification file - Relative paths

I am using Common Test for code coverage analysis in my erlang project. File structure myProject/ ebin/ src/ test/ myProject.coverspec The .beam-files for the source code is located in ebin/ and for the tests they are in test/…
Linuxxon
  • 411
  • 1
  • 3
  • 14
2
votes
1 answer

distributed test with erlang common test

Now I’m working with Erlang, and I think I should do some distributed test with the common test framework. I’v read some article about this. But I can’t run my own application on multiple nodes with the ct_master. It Bothers me many days — the slave…
Sirui Zhuang
  • 665
  • 5
  • 12
2
votes
1 answer

erlang common test: how to start iconv application?

In my application I'm using this implementation of erlang-iconv. Simple test suite: -module(example_SUITE). -include_lib("common_test/include/ct.hrl"). -export([all/0, suite/0, init_per_suite/1, end_per_suite/1, …
Anton Koval'
  • 4,863
  • 5
  • 31
  • 44
2
votes
2 answers

Dealing with shared helpers in Common Test suites?

I've got an Erlang project comprising a bunch of different applications. I'm using Common Test to do some of the testing. apps/foo/suites/foo_SUITE.erl apps/bar/suites/bar_SUITE.erl I'm starting to see duplication of utility code in those…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
2
votes
1 answer

How to configure cover for a node with multliple applications

I have 4 applications within a node, all tested with Common Test. My cover specification: {level, details}. {incl_dirs, ["apps/app1/ebin", "apps/app2/ebin", "apps/app3/ebin", "apps/app4/ebin"]}. Test command: ct_run -pa apps/*/ebin -pa deps/*/ebin…
mkorszun
  • 4,461
  • 6
  • 28
  • 43
2
votes
0 answers

How do I convince Erlang's Common Test to spawn local nodes?

I'd like to have Common Test spin up some local nodes to run suites. To that end, I've got the following spec file: {node, a, 'a@localhost'}. {logdir, [a,master], "../logs/"}. {init, [a], [{node_start, [{callback_module, slave} …
troutwine
  • 3,721
  • 3
  • 28
  • 62
1
vote
1 answer

Unable to run ct_netconfc_SUITE testcase

When I try to run a testcase specified in the test suite ct_netconfc_SUITE, I am getting an error “Failed to start CTH, see the CT Log for details”. What could be the issue? Please give me pointer to resolve the issue. I did not find any clue in the…
Bhuvan
  • 370
  • 9
1
vote
1 answer

Killing a gen_server without failing the Common Test

I implemented a module which is purposefully supposed to crash (to test the functionality of another module, which is monitoring it). The problem is, when this gen_server crashes it also causes the common test for it to fail. I've tried using…
Josh K
  • 79
  • 1
  • 12
1
vote
1 answer

Named gen_server process created in init_per_suite is not present in tests

I'm learning erlang and I have created a cache_server module implementing gen_server behaviour. This module is responsible for creating ets tables and has an api to insert, lookup, etc. I wanted to make test suite for the module and to run test…
AndreyKo
  • 1,421
  • 2
  • 11
  • 25
1
vote
1 answer

How do I log to stdout or stderr from an Erlang common test suite?

I'm using common_test and just want to log values to stdout or stderr. How???? I've tried: ct:comment ct:log io:format The state of the art seems to be manually combing through html files. But I'm on a server and I don't care about anything except…
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
1
vote
0 answers

How to start ct_logs in common_test

I want to print some message in my test suite use ct:print, but when i run the test suite use >rebar3 ct, the console raise a warning as ct_logs not started and then an ERROR REPORT was print. The ERROR REPORT as below: =ERROR REPORT====…
henry.he
  • 33
  • 3
1
vote
1 answer

How to debug or get verbose output from a ct test?

I am running a ct test and my setup is failing, and thus the test suite is skipped. *** FAILED {test_suite_name_here_SUITE,init_per_suite} *** My question is how to debug the run of the test suite? And secondly how to get verbose output from the…
2240
  • 1,547
  • 2
  • 12
  • 30