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
9
votes
4 answers

Erlang Testing (Non Exported / Private) function of module using common test

I have a module in Erlang which has functions that are not exported by Erlang. How can I test / call these functions using common test framework?
Smarth Behl
  • 103
  • 6
9
votes
1 answer

How can I make Rebar run Common Test in a release directory?

I have a Rebar project with a top-level release directory that just includes the component applications as dependencies and contains the reltool configuration. Some of my applications have Common Test suites in test subdirectories, and I can run…
legoscia
  • 39,593
  • 22
  • 116
  • 167
7
votes
1 answer

Is it possible to have Common Test run test cases in a random order?

I have a couple dozen Common Test test suite modules for an Erlang application I have written. All the tests are passing but I feel the test suites are very brittle. Reordering the tests causes some of them to fail. I didn't read the dependencies…
Stratus3D
  • 4,648
  • 4
  • 35
  • 67
6
votes
2 answers

Why does an ets table survive ct:init_per_testcase but not init_per_suite?

I have a common test suite that attempts to create an ets table for use in all suites and all test cases. It looks like so: -module(an_example_SUITE). -include_lib("common_test/include/ct.hrl"). -compile(export_all). all() ->…
troutwine
  • 3,721
  • 3
  • 28
  • 62
4
votes
2 answers

How do I export all functions for common test only?

I have been trying to export all the functions in an erlang module for use in a common test SUITE, not an eunit module. So far it has not worked for me. I am using rebar to run the SUITE, and I came across this question…
liam_g
  • 314
  • 1
  • 5
  • 15
4
votes
2 answers

Lager calls failing during Common Test test runs

I decided to setup lager in my Erlang project. I am using erlang.mk, so I added ERLC_OPTS = +'{parse_transform, lager_transform}' to my Makefile. I can run make all and compile the modules without errors. I can also start an erl console and run…
Stratus3D
  • 4,648
  • 4
  • 35
  • 67
4
votes
1 answer

How to structure and organize tests for Erlang/OTP?

I came to Erlang/OTP from python world, where I'm using unittest library. Typical test environment will be presented by some TestSuite for entire application and TestCases with test methods for different modules from subpackages of application. My…
Anton Koval'
  • 4,863
  • 5
  • 31
  • 44
4
votes
2 answers

How to specify configuration file for common_test running tests with rebar

I have a common test suite and I need to perform it with rebar. Usually it is done with command rebar ct suites=mysuite But there is an obstacle. My suite is required configuration file and I need to specify it when I am performing tests. ct_run…
Danil Onishchenko
  • 2,030
  • 11
  • 19
3
votes
0 answers

Using Rebar3 how to use Common Test so it places the beam files in _build section not test folder?

When I use rebar3 with Common test as follows: rebar3 ct it compiles (generates beam files for) all my code into the test folder. Everything works but less than ideal. How do I have it place them in the _build/test/MyApp/ebin section? Eunit does…
casillic
  • 1,837
  • 1
  • 24
  • 29
3
votes
1 answer

How to test errors handling in common test?

I'm starting to use common test as my test framework in erlang. Suppose that I have function I expect to accept only positive numbers and it should blows in any other case. positive_number(X) when > 0 -> {positive, X}. and I want to test…
Jonas Fagundes
  • 1,519
  • 1
  • 11
  • 18
3
votes
1 answer

Apply Erlang configuration file (for multiple applications) to Common Test with rebar

I have created a configuration file as described in Erlang -- config for my application that consists of multiple sub-apps of which each has its own Common Test suites directory. For building and testing I use rebar, my directory structure looks…
Luis
  • 201
  • 3
  • 11
3
votes
1 answer

Cover report from Common Test when using rebar

I have an Erlang application that uses Rebar, and has tests written using Common Test. I'd like to see the test coverage report for these tests, so I included the following line in my rebar.config file: {cover_enabled, true}. However, the…
legoscia
  • 39,593
  • 22
  • 116
  • 167
3
votes
3 answers

Testing Erlang applications based on cowboy using common test

I have an Erlang application based on Cowboy and I would like to test it. Previously I used wooga's library etest_http for this kind of tasks, but I would like to start using common tests since I noticed that this is the way used in cowboy. I have…
user601836
  • 3,215
  • 4
  • 38
  • 48
2
votes
2 answers

Reason: undef while running common tests in erl console [Erlang]

I have running application and in the interactive console I try to run common test suites located in test/common directory: ct:run("test/common"). But I get a bunch of errors: Reason: undef and all tests fail. I tried to run them from linux…
AndreyKo
  • 1,421
  • 2
  • 11
  • 25
2
votes
1 answer

Erlang Common Test: Get test runtime stats across all test suites

I currently have a set of applications, each with their own set of test suites. Is there a way to get test case runtimes in a when running one or more CT test suites? I know the test reports provide the testcase runtimes, but they aren't available…
Stratus3D
  • 4,648
  • 4
  • 35
  • 67
1
2 3 4