Before anything else, you need a testing plan. This basically declares how many tests your script is going to run to protect against premature failure:
- The preferred way to do this is to declare a plan by calling the plan () function for tests; if you only have one test, then you will call SELECT plan(1), but if you intend to implement n tests, you will declare SELECT plan(n):Â
SET search_path TO pgTAP;
SELECT plan(1);
SELECT is_empty('select "ID" from public."ATM locations" where "ZipCode" NOT IN (select "zip" from public."Zip coordinates") LIMIT 1;', 'Check if there are any Bank ZipCodes not included in Zip coordinates table');
SELECT * FROM finish();
- The preceding SQL code is a test to see whether there are any bank ZIP codes inside the ATM locations table that are not found in the ZIP coordinates table, hence we execute that code from pgAdmin:
Figure 11.2 –...