Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

How is this library different from react-native-testing-library by Callstack? #1

Closed
Eyesonly88 opened this issue Apr 4, 2019 · 4 comments

Comments

@Eyesonly88
Copy link

Hi there, I know this library is inspired by react-native-testing-library, but what are the differences?

@bcarroll22
Copy link
Collaborator

👋 howdy.

I actually wouldn't say it's "inspired" by, so much as it's a result of. If you want an in-depth answer, you can check out the medium post.

If you're lookin for more of a concise answer, I, my team, even Kent himself felt like there needed to be a solution that more closely adhered to the guiding principles. Key points:

  1. Queries are solely based on things users can interact with (The more your tests resemble the way your software is used, the more confidence they can give you.)
  2. Events can only fire on valid targets (Again, more confidence because that's how your app works)
  3. You can't access React instances, so you can't test things like state (Software users don't care, they only care about the result of the state changes)

These are important concepts in dom-testing-library, and we felt the need to offer a solution for native that followed. Hope that helps!

@Eyesonly88
Copy link
Author

Hey @bcarroll22

Sweet, thanks for the reply. I said inspired because that's what the readme mentioned (8939db0).

I'm interested in learning the differences in more details to learn more about your library and react-native-testing-library (which we currently use). So I'm not trying to point out issues in other libraries, I just want to learn.

I read the medium post and it doesn't specifically mention what's missing in details (which is on purpose according to the post).

Are there any specific technical details about the differences? Perhaps you can share it with me in private if you're not comfortable sharing it publicly?

Cheers and happy Friday 👍

@bcarroll22
Copy link
Collaborator

Yeah, re-reading the README after your comment prompted me to go back and edit the wording of that section to clarify.

I think it’d be hard to explain technical details why you’d use one or the other... the code or documentation would probably do a better job of that. Most importantly, I think a decision to use this one/that one would come down to philosophy more than technology anyways.

If you’re not super familiar with the real react-testing-library, the guiding principles of it, and the teachings of Kent about how to test apps properly, that’d be a good place to start. Although react-native-testing-library has the family name, Kent, Alex, and co disagree that it shares the core values of the family, and I think that’s actually the most important difference.

Unfortunately past that I’m not sure I’ll be able to offer much more at this point. The library is brand new, so real world use cases, benchmarks, metrics, etc. aren’t really there yet. You’re welcome to try it out and browse the code and docs of both libraries though, maybe that would help you the most if you’re still looking for more technical details? The docs site is pretty thorough and there’s over 100 tests that show how to use it in practice.

Happy Friday to you as well!

@Eyesonly88
Copy link
Author

Okay cool, thanks for the reply.

I'll read the docs and experiment with the library.

Thanks and enjoy the weekend 👍

bcarroll22 pushed a commit that referenced this issue Jun 20, 2019
* fix(typescript): fix query typings

* fix(typescript): remove NativeTestInstance from function argument in Query interface

* chore: remove unnecessary code
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants