What is the best way to generate test cases for erlang applications?

200 Views Asked by At

Now I'm engaged in creating test cases for application writing on Erlang. I use common-test for it. This tool is useful and suits me. But most of the tests have the same structure and sometimes contain the same code. So, I have a lot of 'copy/paste'. It's not good. Would like to optimize my work. Probably, somebody had the same problem and found a solution. Please, help me!

2

There are 2 best solutions below

0
On

Two possible solutions:

  • Refactor your test code so that the common structure is a separate function that is reused by each test. Wrangler can help you refactor any Erlang code automatically, including tests.
  • Switch over to EUnit so that you can use Test generating functions.
2
On

EUnit http://www.erlang.org/doc/apps/eunit/chapter.html

QuviqCheck - http://www.quviq.com/products/erlang-quickcheck/ - Good introduction can be found here: http://roberto-aloi.com/erlang/notes-on-erlang-quickcheck/

ProPer https://github.com/manopapad/proper/ - is a QuickCheck-inspired open-source property-based testing tool for Erlang