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

Wrong filepath in resulting report #11

Open
AllDmeat opened this issue Dec 14, 2023 · 0 comments
Open

Wrong filepath in resulting report #11

AllDmeat opened this issue Dec 14, 2023 · 0 comments

Comments

@AllDmeat
Copy link

AllDmeat commented Dec 14, 2023

I've noticed that my report has invalid paths of test files. A few examples:

  • <file path=""> — empty
  • <file path="./E2ETests/Tests/Loyalty/LoyaltyTests.swift"> — wrong file path

I've looked at source junit report and it's valid.

So I've checked code at lib/fastlane/plugin/forsis/helper/forsis_helper.rb and found what's wrong:

file_name = `echo #{test_file["name"]}| cut -d'.' -f 2`.gsub(/\n/, '')

You're taking test suite name, not file name here. Test suite name is more like a module name.

For example, my project has module named LoyaltyTests. So in my junit I have following:

<testsuite name="LoyaltyTests" tests="75" failures="0" time="1.3807013034820557">
    <testcase classname="ExpirationInfoCellViewSnapshotTests" name="test_snapshots()" time="0.10303997993469238">
        </testcase>
    ....
</testsuite>

Let's return to the helper. Next line you look for path to that file:
file_path = get_test_file_path(file_name).

But as I've said before you're using module name instead of a real file name. So there're two possible outcomes:

  • You won't find such a file
  • You will find some file just by coincidence, but that's not gonna be the real test file.

You can suggest it's better to use classname of a testcase, not name of a testsuite, but that's false — classname only represents name of a class, not a name of a file.
So look's like you should actually look inside files content, using grep for example:

find . -type f -name "*.swift" -exec grep -l "class #{class_name}.swift" {} +
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

1 participant