Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate default utPLSQL code templates #35

Closed
PhilippSalvisberg opened this issue Oct 16, 2018 · 0 comments
Closed

Populate default utPLSQL code templates #35

PhilippSalvisberg opened this issue Oct 16, 2018 · 0 comments
Assignees
Milestone

Comments

@PhilippSalvisberg
Copy link
Member

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];
/
@PhilippSalvisberg PhilippSalvisberg added this to the v0.5.0 milestone Oct 16, 2018
@PhilippSalvisberg PhilippSalvisberg self-assigned this Oct 16, 2018
PhilippSalvisberg added a commit that referenced this issue Oct 16, 2018
#35 - Create code templates in preference dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant