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

Issue In XUnit Reporter GetPath #547

Closed
lwasylow opened this issue Jan 3, 2018 · 1 comment
Closed

Issue In XUnit Reporter GetPath #547

lwasylow opened this issue Jan 3, 2018 · 1 comment
Labels
Milestone

Comments

@lwasylow
Copy link
Member

@lwasylow lwasylow commented Jan 3, 2018

I believe there is an issue in getpath expression in ut_xunit_reporter.
It uses a substring which can result in negative positive.
E.g. Package is named "ut_gen_pk_id_api" and annotation for suitepath is alltests

CREATE OR REPLACE PACKAGE ut_test.ut_generate_pk_id_api IS

--%suitepath(alltests)
--%suite(generate_primary_key)
--%displayname(Generate PK Function Suite)

--%test(ut_generate_pk_id)
--%displayname(Generate PK Function Test)
PROCEDURE ut_generate_pk_id;

END ut_generate_pk_id_apii;
/

When running that it reports a classname in xunit as : 'alltest' rather than 'alltests.ut_gen_pk_id_api'

Would not be better to replace

return substr(a_path_with_name, 1, instr(a_path_with_name, '.' || a_name) - 1);
with
substr(a_path_with_name, 1, regexp_instr(a_path_with_name, '.' || a_name||'$') - 1)

@jgebal
Copy link
Member

@jgebal jgebal commented Jan 4, 2018

You are referring to a use-case where test package name is like '%test procedure name%'

I think your regex pattern was is missing \ before the dot.

select a_path_with_name,
        regexp_substr(a_path_with_name, '(.*)\.' ||a_name||'$',1,1,'',1),
        substr(a_path_with_name, 1, regexp_instr(a_path_with_name, '\.' || a_name||'$') - 1),
        substr(a_path_with_name, 1, instr(a_path_with_name, '.' || a_name) - 1)
  from (select 'alltests.ut_generate_pk_id_api.ut_generate_pk_id' a_path_with_name, 'ut_generate_pk_id' a_name from dual);

Maybe we can just use:
return regexp_substr(a_path_with_name, '(.*)\.' ||a_name||'$',subexpression=>1)

It is a bug indeed.

Can you fix it and create a PR for it?

@jgebal jgebal added the bug label Jan 4, 2018
@jgebal jgebal added this to the v3.0.5 milestone Jan 4, 2018
@jgebal jgebal closed this Jan 4, 2018
@jgebal jgebal modified the milestones: v3.0.5, v3.1.0 Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants