-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Chore] Add KIF and KIF Target #95
base: develop
Are you sure you want to change the base?
Conversation
import Nimble | ||
import Quick | ||
|
||
final class HomeSpec: QuickSpec { |
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.
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.
Firstly, welcome to CryptoPrices @blyscuit 🎉
@minhnimble Yes, that's exactly what I was going to say 😄
For our architecture, the tests of a module will be placed in the corresponding package. So basically we would have two new test targets for the Home
and MyCoin
respectively.
The CryptoPricesKIFUITests
target you created is still useful if we want to make some kind of integration test, like tapping a row on the TrendingCoins section on the Home will navigate to the MyCoin with correct UIs, ...
I think today I'm gonna take a look at KIF to check how to best integrate it into our project 🙏
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.
A warm welcome to @blyscuit 🕺 .
@minhnimble @Thieurom I agree 💪 . I used to use KIF before but in our architecture, it's something I need to research a little bit :D. I will take a look at this after my tasks are done 🙏 .
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.
KIF is "an iOS integration test framework", it requires some sort of 'app' to run the test. Underneath it works similarly to XCUITest (meant as a replacement of XCUITest): Find view in app > interact with app via accessibility components.
I think this discussion is referring to Unit test of the views, which can be done through ViewInspector that David presented or with Snapshot Testing that Thieu briefly discussed.
The reason that KIF runs on a unit test scheme is because it uses application code to execute the test ie: UIScreen.main.currentViewController
to find a specific view and interact with it. I believe this can cause some confusion to first time adopter.
Alternatively the UI modules need to have app that show the UI on the simulator (extra main class that is used for testing only), which is also a unit test idea and fits better with ViewInspector
.
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 reason I'm pushing KIF
to the chapter and this project is because iOS dev are less likely to want to add integration test because how fragile XCUITest
is. But with KIF
we can be confident about our integration test and is way easier to work with.
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.
On the modular architecture note, I think it will make sense to add KIF
to the module if the module act as a user's story ie: register, kyc, feature1, feature2, then it would make sense to create a demo-main
class for testing. Currently this modular architecture is separating the feature module to smaller UI modules.
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.
Thank you for your insights @blyscuit 🙏
KIF is "an iOS integration test framework", it requires some sort of 'app' to run the test.
That's what I thought in the first place
The CryptoPricesKIFUITests target you created is still useful if we want to make some kind of integration test, like tapping a row on the TrendingCoins section on the Home will navigate to the MyCoin with correct UIs, ...
So basically, with the same KIF
framework (without an additional one like ViewInspector
) we can achieve 2 purposes:
- Add the Unit test of the views for each module. It needs some extra work like wrapping in a
UIHostingController
(it can be extracted to a helper/extension though) among other things. I think we don't have time for this now! - Add the integration tests, which need to be implemented on the app level as you did here. From what I've seen, it's quite similar to another tool like Appium (I remembered my QA guys and gals wrote a lot of test scripts and scenarios in my former companies with this 😄). We should keep going with this! Still, I need some time to play around with
KIF
before making some useful feedback 🙏
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.
Your two points here are correct.
It needs some extra work like wrapping in a
UIHostingController
With the current structure of the modules (Home
and MyCoin
), the UIHostingController would also be implemented in a new Target (same or new project file) because the Swift module has limitation of creating an app target inside the module.
it's quite similar to another tool like Appium
Same as Appium, but much faster build & run and written in Obj-c/Swift.
Hi @blyscuit I checked out this branch and played around with it a little bit. There're some concerns I'd like to share here; kindly clarify 🙏 I might miss something since I didn't have too much time with
|
What is the plan when we include more tests to a growing app? Having one AppSpec would be too bloated? What do you think if we name the test specs by the name of the feature flow for example
This is the same issue with
I'm taking a look at it. Could be because
I will try with a failing test on the CICD of this project. |
@Thieurom
but this will require adding MainActor to all KIF functions. Alternatively we can
but it will result in the warning. I leave this to the team to decide 🙏 |
What happened 👀
Insight 📝
CryptoPricesKIFUITests
.KIF
,Quick
,Nimble
to project for targetCryptoPricesKIFUITests
.Staging
scheme.Proof Of Work 📹
Before KIF:
After KIF: