Changes between Version 1 and Version 2 of Obsolete/Development/Code/TestingComponents


Ignore:
Timestamp:
Apr 23, 2012, 9:31:44 PM (14 years ago)
Author:
munoz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Obsolete/Development/Code/TestingComponents

    v1 v2  
    119119=== Testing the `Configure` method ===
    120120
    121 This method should have almost no logic. But it still deserves some testing. It must receive a valid `EDG::CCM::Configuration` object from a profile. And handling this is done by `Test::Quattor`.
     121This method should have almost no logic. But it still deserves some testing. It must receive a valid `EDG::CCM::Configuration` object from a profile. And handling this is done by `Test::Quattor`. This is how we do it:
     122
     1231. We have a set of test profiles. They are minimalistic, and have no dependencies on any "standard" templates. Just assign a few values to fill in your component structure. For instance:
     124{{{
     125#!sh
     126object template test_profile;
     127
     128prefix "/software/components/foo";
     129"a" = 1;
     130"b" = 2;
     131}}}
     1321. This profile must be compiled, and a cache must be created for it. The `Test::Quattor` comes in hand here: If you pass any arguments to it, it will compile them and prepare the correct cache:
     133{{{
     134#!perl
     135use Test::Quattor qw(test_profile another_test_profile);
     136}}}
     1371. And then, you'll want it to serve you the configuration for some of these, right?
     138{{{
     139#!perl
     140my $config = get_config_for_profile("test_profile");
     141}}}
     1421. And now, you can just run `Configure` on it:
     143{{{
     144#!perl
     145$comp->Configure($config);
     146}}}
     147
     148And test whatever you need to test. Simple, right?