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
Add Support for Test Plans #1936
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this @iteracticman and great first contribution to the project!
I think you covered most of the technical bits needed to get this feature working and should be good to merge with some minor tweaks.
Some additional bits to complete the PR:
- The documentation can be updated to mention the new
testPlans
attribute (https://github.com/tuist/tuist/blob/master/website/markdown/docs/usage/project-description.mdx#test-action) - To help us test this and show case the feature, one of the fixtures e.g.
fixtures/ios_app_with_custom_scheme
can be updated to include a new scheme that leverages a test plan and adding a new line to https://github.com/tuist/tuist/blob/master/features/generate-3.feature#L24 to get the acceptance tests to run the tests of that scheme - Lastly, the CHANGELOG can be updated to highlight this new feature
Thanks again @iteracticman - feel free to post back if you need a hand with any of those.
Sources/TuistLoader/Models+ManifestMappers/TestAction+ManifestMapper.swift
Outdated
Show resolved
Hide resolved
Thanks @kwridan, everything should be ready now. Please check. |
078fe11
to
05e5093
Compare
let customAppSchemeWithTestPlans = Scheme(name: "Workspace-App-With-TestPlans", | ||
shared: true, | ||
buildAction: BuildAction(targets: [.project(path: "App", target: "App")], preActions: []), | ||
testAction: .testPlans(default: "DefaultTestPlan.xctestplan", other: ["OtherTestPlan.xctestplan", "YetAnotherTestPlan.xctestplan", "NonExistentTestPlan.xctestplan"]), | ||
runAction: RunAction(executable: .project(path: "App", target: "App")), | ||
archiveAction: ArchiveAction(configurationName: "Debug", customArchiveName: "Something2")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new scheme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @iteracticman
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this feature to the project @iteracticman. I left some final comments. I think we can merge once they are addressed π
@@ -101,4 +130,42 @@ public struct TestAction: Equatable, Codable { | |||
language: language, | |||
region: region) | |||
} | |||
|
|||
public static func testPlans(default: Path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumping an idea here... I like that we have now .testPlans...
for initializing the TestActions
. What about sticking to the same idea when initializing test actions for targets?
let first: TestAction = .testPlans(default: "...")
let second: TestAction = .targets(targets: [])
And I'd add then a deprecation annotation to the public init to nudge people to use the new constructor. When you do that make sure you test that the warning doesn't break the loading of the manifest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that. will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but it would require me to add two more static functions because we need to support both config: PresetBuildConfiguration
and configurationName: String
.
It's already quite redundant, so maybe it's better to refactor configuration handling a bit first to get rid of that redundancy?
Sources/TuistLoader/Models+ManifestMappers/TestAction+ManifestMapper.swift
Show resolved
Hide resolved
3586f9e
to
70b8c75
Compare
d8fa3ac
to
39ca5a5
Compare
Resolves [NO_ISSUE]
Short description π
Tuist has no support for Test Plans yet, but we need it to be able to adopt it for our project, so I implemented it.
Solution π¦
I tried to not introduce any breaking changes and keep the solution as simple as possible.
Implementation π©βπ»π¨βπ»
ProjectDescription.TestPlanList
and add it toProjectDescription.TestAction
ProjectDescription.TestAction.testPlans
factory method to create Test Actions that have Test Plans instead of Test Targets and restructured initializers along the wayTuistCore.TestPlan
and extendTuistCore.TestAction
as well asTuistGenerator.SchemesGenerator
to include Test Plans, if present in Project DescriptionSchemesGeneratorTests
ios_app_with_custom_scheme
fixture and test case