Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implemented the runner to execute suites/tests by path#113

Merged
rlove merged 12 commits intoutPLSQL:version3from
Pazus:feature/runner
Dec 7, 2016
Merged

Implemented the runner to execute suites/tests by path#113
rlove merged 12 commits intoutPLSQL:version3from
Pazus:feature/runner

Conversation

@Pazus
Copy link
Copy Markdown
Member

@Pazus Pazus commented Nov 29, 2016

Implemented the runner to execute suites/tests by path

The path supports several formats:

  • "schema"
  • "schema":"suitepath"[."test_proc_name"]
  • "schema"."suite_package"[."test_proc_name"]

The user-freandly interface is located in ut package

Also made some refactoring with ut_test objects, put object_path property there to store fully qualified path to suite/test
object name now contains only the name of the object (package/procedure)

The path supports several formats:
* <schema>
* <schema>:<suitepath>[.<test_proc_name>]
* <schema>.<suite_package>[.<test_proc_name>]

The user-freandly interface is located in `ut` package

Also made some refactoring with ut_test objects, put object_path property there to store fully qualified path to suite/test
object name now contains only the name of the object (package/procedure)
@Pazus Pazus added this to the version3 milestone Nov 29, 2016
@Pazus Pazus self-assigned this Nov 29, 2016
@@ -1,8 +1,23 @@
create or replace type body ut_test_object is

member procedure init(self in out nocopy ut_test_object, a_desc_name varchar2, a_object_name varchar2, a_object_type integer, a_object_path varchar2 default null, a_rollback_type integer default null) is
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Placing common code in common place.

Comment thread source/core/types/ut_test_object.tpb Outdated
self.rollback_type := a_rollback_type;
end;

member procedure set_object_path(self in out nocopy ut_test_object, a_path varchar2) is
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code used? I do not see any calls to set_object_path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not any more. removed

Comment thread source/core/ut_suite_manager.pkb Outdated
lower(l_object_name);
else
l_suite_package := lower(l_object_name);
--else
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of this change (what will happen now on else)?
Do we need the commented code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope. fixed

ut_utils.gc_rollback_manual
when 'auto' then
ut_utils.gc_rollback_auto
--when 'on-error' then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove commented code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not now. this remindes about the third type of transaction control. it might became possible to implement after your changes to ut_executable

l_path varchar2(32767);
begin
if a_paths is null or a_paths.count = 0 then
raise_application_error(ut_utils.gc_path_list_is_empty, 'Path list is empty');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should run all current schema tests, if NULL or empty?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though about it but for now decided not to do it as it get much more difficult to figure out what is really called. the path will always be in form suite1.suite2.test and we have to understant wether its a suitepath of current schema ot suite1 is the schema name. Guessing mechanism is not yet implemented

Comment thread source/core/ut_suite_manager.pkb Outdated
else
for i in 1 .. a_paths.count loop
l_path := a_paths(i);
if regexp_like(l_path, '^\w+(\.\w+){0,2}$') or regexp_like(l_path, '^\w+:\w+(\.\w+)*$') then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about:

  if not( regexp_like(l_path, '^\w+(\.\w+){0,2}$') or regexp_like(l_path, '^\w+:\w+(\.\w+)*$') ) then
    raise_...
  end if;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

l_package_name := regexp_substr(l_path, '^\w+\.(\w+)(\.(\w+))?$', subexpression => 1);
l_procedure_name := regexp_substr(l_path, '^\w+\.(\w+)(\.(\w+))?$', subexpression => 3);

l_temp_suite := config_package(l_schema, l_package_name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fetch/parse the package again? We already have whole schema suites in variable in line 438.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we will have to work through the whole hierarcy looking for object_name... but maybe you are right. i'll come back to it today a bit later.

Comment thread source/core/ut_suite_manager.pkb Outdated
end;
end if;

if regexp_like(l_path, '^\w+:.+$') then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be elsif?


validate_paths(l_paths);

-- current implementation operates only on a single path
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to extract the find/filter logic into separate procedure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel such separation won't work for multiple pathes provided as be each next path you won't simply add new object to the list, rather you will enable objects in current list to execute... I'd like to postepone this refactoring a bit until it became clear for multi-path approach. But I agree it is needed

end loop;

if l_objects_to_run.count > 0 then
l_reporter.before_run(a_suites => l_objects_to_run);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.
Now we pass the full list of objects to execute to the before/after calls.

@jgebal
Copy link
Copy Markdown
Member

jgebal commented Nov 29, 2016

Resolves #86

@jgebal jgebal mentioned this pull request Nov 30, 2016
jgebal
jgebal previously requested changes Nov 30, 2016
Copy link
Copy Markdown
Member

@jgebal jgebal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add few basic unit tests for the runner?

  • with schema
  • with schema:suite
  • with schema:suite.test
  • with schema:suite.suite
  • with schema:suite.suite.test
  • with schema.package
  • with schema.package.test

@Pazus
Copy link
Copy Markdown
Member Author

Pazus commented Dec 6, 2016

Added tests

@rlove rlove dismissed jgebal’s stale review December 7, 2016 19:24

Problems are now resolved.

Copy link
Copy Markdown
Contributor

@rlove rlove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good.

@rlove rlove merged commit 1470e1e into utPLSQL:version3 Dec 7, 2016
@rlove rlove removed the in progress label Dec 7, 2016
@Pazus Pazus deleted the feature/runner branch July 15, 2017 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants