A litle Big Moose forward

It carry on testing developing day here in the Moose-Pen.

I left off yesterday with a new Test::Utils->sql_param_ok sub that is going to save a good deal of coding effort as I move forward once I get all the tests up to the new standard of curse, (one foot forward one and a half steps back)

Today I am going to carry on with alias testing this time I am checking basic field alias. To accomplish this I changed the 'elements' in my $in_hash to ones with field aliases;


$in_hash->{elements}= [
{
name => 'last_name',
alias=> 'last'
},
{
name => 'first_name',
alias=> 'first'
},
];

Next I want to change only the 'retrieve' test a little by update the sql like this

$tests->[0]->{retrieve}->{sql}="SELECT sys_users.last_name AS last, sys_users.first_name AS first FROM people sys_users";

to one that expects the SQL keyword 'AS' followed by the 'alias'. Then I just just the same test again and finally I change the caption of the tests so I can tell them apart and I run my test;

...
$tests->[0]->{caption} = "Basic field alias";
$utils->sql_param_ok($in_hash,$tests);

and I get

… ok 6 - Basic table alias delete SQL correct ok 7 - Basic Field alias create SQL correct ok 8 - Basic Field alias create params correct ok 9 - Basic Field alias retrieve SQL correct ok 10 - Basic Field alias update SQL correct ok 11 - Basic Field alias update params correct ok 12 - Basic Field alias delete SQL correct
so that was easy.

Now the hard part putting together a more extensive test suite. I did sort of bounce about a bunch when I was initially putting it together and now the very early tests are testing params which I originally started testing much later. Since I have some major test re-writing I might as well get things in a more orderly format.

So I will keep '15_alias.t' where it is now, but '20_where_basic.t' is not in the right place. I think I will test the fields and params first then move on to the 'Where' clause. So in the end what I will have is

  • 15_alias.t
  • Tests the table and field alias basic params
  • 20_fields.t
  • Tests the various fields, element, param, expression, and function
  • 25_exe_array.t
  • Tests the execute array of params

Then I think I will move onto the other clauses. So I guess it is just a postette for today.

sa81-13.jpg

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations