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

Reporting 0% coverage incorrectly #35

Closed
adamretter opened this issue Jun 27, 2014 · 7 comments
Closed

Reporting 0% coverage incorrectly #35

adamretter opened this issue Jun 27, 2014 · 7 comments

Comments

@adamretter
Copy link

I am on the latest from the v2.1 branch.

I have a test which imports a module like -

import module namespace val = "urn:iddn:modules:validate" at "../../xquery/lib-core/validation.xqy";

However, when asking for the code coverage of /xquery/lib-core/validation.xqy, XRay reports that there was 0% code coverage which is incorrect. If I try and ask for the code coverage of ../../xquery/lib-core/validation.xqy then XRay throws an invalid coercion error.

I am guessing that somewhere in XRay the module paths that are used need to always be resolved to absolute database paths when it is assessing the code-coverage of an imported module, and that this is not happening at the moment?

@mblakele
Copy link

Adam, I'm trying to reproduce this problem but so far I can't. Maybe you can help me see where I've oversimplified, or otherwise gone wrong?

  • I'm using branch v2.1, last commit d1bea53
  • I'm testing /?dir=test&modules=coverage.xqy&tests=&format=html&coverage-module=/test/utils.xqy

The test/coverage.xqy module is:

xquery version "1.0-ml";

module namespace test = "http://github.com/robwhitby/xray/test";

import module namespace assert="http://github.com/robwhitby/xray/assertions"
  at "/xray/src/assertions.xqy" ;

import module namespace utils="utils" at "../test/utils.xqy" ;

declare %test:case function import-ok()
{
  assert:equal(
    utils:upper('fubar'), 'FUBAR')
};

(: xray/test/coverage.xqy :)

So I'm using a relative import in the test module, and from your description that sounds like the important bit. However with this setup I expect to see 50% coverage, and that's exactly what I see.

Any idea where our tests diverge?

@adamretter
Copy link
Author

Michael, I am afraid I am no longer working on the project that used Marklogic and XRay, however I know that it is still in use and desirable to get this fixed. I will contact the tech lead there and see if he wants to pursue this and ask him to reply here. If they are not interested, I will reply and close thus ticket.

@robwhitby
Copy link
Owner

I just tried this on osx with modules on filesystem and in db and both worked as Michael described, but I suspect there's an issue with the combination of windows and filesystem modules.

@adamretter
Copy link
Author

@mblakele I heard back from the tech lead of the project I was involved with, he will comment about the issue here in the next day or so...

@alexhillsre
Copy link

I'm from the project Adam is working on, I suspect Rob is right.
Using the same module as Adam used originally, if the file import becomes

import module namespace val = "urn:iddn:modules:validate" at "/xquery/lib-core/validation.xqy";
Then it will give a code coverage of 7%, as it should.

If it helps, when returned to ../../xquery/lib-core/validation.xqy, both wanted and covered code is null.

Moving the file up, so ../xquery/lib-core/validation.xqy works also shows 0% coverage.

As Adam said, If I try and ask for the code coverage of ../../xquery/lib-core/validation.xqy (with the file in the original location) then XRay throws an invalid coercion error. as below:

XDMP-AS: (err:XPTY0004) modules-db:get-module(if ($is-absolute) then $module-path else modules-db:resolve-path($module-path)) -- Invalid coercion: () as xs:string

@mblakele would you be able to test it on a windows environment?

Would you have any suggestions to further help you duplicate or understand the issue?

@mblakele
Copy link

Alex, is that the full error message? If there's a stack trace I'd like to see it.

Is this app-server using filesystem modules or a modules database? From the error message it looks like a modules database, but I'd like to confirm that.

Can you tell me what the Windows app-server root directory path is?

Can you provide the MarkLogic data directory path for that MarkLogic install? This is the full path to the directory where MarkLogic keeps its log files and private forests. The default is c:\Program Files\MarkLogic\Data but it can be just about anywhere.

Feel free to anonymize project names, etc. In both cases I'm interested in the pattern of backslashes, slashes, and whitespace.

@alexhillsre
Copy link

That is the full error message, it's the same message when it can not find a file.

With your advice I had a look into this in the modules database, the reason for it failing is due to the nature to where validation.xqy (among others with similar faults) is located. In our case, /xquery/lib-core/validation.xqy does exist, and hence without the relative path it works as code coverage points to the same file. With the relative path, ../../xquery/lib-core/validation.xqy actually refers to /test-targets/core-xquery/xquery/lib-core/validation.xqyand so changing to ask for code coverage at this location worked absolutely fine.

Thanks for the help on the issue, @adamretter the issue can now be closed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants