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

Trying to run with testplans fails unless you specify a workspace #362

Open
5 tasks done
tejassharma96 opened this issue Oct 29, 2021 · 4 comments · May be fixed by #363
Open
5 tasks done

Trying to run with testplans fails unless you specify a workspace #362

tejassharma96 opened this issue Oct 29, 2021 · 4 comments · May be fixed by #363

Comments

@tejassharma96
Copy link

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.

If you love this fastlane plugin, consider sponsoring it or asking your company to sponsor it. I would really appreciate any
gesture: https://github.com/sponsors/lyndsey-ferguson. 😍

Issue Description

When using multi_scan, I can't pass in a testplan without specifying the workspace. Previously I was able to just rely on scan finding the workspace automatically, but if I try to use a testplan it hooks into testplans_from_scheme without any chance for scan to populate those values. This means that when testplans_from_scheme tries to get the testplans (here), both schemes_from_project and schemes_from_workspace return nil, resulting in the stacktrace I pasted below.

If I pass in the workspace manually it works as expected.

Not having to specify the workspace is valuable to me since I'm essentially maintaining this fastlane script to be used by multiple teams, so I always want to minimize the amount of information they need to input (ie it isn't as simple as just specifying the workspace for my project, it would be a new configuration item I would need to collect as part of the setup).

Would it be possible for multi_scan to update the options that scan auto-populates before calling into other places? Something like updating runner.rb in multi_scan_manager to also set Scan.config = multi_scan_options (or some subset of multi_scan_options), which would trigger the detection of missing values, and then merge Scan.config back into multi_scan_options? This is a mostly uninformed point of view based on just going through this plugin and fastlane's source code, but it feels like it would be straightforward to implement and update.

Hopefully this is something that can be updated as part of this plugin and I don't need to add a new config item for my consumers 😅

Let me know if there's any extra info you need from me.

Stacktrace

/Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb:33:in schemes': \e[0;31;49m[!] undefined method length' for nil:NilClass\e[0m (NoMethodError)
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb:5:in run' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:164:in only_testing_from_testplan'
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:53:in derive_only_testing' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:62:in testable_tests_hash_from_options'
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:84:in derive_batches_from_tests' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:27:in initialize_batches'
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:18:in initialize' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb:69:in new'
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb:69:in setup_testcollector' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb:26:in initialize'
from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/actions/multi_scan.rb:37:in new' from /Users/tejass/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/fastlane-plugin-test_center-3.15.3/lib/fastlane/plugin/test_center/actions/multi_scan.rb:37:in run

@lyndsey-ferguson
Copy link
Owner

So, I'm just going to perform a brain dump so I'll let the text flow free form. If your fastlane script will be relying on multi_scan to build the project before hand, it will have to have run the magical discovery phase itself...unless that fails because you didn't provide the workspace or project. I don't remember if that will work. Let's say it would fail and you're just relying on the tests.......it is possible that I could pre-discover the project using's scan's magical way of discovery but I don't remember why I don't do that.. it would slow it down perhaps.

Is there anyway that your script could pass in the filepath to the scheme? That may be something I could accept optionally instead of looking for it. Then, the code could look for that (as either an input, or a special environment variable), and not need it for this code.

I need to be able to get the tests in order to properly batch, split, retry, etc...

@tejassharma96
Copy link
Author

thanks for the reply! I'm mostly trying to avoid adding another config item. for now I've just added

workspace = File.absolute_path(Dir["../*.xcworkspace"].first)

and that seems to have worked, but I was hoping you might be able to update the plugin to take advantage of scan's functionality that supports a few more use-cases and wouldn't require me to maintain it locally (ie my links in the original MR). If you just reuse scan's stuff, it isn't something you'd need to maintain. I think there's an even more straightforward way of doing this though by using detect_projects. I'm gonna make a quick PR to demonstrate what I mean.

@tejassharma96 tejassharma96 linked a pull request Nov 15, 2021 that will close this issue
3 tasks
@tejassharma96
Copy link
Author

Created here: #363

@lyndsey-ferguson
Copy link
Owner

I want to apologize that I have not responded to this issue. A family health issue is requiring me to narrow my focus on the essentials and I don't have the time I need to focus on the plugin more than a minute. If you can get some other contributors to this project to help with this, I would consider merging a resulting PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
test_center_µ
  
To do
Development

Successfully merging a pull request may close this issue.

2 participants