-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Control the sequence of test files #801
Comments
I honestly don't understand why you demand this from Detox. Detox just runs on top of your preferred test runner as a handful of helper methods on steroids. How do you imagine adding this feature if Detox is not a test runner and has no direct control over the loading sequence? In other words, if there's a feature to specify exact test suite order in Mocha and Jest, and you clearly see that Detox CLI stands in its way (e.g. ignores/overrides CLI arguments or configs), then let's talk about that specific issue. Otherwise, this is something beyond of Detox's reach and there's not much to do about it in the scope of Detox's codebase. |
@sapjax , as you see there are open issues like this one: jestjs/jest#6194 |
@noomorph If the test runners can't meet the demand of E2E test. Thanks for the related issue in Jest project, but the solution(just as i'm using) is still not good. |
@sapjax , sure, when a test runner is too much oriented towards unit tests, sometimes it fails to deliver features normally expected for E2E test suites. For example, currently, there is an unsolved issue about Jest and Ctrl+C (extremely abrupt exit without a chance to clean up resources). So, your issue falls into this unlucky category. Anyway, I'm trying to say that I don't see ways to implement this in Detox as long as test runners don't provide the capabilities you seek. UPD: Added label If you have a prototype which shows how to uniformly leverage both Mocha and Jest API to configure a specific sequence of test files, please demonstrate. |
having your tests depend on order in which they are executed is, imho, a really bad idea that one day will turn against you. Test should be able to run independently. You should not need to run test A to run test B. Test B should just be able to run by itself - without running A first. Apart from better isolation this brings the possibility to run tests in parallel. just my two cents. |
@vonovak If I haven't created an account yet. How can I transfer money? |
@sapjax the money transfer test suite will need to have a beforeEach section where the account is created |
@vonovak If we haven't created the bitcoin address, we don't know the wallet address and private key. This is just an example, there are many random processes in the real-world app, you can't decide which state you put in And even if some data in |
If you are unable to perform this logic in You should test the real account creation in one test, then mock accounts in all others. This is not planned at this point. |
Like the situation in #754.
The E2E test is not like the unit test, Many tests in our app depend on other tests run before.
but the solution above is not good enough:
look at the file name I can't recognize what is the test inside it.
What If I want to run some specific test files with
reuse
?If I want to change the sequence, I must change the file name, it will cause the
git
think I made a lot of changes.We need an option to config the sequence in an array, like:
If I want to change the sequence of b & c, I can just set it as:
The text was updated successfully, but these errors were encountered: