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 — Ability to run expectations without test by jgebal · Pull Request #963 · utPLSQL/utPLSQL

Conversation

@jgebal

@jgebal jgebal commented Jul 2, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Added ability to run expectations without tests

Expectation, when executed without test, reports results straight to dbms_output.

So it is now possible to execute:
exec ut.expect(1).to_equal(0);

And get result:

FAILURE
  Actual: 1 (number) was expected to equal: 0 (number)

Resolves #956

Improvements to application_info in v$session

utPLSQL is now cleaning up the application_info after run. The module_name, action, client_info` are restored to it's original values after test run. Resolves #951

The following attributes are set in v$session when test suite is running:

  • module_name - set to utPLSQL
  • action - name of currently executing test suite package
  • client_info name of test executable procedure (before.../after.../test) that is currently running

Setting session context during run

It is now possible to access some of utPLSQL info within the test procedures directly.
Resolves #781

The information is provided in sys_context( 'UT3_INFO', attribute ).

Following attributes are getting populated:

  • Always:

    • sys_context( 'UT3_INFO', 'RUN_PATHS' ); - list of suitepaths / suitenames used as input parameters for call to ut.run(...) or ut_runner.run(...)
    • sys_context( 'UT3_INFO', 'SUITE_DESCRIPTION' ); - the description of test suite that is currently being executed
    • sys_context( 'UT3_INFO', 'SUITE_PACKAGE' ); - the owner and name of test suite package that is currently being executed
    • sys_context( 'UT3_INFO', 'SUITE_PATH' ); - the suitepath for the test suite package that is currently being executed
    • sys_context( 'UT3_INFO', 'SUITE_START_TIME' ); - the execution start timestamp of test suite package that is currently being executed
    • sys_context( 'UT3_INFO', 'CURRENT_EXECUTABLE_NAME' ); - the owner.package.procedure of currently running test suite executable
    • sys_context( 'UT3_INFO', 'CURRENT_EXECUTABLE_TYPE' ); - the type of currently running test suite executable (one of: beforeall, beforeeach, beforetest, test, aftertest, aftereach, afterall
  • When running in suite context

    • sys_context( 'UT3_INFO', 'CONTEXT_DESCRIPTION' ); - the description of test suite context that is currently being executed
    • sys_context( 'UT3_INFO', 'CONTEXT_NAME' ); - the name of test suite context that is currently being executed
    • sys_context( 'UT3_INFO', 'CONTEXT_PATH' ); - the suitepath for the currently executed test suite context
    • sys_context( 'UT3_INFO', 'CONTEXT_START_TIME' ); - the execution start timestamp for the currently executed test suite context
  • When running a suite executable procedure that is a test or beforeeach, aftereach, beforetest, aftertest

    • sys_context( 'UT3_INFO', 'TEST_DESCRIPTION' ); - the description of test for which the current executable is being invoked
    • sys_context( 'UT3_INFO', 'TEST_NAME' ); - the name of test for which the current executable is being invoked
    • sys_context( 'UT3_INFO', 'TEST_START_TIME' ); - the execution start timestamp of test that is currently being executed (the time when first beforeeach/beforetest was called for that test)

Call stack enchancements

utPLSQL will now provide full call stack within the context of the test, not only the stack line where expectation was called.
To minimize overhead on test execution, stack is provided only when expectation fails.

Resolves #967

Improved functionality of reporters

Reporters will now support inline calls for data-retrieval.
References #955

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jgebal jgebal added the enhancement label Jul 2, 2019
jgebal added 2 commits July 3, 2019 20:14
@jgebal
[WIP] Ability to run expectations without test
f5fa468
> TODO - documentation updates

Added ability to run expectations without tests.
Expectation, when executed without test is reporter straight to dbms_output.
So it is now possible to execute:

`exec ut.expect(1).to_equal(0);`

And get result:

```
FAILURE
  Actual: 1 (number) was expected to equal: 0 (number)
```

Resolves #956

Additionally:
- utPLSQL is now cleaning up the application_info after run.
- utPLSQL is setting session context during run, making it possible to access some of utPLSQL info within the test procedures directly.

Resolves #781

The information is provided in sys_context(`UT3_INFO`,...).

Following attributes are getting populated:
- Always:
    - RUN_PATHS
    - SUITE_DESCRIPTION
    - SUITE_PACKAGE
    - SUITE_PATH
    - SUITE_START_TIME
    - CURRENT_EXECUTABLE_NAME
    - CURRENT_EXECUTABLE_TYPE

- When running in suite context
    - CONTEXT_NAME
    - CONTEXT_PATH
    - CONTEXT_START_TIME
- After first executable in suite
    - TIME_IN_SUITE
- After first executable in suite context
    - TIME_IN_CONTEXT
- When running a test or before/after each/test
    - TEST_DESCRIPTION
    - TEST_NAME
    - TEST_START_TIME
- After first executable in test
    - TIME_IN_TEST
@jgebal
Removed time_in_suite, time_in_context, time_in_test as they ar…
99bae42
…e of low value and could bing confusion.
@jgebal
jgebal force-pushed the featrure/add_session_context branch from e172d40 to 99bae42 Compare July 3, 2019 20:17
jgebal added 5 commits July 8, 2019 01:09
@jgebal
- Fixed minor typos, formatting and issues with expectation results.
d932f75
- Changed how stack trace is reported on expectations to provide more information to the user.
- Fixed expectation messages for successful results
- moved `to_be_empty` / `not_to_be_empty` to base `ut_expectation` type as it's available for `clob`/`blob` types too.
- added-back grant on `ut_matcher` to allow for passing various matchers by users.
- fixed issue with misleading message: `All rows are different as the columns position is not matching` when comparing a null collection/cursor
{WIP] Updates to documentation for expectations.
@jgebal
Fixing failing test.
2206ff9
@jgebal
Updated documentation for expectations.
1ea69d8
@jgebal
Improved functionality of reporters to allow for inline calls.
773eae2
References #955
@jgebal
Added documentation section on sys_context( 'UT3_INFO', attribute ).
ac4ca00
@jgebal jgebal added this to the v3.1.8 milestone Jul 13, 2019
@jgebal jgebal changed the title [WIP] Ability to run expectations without test Ability to run expectations without test Jul 13, 2019
@jgebal
jgebal requested review from PhilippSalvisberg, lwasylow and pesse July 13, 2019 03:32
@jgebal
jgebal merged commit 2c70231 into develop Jul 13, 2019
@jgebal
jgebal deleted the featrure/add_session_context branch July 14, 2019 23:07
@jgebal jgebal mentioned this pull request Jul 15, 2019
Wrong result for has_suite and is_suite when suite annotation is missing #976
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lwasylow lwasylow Awaiting requested review from lwasylow
@pesse pesse Awaiting requested review from pesse
@PhilippSalvisberg PhilippSalvisberg Awaiting requested review from PhilippSalvisberg

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement

Projects

None yet

Milestone

v3.1.8

Development

Successfully merging this pull request may close these issues.

Provide more stack info on failed expectations Add ability to get expectation results without test-suite Session application context is not reset after utPLSQL run Internal variable that stores test case name

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jgebal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.