Open PeaceKeeperOrg opened 7 years ago
Hi @PeaceKeeperOrg,
You can see our UITestBase
example in our blog post
https://envoy.engineering/embedded-web-server-for-ios-ui-testing-8ff3cef513df#.jf4nit18p
You can also see the gist here
https://gist.github.com/fangpenlin/b180cc4a3c7bbe123ee298b03067b6ab
Although it's for UI testing, it won't be any different to just inherit from XCTest
instead in your case.
Hi @fangpenlin, I tried to follow those guidelines but I cannot make it work properly.
I have create the files you said in the article but still not working as I expected. I have created the "DefaultRouter" file, UITestBase file and MyUITests file in my UI Test folder. Also I have created an Alamofire requets in my ViewController with is the endpoint I want to mock with Ambassador, but the localhost from Ambassador is always "http://[::1]:8080/api/v2/users" and it never returns the correct information.
What can I do to make it work? Do you have a really working example? Because I never found a real working example mocking an endpoint from a ViewController.
Thanks in advance,
Regards.
Do you have an example of running your DefaultHTTPServer asynchronously in the background using Swift 3.0 or greater? I would like to use Ambassador in an XCTest ( i.e. NOT XCUITest) to build a lightweight mock REST server for unit testing an API that I'm building.
Thanks in advance, Rowland