Skip to content

Populate default utPLSQL code templates #35

Closed
@PhilippSalvisberg

Description

@PhilippSalvisberg

Oracle SQL Developer's code template are a good way to support test-first approach.

Managing code template is a responsibility of SQL Developer. However, it would be nice if the utPLSQL extension could install a default set of templates, e.g. via a button in its preference dialog.

The following code templates should be installed:

ut_spec_proc - Test Procedure Skeleton in Package Specification

--%test
PROCEDURE [procedure_name];

ut_body_proc - Test Procedure Skeleton in Package Body

--
-- test ... case ...: ...
--
PROCEDURE [procedure_name] IS
   l_actual   INTEGER := 0;
   l_expected INTEGER := 1;
BEGIN
   -- populate actual
   -- ...

   -- populate expected
   -- ...

   -- assert
   ut.expect(l_actual).to_equal(l_expected);
END [procedure_name];

ut_spec - Full Test Package Specification Skeleton

CREATE OR REPLACE PACKAGE test_[package_name] IS

   --%suite(...)
   --%suitepath(alltests)
   
   --%context([procedure_name])

   --%test
   PROCEDURE [procedure_name_1];

   --%test
   PROCEDURE [procedure_name_2];

   --%endcontext

END test_[package_name];
/

ut_body - Full Package Body Skeleton

CREATE OR REPLACE PACKAGE BODY test_[package_name] IS

   --
   -- test ... case 1: ...
   --
   PROCEDURE [procedure_name_1] IS
      l_actual   INTEGER := 0;
      l_expected INTEGER := 1;
   BEGIN
      -- populate actual
      -- ...

      -- populate expected
      -- ...

      -- assert
      ut.expect(l_actual).to_equal(l_expected);
   END [procedure_name_1] ;

   --
   -- test ... case 2: ...
   --
   PROCEDURE [procedure_name_2] IS
      l_actual   INTEGER := 0;
      l_expected INTEGER := 1;
   BEGIN
      -- populate actual
      -- ...

      -- populate expected
      -- ...

      -- assert
      ut.expect(l_actual).to_equal(l_expected);
   END [procedure_name_2];

END test_[package_name];
/

Activity

added this to the v0.5.0 milestone on Oct 16, 2018
added a commit that references this issue on Oct 16, 2018

Merge pull request #36 from PhilippSalvisberg/develop

457c79b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @PhilippSalvisberg

      Issue actions

        Populate default utPLSQL code templates · Issue #35 · utPLSQL/utPLSQL-SQLDeveloper