MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Asking for some help...



Hi All,

(Note: I know this may be not something everyone wants to do, so if
it bores you, just ignore it. But I have always found that there are
a few gearheads that like this kind of stuff...)

I have written hundreds of tests for MiniVend, but I cannot test
everything (because I can't think of everything!)

Here is my test methodology:

	1. I concoct a minivend tag sequence and figure what it should give. That
	goes in the "input" field of a database.

	2. I put what I expect in the "expected" field -- this is a perl regular
	expression.

	3. If I don't expect something, like the string ERROR, then I put it in
	the "no_expect" field of the database.

	4. Then I run this page on the database:
<XMP>
[loop search="
            st=db
            fi=tests
            tf=0
            ra=yes
            rf=0
            ml=1000
        "][harness name="[loop-code]"][expected][loop-data tests expected][/expected][not][loop-data tests no_expect][/not][loop-data tests input][/harness]
[/loop]

The harness tag is thus:

UserTag harness PosNumber 0
UserTag harness addAttr
UserTag harness hasEndTag
UserTag harness Routine <<EOR
my $Test = '0001';
sub {
	my ($opt, $input) = @_;
	my $not;
	my $expected =  $opt->{expected} || 'OK';
	$input =~ s:^\s+::;
	$input =~ s:\s+$::;
	$input =~ s:\s*\[expected\](.*)\[/expected\]\s*::s
		and $expected = $1;
	$input =~ s:\[not\](.*)\[/not\]::s
		and $not = $1;
	my $name = $Test++;
	$name = $opt->{name}
		if defined $opt->{name};
	my $result;
	eval {
		$result = Vend::Interpolate::interpolate_html($input);
	};
	if($@) {
		my $msg = "DIED in test $name. \$\@: $@";
		::logDebug($msg);
		return $msg;
	}
	if($expected) {
		return "NOT OK $name: $result!=$expected" unless $result =~ /$expected/;
	}
	if($not) {
		return "NOT OK $name: $result==$not" unless $result !~ /$not/;
	}
	return "OK $name";
}
EOR

Then basically, I have a database that is like the following (in the
little-known %% format ):

code
%%
input
%%
expected
%%
no_expect
%%
source
%%%
A00001
%%
[tag op=time]%D[/tag]
%%
\d\d/\d\d/\d\d
%%

%%

%%%
A00002
%%
[set mv_no_count]1[/set]
[set mv_no_session_id]1[/set]
This should NOT have a session id and count [area test]
%%
^[^?]+$
%%

%%

etc, etc, ad nauseum, for hundreds of tests.

What I need are the data for tests, i.e. something like:

code: (blank, I now use the new autonumbering in MV4)
input: [value name=minivend set=something hide=1]
expected: ^$
no_expect: .+
source: put your name here so you can get credit

If a few people can send me little five-liners like these, perhaps based on
things that have given them trouble in the past, I would much appreciate
it. It would also help make MV4 better, as the more thorough the testing
the less likely there will be nasty surprises... 8-)

All in all, I am quite excited about the new MV. It should be hitting the
beta directory RSN, as it is passing most every test. 

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
                                    131 Willow Lane, Floor 2  | ||  _ \
It's a little-known fact            Oxford, OH  45056         | || |_) |
that the Y1K problem caused         <mikeh@minivend.com>     |___|  _ <
the Dark Ages. -- unknown           513.523.7621 FAX 7501        |_| \_\


Search for: Match: Format: Sort by: