← Back to team overview

elementary-dev-community team mailing list archive

Re: Testing Round 2

 

Hi,

I have just subscribed to this list and saw this thread.

> satisfactory (see this:
> http://blog.remysaissy.com/2012/11/setting-up-unit-tests-in-vala-project.html);
> however, Vala's development environment is too complicated for me (a Vala

I use similar setup and am using it heavily and it works perfectly. I
reused some libgee-s AbstracTestCase and using cmake to build and run
tests coexist /w the normal app and/or shared libs in the similar
directory structure.
The output likes this:
/ValueHolderTest/null_value_test: OK
/ValueHolderTest/string_value_test: OK
/ValueHolderTest/enum_value_test: OK
...
/AspectTriggerTest/test_trigger_discard: OK
/BindingsTest/bind_aspect_adapter_test: OK

The main test program:

static int main (string[] args) {

    GLib.Test.init (ref args);

    TestSuite.get_root ().add_suite (new ValueHolderTest ().get_suite ());
     ....
     TestSuite.get_root ().add_suite (new BindingsTest ().get_suite ());

     return GLib.Test.run ();
}

And a simple test suite /w some unit tests:

public class ModelPresenterTest : AbstractTestCase {
    ...
    public ModelPresenterTest () {
        base ("ModelPresenterTest");

        add_test ("change_model_under_presenter_test",
change_model_under_presenter_test);
        add_test ("base_test", base_test);

}

public override void set_up () {
     value_holder = new ValueHolder ();
}

public override void tear_down () {
    value_holder = null;
}

public void change_model_under_presenter_test () {
....
}

> My "vision" for this experiment is that someone can set up Noise (or some
> other project) for testing, and then I (and/or other volunteers) can start
> writing a few tests for it and sort of coach the developers in TDD for the
> purpose of getting the developers to a self-sufficient state before
> potentially moving onto another project and doing the same.

I think it's a very good idea and I recommend the following post to
all of those who have never heard about nor used TDD:
http://blogs.agilefaqs.com/2011/11/01/importance-of-unit-testing-and-test-driven-development-tdd/

Also the libgee (Vala) guys are using tests heavily either.