GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update code templates using AAA · Issue #145 · utPLSQL/utPLSQL-SQLDeveloper

Update code templates using AAA #145

New issue
Copy link
New issue
Copy link
Closed
#152
Closed
Update code templates using AAA#145
#152
Copy link
Assignees
PhilippSalvisberg
Labels
enhancement
Milestone
v1.4.0

Description

@PhilippSalvisberg
PhilippSalvisberg
opened on Feb 25, 2022
Issue body actions

The current code template for the PL/SQL package body looks like this (test_ is the default prefix):

CREATE OR REPLACE PACKAGE BODY test_[package_name] IS

   --
   -- test
   --
   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];

END test_[package_name];
/

The body is grouped into three steps. Firstly, populate actual. Secondly, populate expected. Thirdly, assert.

Instead of these three steps the Arrange-Act-Assert pattern should be used. It's popular in Unit testing.

The new template should look like this:

create or replace package body test_[package_name] is

   --
   -- test
   --
   procedure [procedure_name] is
      l_actual   integer := 0;
      l_expected integer := 1;
   begin
      -- arrange
      -- ...
      
      -- act
      -- ...
   
      -- assert
      ut.expect(l_actual).to_equal(l_expected);
   end [procedure_name];

end test_[package_name];
/

The other template should be changed accordingly.

Activity

  1. PhilippSalvisberg
    self-assigned this
    on Feb 25, 2022
  2. PhilippSalvisberg
    added
    enhancement
    on Feb 25, 2022
  3. PhilippSalvisberg
    added this to the v1.4.0 milestone on Feb 25, 2022
  4. PhilippSalvisberg
    added 3 commits that reference this issue on Feb 27, 2022

    generate lowercase code in RunGenerator #145

    0fcfb61

    user AAA pattern and lowercase code in oddgen TestTemplate #145

    d8faf5a

    user AAA pattern and lowercase code in SQLDev code templates #145

    362af12
  5. PhilippSalvisberg
    closed this as completedin #152on Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @PhilippSalvisberg
    PhilippSalvisberg

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    • v1.4.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.