Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[Bug] multi_scan - Unable to parse unit file when using xcbeautify #386

Open
5 tasks done
AlexTrott opened this issue Sep 18, 2022 · 1 comment
Open
5 tasks done

Comments

@AlexTrott
Copy link

AlexTrott commented Sep 18, 2022

New Issue Checklist

  • Updated fastlane-plugin-test_center to the latest version
  • I read the README.md
  • I reviewed the example(s) for the action(s) I am using
  • I have removed any sensitive data such as passwords, authentication tokens, or anything else I do not want to world to see
  • I have reviewed the Discussions forum to see my question has already been addressed.

Issue Description

When multi_scan is started and your machine has xcbeautify installed, fastlane will default to xcbeautify instead of xcpretty
This is fine, and doesn't cause any issues with multi_scan function until gets to calling the junit_helper (https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/blob/master/lib/fastlane/plugin/test_center/helper/junit_helper.rb#L87) which then fails to initialize.

xcpretty generated junit

<?xml version='1.0' encoding='UTF-8'?>
<testsuites name='SampleAppTests.xctest' tests='1' failures='0'>
  <testsuite name='SampleAppTests.SampleAppTests' tests='1' failures='0'>
    <testcase classname='SampleAppTests.SampleAppTests' name='testExample' time='0.001'/>
  </testsuite>
</testsuites>

xcbeautify generated junit

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="0">
    <testsuite name="SampleAppTests" tests="1" failures="0" skipped="0" time="0.0008810758590698242">
        <properties>
          <property name="Configuration" value="Test Scheme Action"/>
        </properties>
        <testcase classname="SampleAppTests" name="testExample()" time="0.0008810758590698242">
        </testcase>
    </testsuite>
</testsuites>

So...

As you can see the xcbeautify junit file contains some extra properties and with some different values. I haven't had a chance to explore what the root cause is yet, just wanted to capture the issue down, and then explore it more tomorrow, but my gut feeling with it failing on testable_filename = xml_element.parent.parent.attribute('name').value it's because of <testsuites tests="1" failures="0">

If that is the case, I'm not sure if that is fastlane``xcbeautify issue, or fastlane-plugin-test_center issue, but flagging here for now

Complete output when running fastlane, including the stack trace and command used
/Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:87:in `initialize': \e[0;31;49m[!] undefined method `value' for nil:NilClass\e[0m (NoMethodError)
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:48:in `new'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:48:in `block in initialize'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `block in each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `each'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:47:in `initialize'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:30:in `new'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:30:in `block in initialize'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `block in each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `each'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:29:in `initialize'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:16:in `new'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:16:in `block in initialize'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `block in each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/xpath.rb:68:in `each'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/rexml-3.2.5/lib/rexml/element.rb:1968:in `each'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/helper/junit_helper.rb:15:in `initialize'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/tests_from_junit.rb:5:in `new'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/tests_from_junit.rb:5:in `run'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:229:in `chdir'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/other_action.rb:23:in `method_missing'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/multi_scan.rb:148:in `block in run_summary'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/multi_scan.rb:147:in `each'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/multi_scan.rb:147:in `run_summary'
        from /Users/alextrott/Developer/github/alextrott/fastlane-plugin-test_center/lib/fastlane/plugin/test_center/actions/multi_scan.rb:40:in `run'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:229:in `chdir'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
        from Fastfile:34:in `block (2 levels) in parsing_binding'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/lane.rb:33:in `call'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:45:in `chdir'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/runner.rb:45:in `execute'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
        from /Users/alextrott/Developer/github/alextrott/fastlane/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
        from /Users/alextrott/Developer/github/alextrott/fastlane/bin/fastlane:23:in `'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/bin/fastlane:23:in `load'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/bin/fastlane:23:in `'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:497:in `exec'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:49:in `block in '
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:37:in `'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/bin/bundle:23:in `load'
        from /Users/alextrott/.rvm/rubies/ruby-3.0.0/bin/bundle:23:in `'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks:22:in `eval'
        from /Users/alextrott/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks:22:in `'

Environment

[INSERT OUTPUT HERE]
@AlexTrott
Copy link
Author

I think the actual issue sits with trainer
fastlane/fastlane#20160

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

No branches or pull requests

1 participant