3 Replies Latest reply on Nov 3, 2014 8:11 AM by Flofe

    Problem with Unit Test

    Flofe

      What am I doing wrong?

       

      I set up a little example procedure to test the variable substitution feature within the unit testing framework.

      Documentation: SQL Developer: Unit Testing

       

      create or replace procedure SimpleTestProcedure( param1 in varchar2 ) as

      begin

        null;

      end SimpleTestProcedure;

      /

       

      Setup test with following configuration:

       

      Input value: Test

      Process Validation: Boolean function

       

      declare

      param varchar2(4 char);

      begin

      param := :param1;

      if '{param1}' != param then

        return false;

      end if;

      end;

       

      UnitTestScreenshot.png

      Ends up in following message after running test:

      UnitTestMessageScreenshot.png

      I'm using SQL Developer Version 4.0.3.16.

       

      Any help would be appreciated!

      Regards.

        • 1. Re: Problem with Unit Test

          Ok - I, for one, don't understand your 'test'

           

          You created a procedure but you don't show any test that executes it. And the validation code doesn't refer to it either.

           

          Start over and explain, in English, what your test is supposed to be testing.

          • 2. Re: Problem with Unit Test
            val.2046

            Hi Flofe,

             

            It looks like the Boolean function as a process validation does not take parameters as a "generic" pl/sql function could... it is probably called "function" only because it returns a value as any function does. But you can use parameter substitutions of the parameters for the stored procedure you are testing, which you already do.

             

            So, try to modify your code to:

             

            declare

              param varchar2(8);

            begin

            param := '{param1}';

            if '{param1}' != param then

              return false;

            else

              return true;

            end if;

            end;

             

            And it should work for you little try out test...

             

            Hope this helps...

             

            Val

            • 3. Re: Problem with Unit Test
              Flofe

              Test succeeded. Thank you Val.

              Seems my English is not as bad as rp0428 thought

               

              @rp0428

              I forgot to mention that the only purpose of the procedure was getting an opportunity to create a unit test. Sorry. Could be misleading.

               

              Regards.