A framework to make writing UI tests a breeze!
Wiretapp
as a swift package to your project and in the target modal add Wiretapp
to your app target and wiretappTest
to your UI Test target
Edit Scheme
for your main app targetEnvironment Variables
add the following variables
wiretappResponses
with the path set to where you want the mock responses to be stored and read from (eg; $(SOURCE_ROOT)/MockResponses/
)wiretappRecording
with the value set to true
or false
, which signifies wether record mode is turned on or off (can also be set to true
and the variable can be checked/unchecked instead)MockResponses
folder to your project as a reference folder
(blue folder icon)
Add Files to [project]
, selecting the folder you want to add and making sure the Create folder references
radio button is checkedAnd thats it, you're all set! 🎉🥳
Wiretapp
Wiretapp.registerSharedSession()
(Wiretapp.register(configuration:)
if you're using a custom implementation of URLSession
or Alamofire
) before your app starts making Network requestsrecorded
folder 🤗WiretappTest
WiretappBaseTestCase
-recorded
folder under a new directory structure inside MockResponses
a directory named according to your test scenario
test_LoginSuccessful
inside LoginTests
, the directory would be MockResponses/LoginTests/LoginSuccessful
Run the test case and it should be running off of the mock JSON responses inside the mock responses folder! 🍾
You can tweak the status
code and modify the response
data in the JSON files to simulate different scenarios ( error cases ie. 404 / 400 / etc ) for your tests!
link |
Stars: 13 |
Last commit: 2 years ago |
Full Changelog: https://github.com/MrMUsmanAli/wiretapp/commits/1.0.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics