Re: [Vala] Adding unitary test support to Autovala
- From: Alessandro Pellizzari <alex amiran it>
- To: <vala-list gnome org>
- Subject: Re: [Vala] Adding unitary test support to Autovala
- Date: Tue, 18 Nov 2014 09:44:52 +0000
On 2014-11-17 22:07, rastersoft wrote:
The first one is how to define each unitary test; my original idea
was: "one file, one test", so inside a folder called "unitests" will
be as many .vala files as unitary tests (even in subfolders). But
then
I considered that, maybe, some tests are so big that needs several
files, in which case the way to go would be "one folder, one test",
and all the .vala files inside should belong to the same test. Which
one is the best approach?
If a unit test requires more than one file, it's not a unit test
anymore.
A unit test just tests one specific function, possibly in one specific
scenario.
I would organize your tests directory like this:
tests/
|- unit/
| |- FirstClassTest.vala
| |- SecondClassTest.vala
| |- ...
|- functional/
| |- FirstFeatureTest.vala
| |- ...
|- integration/
| |- FirstIntegrationCaseTest.vala
| |- ...
In FirstClassTest.vala you will have all the unit tests regarding
FirstClass.
In FirstFeatureTest you will have all the functional tests regarding a
class feature (using multiple functions from the same class), to test
state and stuff like that.
In FirstIntegrationCaseTest you will test integration between different
classes in your project.
The second one is if I should always compile the tests, or do it only
if the user sets an specific flag when calling cmake (thus, people
just downloading the source and compiling at home wouldn't need to
compile everything).
Tests should be compiled and run independently from the code, so I
would just create a
make tests
that compiles and runs them. Do not compile them on a normal make.
Bye.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]