Toad World® Forums

Testing different package states


#1

I got a probably strange test requirement which I do not know if it could be handled with codetester. My package functions depends on the state (values of package variables) of the package.

I need to test the the same package with different states. However, to compare the same function with two different package states codetester would have to use separate connections for each “test side”.

How would I do this with codetester?


#2

Here’s one approach you can take: in the expected values of your outcomes, instead of checking for a literal, like “a”, you could check for an expression along these lines:

CASE USER
WHEN ‘HR’ THEN ‘abc’
WHEN ‘SCOTT’ THEN ‘def’
END

and this way depending on which schema you are connected into when you run the test, you will test for different results.

Then…

  1. Grant execute on the test package to all schemas from which you want to run your test.

  2. Grant execute on the code you want to test to all schemas from which you want to run your test.

  3. Connect to each schema with CT, change the schema selector in the toolbar to the owner of the program being tested. Then run the test.

Let me know what you think. Sorry about the delay in responding.

SF