-
Notifications
You must be signed in to change notification settings - Fork 119
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
refactor: Prepare flank codebase for supporting iOS testplans #1281
Conversation
e587a71
to
38ae7d2
Compare
Timestamp: 2020-11-19 11:40:11 |
Codecov Report
@@ Coverage Diff @@
## master #1281 +/- ##
============================================
- Coverage 79.61% 79.47% -0.15%
+ Complexity 735 700 -35
============================================
Files 237 244 +7
Lines 4573 4618 +45
Branches 792 809 +17
============================================
+ Hits 3641 3670 +29
- Misses 526 531 +5
- Partials 406 417 +11 |
After merging #1300 this PR should be easier to review. |
390f9c7
to
fb7ba02
Compare
@@ -79,7 +79,7 @@ IosArgs | |||
private fun IosArgs.calculateShardChunks() = if (disableSharding) | |||
emptyList() else | |||
ArgsHelper.calculateShards( | |||
filteredTests = filterTests(findTestNames(xctestrunFile), testTargets) | |||
filteredTests = filterTests(findXcTestNamesV1(xctestrunFile), testTargets) |
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.
will there be a v2?
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.
Probably but in the next PR (I am working on it). It's in the description "The full integration of flank with xctestrun v2 will be added in the next pull request(s)".
import ftl.ios.xctest.common.parseToNSDictionary | ||
import java.io.File | ||
|
||
internal fun findXcTestNamesV2(xctestrun: String): Map<String, XctestrunMethods> = |
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.
ahh i see it now. Why the v1 vs v2?
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 xctestrun file can come (currently) in two versions. Those files can have a slightly different structure and require different parsers. In the documentation you can find differences between them https://github.com/Flank/flank/blob/4c3b55d30723aefc9ca65b1bec4415a095217531/docs/feature/ios_test_plans.md
// https://github.com/linkedin/bluepill/blob/37e7efa42472222b81adaa0e88f2bd82aa289b44/Source/Shared/BPXCTestFile.m#L18 | ||
// must quote binary path in case there are spaces | ||
var cmd = "nm -U ${binary.quote()}" | ||
if (!FtlConstants.isMacOS) cmd = "PATH=~/.flank $cmd" |
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.
has this been tested on windows?
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.
nope
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.
its gonna break it i see it 🗡️
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.
parseObjcTests
is used only on ios tests. Flank not supporting ios tests on windows so I think it's fine.
val results = mutableListOf<String>() | ||
// https://github.com/linkedin/bluepill/blob/37e7efa42472222b81adaa0e88f2bd82aa289b44/Source/Shared/BPXCTestFile.m#L18 | ||
// must quote binary path in case there are spaces | ||
var cmd = "nm -U ${binary.quote()}" |
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 am not sure windows is supported?
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.
Me too, this code is untouched, only moved from:
https://github.com/Flank/flank/blob/ab55fbcb02f6cfe99b3b502db6bf52f661cd34ca/test_runner/src/main/kotlin/ftl/ios/Parse.kt
Everything should work like before. It's in the description: "This pull request SHOULD NOT change the current behavior of the flank."
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.
hmmm alright. We may need to test it
|
||
@Test | ||
fun `findTestNames respects skip`() { | ||
assumeFalse(FtlConstants.isWindows) |
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.
we have this here, but what about the other 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.
FYI, most of the tests in this PR are moved from
- https://github.com/Flank/flank/blob/ab55fbcb02f6cfe99b3b502db6bf52f661cd34ca/test_runner/src/test/kotlin/ftl/ios/XctestrunTest.kt and
- https://github.com/Flank/flank/blob/ab55fbcb02f6cfe99b3b502db6bf52f661cd34ca/test_runner/src/test/kotlin/ftl/ios/ParseTest.kt
to other files to match the refactor of associated functions.
The new tests which I have added are
- https://github.com/Flank/flank/blob/4c3b55d30723aefc9ca65b1bec4415a095217531/test_runner/src/test/kotlin/ftl/ios/xctest/FindXcTestNamesV2KtTest.kt
- https://github.com/Flank/flank/blob/4c3b55d30723aefc9ca65b1bec4415a095217531/test_runner/src/test/kotlin/ftl/ios/xctest/RewriteXcTestRunV2KtTest.kt
I have no windows to test it so I have followed convention with assumeFalse(FtlConstants.isWindows)
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.
makes sense. We will need a fixup task for windows again.
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.
We will need a fixup task for windows again.
"Again" in this context sounds like that was working previously, then was broken, fixed and now is broken again. But It's not true for this test.
As I said, nothing changes here except file name.
29bb33f
to
a97c1aa
Compare
val result = parseToNSDictionary(swiftXcTestRunV1) | ||
assertThat(arrayOf("EarlGreyExampleSwiftTests", "__xctestrun_metadata__")).isEqualTo(result.allKeys()) | ||
val dict = result["EarlGreyExampleSwiftTests"] as NSDictionary | ||
assertThat(dict.count()).isEqualTo(20) |
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 know that this test isn't new, but I don't think that asserting number of a key:value pairs here is a good idea.
It may change with new version of Xcode.
test_runner/src/test/kotlin/ftl/ios/xctest/common/UtilKtTest.kt
Outdated
Show resolved
Hide resolved
0007791
to
858801f
Compare
import ftl.util.copyBinaryResource | ||
|
||
internal val installBinaries by lazy { | ||
if (!FtlConstants.isMacOS) { |
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.
Will it work properly on Windows 🤔 ?
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.
Not sure. It's refactoring ;P. I haven't got windows OS.
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.
probably it should be
if (!FtlConstants.isMacOS && !isWindows)
but if this just moving to new file, you could leave it
I think that this more |
858801f
to
d81c933
Compare
d81c933
to
17be78e
Compare
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.
- Tested
- Outputs of master and this branch compared and is the same
👍
17be78e
to
ee6a99a
Compare
ee6a99a
to
cd39b11
Compare
* added feature doc template * refactored Xctestru * added ios_test_plan.yml
- updating Xctestrun and FindTestNames methods - wip
Co-authored-by: Jan Góral <[email protected]>
Co-authored-by: Jan Góral <[email protected]>
cd39b11
to
fa5ff24
Compare
This PR brings the partial implementation of #685.
As feature #685 will bring a lot of changes in codebase it will be delivered in separate pull requests for reducing code review complexity.
The main goals of this PR are:
This pull request SHOULD NOT change the current behavior of the flank.
This pull request IS NOT exposing a new feature.
The full integration of flank with xctestrun v2 will be added in the next pull request(s)
Test Plan
Everything is working like before
The unit tests pass
Checklist
Parse.kt
file & related unit testsXctestrun.kt
file & related unit tests#685-ios-support-for-testplans