react-native-unified-contacts icon indicating copy to clipboard operation
react-native-unified-contacts copied to clipboard

Testing Suite

Open paintedbicycle opened this issue 6 years ago • 7 comments

Currently we don't have any automated testing to help protect against regressions. We should add tests.

paintedbicycle avatar Mar 22 '18 10:03 paintedbicycle

@joshuapinter Are you still thinking about this? Would you be using Jest? I have no experience in testing, but I am interested in learning Jest and Enzyme. Maybe you can get something installed and configured the way you like and then I can help write tests?

paintedbicycle avatar Mar 12 '19 12:03 paintedbicycle

Absolutely. I've been making improvements to Android recently, including SelectContact, which is really slick.

The more I think about testing, the more I think that Jest and Enzyme won't cut it. We use those in a project at work but mostly to render Components. In this library, we mostly need to test the access and response of the native Contacts on various device/OS combinations.

The only way I can think of to test this is through emulators, via Travis or CircleCI or something, where we can specify a testing matrix and confirm all supported OS and versions are passing the tests. Maybe we use Jest or something else for the actual tests but we'll need to have them run in an emulator to confirm they're working in the device environment. i.e. it can't just be standalone testing.

What do you think?

joshuapinter avatar Mar 12 '19 14:03 joshuapinter

I think the two obvious ones are CircleCI and Travis CI.

Here is an example CircleCI project for React Native:

https://github.com/CircleCI-Public/circleci-demo-react-native

Might be a good starting place.

Plus, they offer free services for Open Source projects:

What if I am building open-source? We offer a total of four free linux containers ($2400 annual value) for open-source projects. Simply keeping your project public will enable this for you!

We also offer the Seed plan free (at 1x concurrency) for OS X open source projects. Contact us at [email protected] for access. If you are building a bigger open-source project and need more resources, let us know how we can help you!

joshuapinter avatar Mar 12 '19 15:03 joshuapinter

Very interesting. I'd like to learn this stuff. It's a bit over me at the moment but I'm willing to follow along and help out here and there where I can. I agree that testing in a real/emulated device is superior as most of our problems have stemmed from weirdness on device.

paintedbicycle avatar Mar 12 '19 16:03 paintedbicycle

Sounds good. Well, I'll get things setup and get the first couple tests done so that there is a pattern and let you finish it off from there.

joshuapinter avatar Mar 12 '19 16:03 joshuapinter

Started playing around with this on the tests branch: https://github.com/joshuapinter/react-native-unified-contacts/tree/tests

Much more difficult than anticipated. Will require a whole weekend to get this working right so have to put this off until more time opens up.

It's important, though, so I'm keen to get it up and running eventually.

joshuapinter avatar Mar 22 '19 05:03 joshuapinter

Awesome. Yep, there is only so much time in a week!

paintedbicycle avatar Mar 22 '19 06:03 paintedbicycle