-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
[iOS] Added Support for XCResult #686
Conversation
…tag-xcxresult-testplan-from-anton * ios-uitest-runner-via-tags: Update README.md Added Support to run iOS Test Runners Tag # Conflicts: # configuration/src/main/kotlin/com/malinskiy/marathon/config/vendor/VendorConfiguration.kt # sample/ios-app/Marathonfile
… into develop/talabat/final-tag-xcxresult-testplan-from-anton * develop/ios-support-for-test-plan-from-xcresult-branch: Modified XCTestRun to adapt to new format of xctestrun ( supporting test plan)
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.
Logic wise we're missing pulling back the xcresult back to the marathon's side
- **performance** using high parallelization (handling dozens of devices) | ||
|
||
## Documentation | ||
|
||
Please check the official [documentation](https://marathonlabs.github.io/marathon/) for installation, configuration and more | ||
|
||
## [iOS Only] Added Support to consume tags for test functions under XCTestCase Subclasses |
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.
Please move the docs info to the https://github.com/MarathonLabs/marathon/blob/develop/docs/_posts/2018-11-19-ios.md. They're automatically published at https://marathonlabs.github.io/marathon/
?: fileListProvider | ||
val resolvedResultBundlePath = marathonfileDir.resolve(configuration.vendorConfiguration.xcResultBundlePath) | ||
|
||
// Adding support for Test Plan |
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.
Please remove the comment. It doesn't make sense after we merge this.
.fileList(resolvedDerivedDataDir) | ||
.firstOrNull { it.extension == "xctestrun" } | ||
?: throw ConfigurationException("Unable to find an xctestrun file in derived data folder") | ||
.firstOrNull { it.extension == "xctestrun" && it.name.contains("$testPlanName") } ?: throw ConfigurationException("Unable to find matching TestPlan. Please recheck if testplan is enabled") |
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.
You can skip creating an additional string here:
it.name.contains("$testPlanName")
-> it.name.contains(testPlanName)
It might also be a good idea to use startsWith or equals instead of contains. I'm not sure if there is a contract on the file name here
@@ -79,6 +80,10 @@ class Marathon( | |||
val tests = applyTestFilters(parsedTests) | |||
val shard = prepareTestShard(tests, analytics) | |||
|
|||
log.info("\n\n\n **** Marathon File Params **** \n") |
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.
This is a no-no: configuration might contain sensitive credentials, and we can't print them to the stdout
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.
If you really want to do this then we need to implement some kind of masking for sensitive fields
@@ -6,7 +6,8 @@ data class Test( | |||
val pkg: String, | |||
val clazz: String, | |||
val method: String, | |||
val metaProperties: Collection<MetaProperty> | |||
val metaProperties: Collection<MetaProperty>, | |||
val tags: Collection<String> = emptyList() |
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.
MetaProprety is an abstraction over tags, annotations and so on. We should just reuse MetaProperty here
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.
Refer:
[iOS]Added Support for Cucumberish Tags / Function Annotations #702
return tests | ||
val iosConfig = configuration.vendorConfiguration as? VendorConfiguration.IOSConfiguration | ||
|
||
return tests.filter { it.tags.contains(iosConfig?.xcTestRunnerTag) } |
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.
This should just be an annotation filter, no vendor-specific logic in the core
@@ -27,6 +27,7 @@ class MoreTests: XCTestCase { | |||
super.tearDown() | |||
} | |||
|
|||
// @Flowers |
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.
Instead of modifying existing tests we should just add more tests with these tags
@@ -382,3 +390,11 @@ private fun String.toInetAddressOrNull(): InetAddress? { | |||
|
|||
private fun TestBatch.toXcodebuildArguments(): String = | |||
tests.joinToString(separator = " ") { "-only-testing:\"${it.pkg}/${it.clazz}/${it.method}\"" } | |||
|
|||
private fun getTimezone(): String { |
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.
This method sounds like getTimestamp rather than getTimezone
@@ -20,6 +21,11 @@ class IOSTestParser(private val vendorConfiguration: VendorConfiguration.IOSConf | |||
* marked as skipped in `xctestrun` file. | |||
*/ | |||
override suspend fun extract(): List<Test> { | |||
|
|||
if (vendorConfiguration.xcTestRunnerTag.isNullOrEmpty()) { | |||
logger.warn { "[iOS] Did not find `xcTestRunnerTag` in iOS Vendor Config. This will result in running all tests" } |
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.
The tag filtering doesn't have anything to do with the responsibility of the parser, this probably doesn't belong here
*/ | ||
|
||
private val targetMap: Map<String, *> = ( | ||
((((((propertyList.valueForKeypath("TestConfigurations") as? Array<Any>)?.first()) as Map<*, *>) |
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.
first() will throw NullPointerException here when TestConfigurations
is missing. Reproduced on the old sample
Closes #620 |
…latform-Test-Runner-Marathon into develop/talabat/final-tag-xcxresult-testplan-from-anton
…final-tag-xcxresult-testplan-from-anton
Motivation
Marathon for iOS produces an amazing HTML report (in the
outputDir
) but sometimes we need the finalxcresult
bundle for many reasons (say integrating with the CI, uploading the result in repository, etc).The
xcresult
bundles are stored at transient paths under Xcode'sderived-data
folder.In this PR, we have added an enhancement of providing
xcResultBundlePath
parameter in the Marathon file (under iOS Vendor Config)As a positive side effect, this helps to avoid flooding Xcode's derived data directory.