-
Notifications
You must be signed in to change notification settings - Fork 0
How to know what to test
Devrath edited this page Oct 24, 2023
·
1 revision
- It makes sense to write tests for the features that are used most in the application.
- If there is a feature that is used by 85% of users of the application and there is a feature that is used by 5% of the users of the application.
- If you write the tests for the feature that is used by just 5% of users and not the feature used by 85% of users. it will be a waste of writing the test cases Since you need to write more tests for features that are used by more users.
- We need to write tests for business logic that contributes more revenue for the app even if the logic is small.
- If the code fails there, the app will end up making less money and cause a problem for the business.
- If the code is very complex in such a way that looking at the code you cannot determine how to test it.
- For such a feature it is a must for writing the test cases
- If there is a piece of code that keeps changing when more logic gets added to the application.
- In such a scenario, It is logical to write more tests for such a piece of code.
- One scenario is where there is a third-party library and there is no need to write tests for the third party because the responsibility for writing the tests lies with the owner of the library and not the developer who uses it.
- But if you use the library and make something, You could write a test for that particular thing.
- For example using
Room
library you don't need to test whether the room does insertion but if you write a complex query that returns something, You can test that.