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

Plugin should only generate procedure test for procedures with test anotation #59

Closed
tkleiber opened this issue Mar 29, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@tkleiber
Copy link

It seems, that the plugin generate procedure calls from the editor if I'm after the first line (where the package name is) for the next found procedure definition.

If this has not a test annotation this leads to annoying errors, see
utPLSQL/utPLSQL#884

I think it should only generate a procedure test, when I'm on a procedure with a test anotation and else the package test.

@PhilippSalvisberg
Copy link
Member

Hello @tkleiber.

First of all thank you for taking the time to report the issue.

An editor or worksheet can have different states. The main ones are:

  • Connected (a connection name is selected in the upper right corner of the editor window)
  • Not connected (no connection is selected in the upper right corner of the editor window)

When the editor is connected, the SQL Developer extension can ask the utPLSQL annotation API, if a procedure is a known test. Only test procedures can be chosen for execution.

However, when the editor is not connected, then the logic applies as you have described it. You may argue that for the package specification the extension could still find out what to run, but in this case we would have to reimplement what the utPLSQL core already does, and we'd like to avoid that. But that's not possible for a package body.

I hope this explains the current behaviour.

Thanks,
Philipp

@tkleiber
Copy link
Author

tkleiber commented Apr 9, 2019

My package editor is connected.

I think you missunderstood my problem, so I will summarize it here again.

The first procedure, which is found after the package declaration (run the test from line of the example) is annotated not with %test but with %beforeeach or with %aftereach. Your plugin seems not to make an difference between the annotations, and if the user does not check the generated code immediatly he search long for the root cause of this error:

EXECUTE ut.run('DEMO.test_betwnstr.setup');
And this gives following error:

`
ORA-06512: at "UT3.UT_SUITE_MANAGER", line 680
ORA-06512: at "UT3.UT_RUNNER", line 150

ORA-20204: Suite test DEMO.test_betwnstr.setup does not exist
ORA-06512: at "UT3.UT_SUITE_MANAGER", line 680

Error starting at line : 2 in command -
BEGIN ut.run('DEMO.test_betwnstr.setup'); END;
Error report -
ORA-20204: Suite test DEMO.test_betwnstr.setup does not exist
ORA-06512: at "UT3.UT_RUNNER", line 163
ORA-06512: at "UT3.UT_SUITE_MANAGER", line 680
ORA-06512: at "UT3.UT_RUNNER", line 150
ORA-06512: at "UT3.UT", line 126
ORA-06512: at "UT3.UT", line 427
ORA-06512: at "UT3.UT", line 538
ORA-06512: at line 1
`

See the example package here: test_betwnstr.zip

@PhilippSalvisberg
Copy link
Member

Thank you @tkleiber for the clarification. - Now I can reproduce the problem. I will analyze it later.

@PhilippSalvisberg
Copy link
Member

Issue happens only when in the Preferences the Check availability of "Run utPLSQL test" menu option? is unchecked. In this case the behaviour of and connected and unconnected editor is the same. The utPL/SQL annotation API is never called.

In this case, the annotation API should be called, even on large schemas. It might lead to a delay until the test is started, but this should be acceptable for most cases.

However, when the annotation cache is empty, the start of the test might be delayed for a very long time (minutes). With the current behaviour it is clear, that the anonymous block in the newly opened worksheet is responsible for the delay. When changing it we have to inform the user somehow that the annotation API is read, so that it is clear that the SQL Developer session is doing something in the background. Maybe we should introduce an additional option in the preferences such as use utPLSQL annotation API?.

So I consider this still a bug. - I'd go with the easiest option for now. Reading the annotation API. Even on large schemas.

@PhilippSalvisberg PhilippSalvisberg added this to the v1.0.0 milestone Apr 28, 2019
PhilippSalvisberg added a commit that referenced this issue Apr 28, 2019
FIX #59 - always determine executable tests via annotation API before executing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants