Hi, do you have a good example of taps tests, I wa...
# announcements
m
Hi, do you have a good example of taps tests, I want to test the process of streams, schema, sync etc ...?
d
@meir.shamay I'd suggest checking out the PipelineWise taps, they have a good amount of tests: https://github.com/transferwise/pipelinewise-tap-postgres/tree/master/tests
m
Thanks, I saw that taps developers using this package `
Copy code
import tap_tester.connections as connections
import tap_tester.menagerie   as menagerie
import tap_tester.runner      as runner
`
where can I find
tap_tester
Do you have an answer for me?
d
@meir.shamay Unfortunately, Stitch hasn't open sourced
tap_tester
. This came up on the Singer Slack workspace recently as well: https://singer-io.slack.com/archives/C2TGFCZEV/p1599077499069400, https://singer-io.slack.com/archives/C016CTU1ESZ/p1599076357005100
m
So, how do you suggest me to test the taps?
d
@meir.shamay Right now, your best option would be to use Python's unittest (https://docs.python.org/3/library/unittest.html) or pytest (https://docs.pytest.org/en/stable/) libraries to write unit tests for your discovery and syncing logic, without Singer-specific testing utils. Do you have experience with unittest and/or pytest?
m
thanks, yes I have. I wonder how do you test those processes/
d
@meir.shamay Which processes do you mean? Your tests would directly test your Python script's main entrypoint function and other feature-specific functions (like
do_discover
,
do_sync
), and you could mock the API requests using methods like those discussed here: https://realpython.com/testing-third-party-apis-with-mocks/ You wouldn't need to test the
tap-foo
executable directly, since you'd be testing the implementation of your executable's main function.
m
thnaks.
d
@meir.shamay Good luck! If you end up writing your own Singer-specific util functions, you should consider open sourcing them so that we can start writing our open source equivalent of tap_tester 🙂