https://pact.io logo
Join Slack
Powered by
# pact-swift
  • t

    Tomer

    05/16/2024, 8:38 AM
    @Tomer has left the channel
  • t

    Taha Shakibania

    05/27/2024, 11:03 AM
    @Taha Shakibania has left the channel
  • g

    georgia andrews

    06/03/2024, 5:40 PM
    @georgia andrews has left the channel
  • p

    PK

    06/04/2024, 3:45 AM
    @PK has left the channel
  • s

    Stephen Bell

    06/18/2024, 10:28 PM
    @Stephen Bell has left the channel
  • a

    Amit Wertheimer

    06/25/2024, 10:27 AM
    @Amit Wertheimer has left the channel
  • v

    Vladimir Vásquez Hernández

    07/15/2024, 10:28 PM
    Hi team, I'm trying to write a basic test using PactConsumerSwift. However it is failing when Pact is trying to connect to the server.
    Copy code
    test(): 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:
    Copy code
    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
    Copy code
    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 😉
    🙌 1
    a
    • 2
    • 2
  • m

    Matt (pactflow.io / pact-js / pact-go)

    07/15/2024, 10:39 PM
    This looks like an older version of the swift library that uses the Ruby “core”. There should be some logs somewhere (or you should be able to enable them), could you please share those? Did the test ever work or are these new tests? What OS are you on?
    ☝️ 1
    v
    m
    • 3
    • 43
  • j

    Jocelyn Lecomte

    07/25/2024, 9:23 AM
    @Jocelyn Lecomte has left the channel
  • i

    Inken

    07/25/2024, 3:21 PM
    @Inken has left the channel
  • d

    Diego Betancur

    07/29/2024, 4:44 PM
    @Diego Betancur has left the channel
  • m

    Megan Honig

    07/30/2024, 6:56 PM
    @Megan Honig has left the channel
  • b

    Bertold Kolics

    09/08/2024, 8:12 PM
    @Bertold Kolics has left the channel
  • v

    Val Kolovos

    09/19/2024, 10:40 PM
    @Val Kolovos has left the channel
  • m

    Marcus Couto

    10/04/2024, 4:16 PM
    @Marcus Couto has left the channel
  • a

    Ashley Gautama

    10/10/2024, 8:09 AM
    Hey, a specific question using pact swift. We are having some trouble configuring the requestbody for our mockserver/contract test. Reason being we are (also) using an encrypted multipart in the request body. Any ideas? We couldnt really find a similar example. The actual request body looks something like this.
    m
    • 2
    • 1
  • g

    Gianluca Ciccarelli

    11/22/2024, 2:08 PM
    @Gianluca Ciccarelli has left the channel
  • s

    Shakil Riyad

    11/25/2024, 9:57 PM
    @Shakil Riyad has left the channel
  • p

    Pietro Di Bello

    12/17/2024, 11:23 AM
    @Pietro Di Bello has left the channel
  • t

    Tom Lopez

    01/22/2025, 4:04 PM
    @Tom Lopez has left the channel
  • r

    Romain Létendart

    01/31/2025, 4:56 PM
    @Romain Létendart has left the channel
  • s

    Spencer

    02/11/2025, 3:34 PM
    @Spencer has left the channel
  • d

    Dominik Krichbaum

    02/26/2025, 2:22 PM
    @Dominik Krichbaum has left the channel
  • m

    Martin Mineo

    03/07/2025, 1:16 PM
    @Martin Mineo has left the channel
  • z

    Zachary Lysobey

    06/20/2025, 12:57 PM
    @Zachary Lysobey has left the channel
  • d

    Dominick Campbell

    07/18/2025, 8:20 PM
    @Dominick Campbell has left the channel
  • p

    Paul

    09/12/2025, 5:17 AM
    @Paul has left the channel
  • e

    Elson Ho

    09/19/2025, 2:31 AM
    @Elson Ho has left the channel
  • n

    Nathan Thompson

    10/03/2025, 5:06 PM
    Hi folks, I'm curious about the state of the PactSwift repo. Judging from GitHub activity, it appears there's a v2 feature branch that was meant to include Pact v4 matchers that the maintainer did not get to a releasable state. Unfortunately, the v1 of PactSwift contains an incomplete set of Pact v3 matchers. I specifically need
    arrayContains
    in order to handle my team's polymorphic API design. I see a community member prototyped that matcher for PactSwift v1, and even temporarily opened a pull request so we can see their source. They then appeared to close the PR in favor of trying to rewrite against the PactSwift v2 feature branch, but I don't see that ever materialized as a new PR. Would it be possible to revive the original
    arrayContains
    pull request and get that released as a v1.3? Is there anyone with admin access to the repo to be able to merge that and cut a release?
    m
    m
    • 3
    • 13
  • k

    Kieran McCarthy

    10/11/2025, 10:49 AM
    @Kieran McCarthy has left the channel