Tõnis Ojandu
07/05/2023, 6:51 AMJoris van Eijden
07/14/2023, 10:58 AMLotem Dagan
07/20/2023, 10:49 AMStan Amsellem
08/22/2023, 9:36 AMTeea Alarto
08/25/2023, 1:26 PMEytan Hanig
09/01/2023, 3:07 AMTigran Davtyan
09/12/2023, 3:13 AMGeorg Duemlein
09/18/2023, 4:10 AMJamie Weatherby
10/02/2023, 1:11 PMCorey Maynard
10/03/2023, 8:24 PMRuth
10/30/2023, 8:56 PMCody Jenkins
11/01/2023, 2:38 AMLukasz
11/29/2023, 6:54 AMNoel McCrory
01/12/2024, 1:33 PMPere Villega
03/26/2024, 12:16 PMEvan Rademacher
04/05/2024, 4:22 PMMichael Strasser
04/19/2024, 5:33 AMMarko (IttyBittyApps / pact-swift)
05/12/2024, 11:42 PMMarko (IttyBittyApps / pact-swift)
05/12/2024, 11:42 PMMarko (IttyBittyApps / pact-swift)
05/12/2024, 11:42 PMMarko (IttyBittyApps / pact-swift)
05/12/2024, 11:43 PMMartin Gallauner
05/14/2024, 9:40 AMTomer
05/16/2024, 8:38 AMTaha Shakibania
05/27/2024, 11:03 AMgeorgia andrews
06/03/2024, 5:40 PMPK
06/04/2024, 3:45 AMStephen Bell
06/18/2024, 10:28 PMAmit Wertheimer
06/25/2024, 10:27 AMVladimir Vásquez Hernández
07/15/2024, 10:28 PMtest(): failed - Error setting up pact: Could not connect to the server.
I tried to change the localhost address as indicated in some fixes, but it didn't work.
Here is my code, I'd be glad to receive your suggestions:
import Foundation
import PactConsumerSwift
import XCTest
import Hamcrest
class SimulatedSaleIntegration: XCTestCase {
var mockService: MockService?
let apiClient: SimulatedSaleViewModel = SimulatedSaleViewModel()
let successfulSale = Sale(amount: 5000.0, vat: 0.19, tip: 0.15, paymentMethod: "", location: "")
override func setUp() {
super.setUp()
mockService = MockService(provider: "calculator-service", consumer: "Example-app-for-testing")
apiClient.setServer(url: mockService!.baseUrl)
}
override func tearDown() {
super.tearDown()
}
func testGetSuccessfulSimulatedSale() {
mockService!
.uponReceiving("A request to get a simulated sale")
.withRequest(
method: .GET,
path: "/calculator",
query: [...]
)
.willRespondWith(
status: 200,
headers: ["Content-Type": "application/json"],
body: [...]
)
mockService!.run { (testComplete) -> Void in
self.apiClient.getSimulatedSale(sale: self.successfulSale)
assertThat(self.apiClient.simulatedSale?.fee, equalTo(168.34))
testComplete()
}
}
}
In logs, all I can see is interactions/verification
request could not being performed
Task <5AEFFE81-A9B5-4574-9DFB-EE823F7B83B9>.<2> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x6000015ed710 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0[802.11], uses wifi, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <5AEFFE81-A9B5-4574-9DFB-EE823F7B83B9>.<2>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <5AEFFE81-A9B5-4574-9DFB-EE823F7B83B9>.<2>"
), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=<https://0.0.0.0:1234/interactions/verification>, NSErrorFailingURLKey=<https://0.0.0.0:1234/interactions/verification>, _kCFStreamErrorDomainKey=1}
Anyone has an idea about this issue?
Thanks in advace 😉Matt (pactflow.io / pact-js / pact-go)