title: How to implement XCUITest with API Calls
body: <p>I am new to XCUITest framework. I need to call an API <strong><a href="https://restcountries.eu/rest/v2/all" rel="nofollow noreferrer">https://restcountries.eu/rest/v2/all</a></strong> getting list of countries and showing in UITableView now as user will click on any cell based on country name next screen will have country name and country flag every thing is working fine now I wanted to implement XCUITest for that I have added function</p>
  <pre><code> [![enter image description here][1]][1]
  
  func testTheCountryListAndAllScreen() {
  app.launch()
  let countryListTableView = self.app.tables[&quot;CountryList&quot;]
  XCTAssertTrue(countryListTableView.exists, &quot;Country list have data&quot;)
  let countryListCell = countryListTableView.cells
   if countryListCell.count &gt; 0 {
       for cell in 0..&lt;countryListCell.count {
            let countryCell = countryListCell.element(boundBy: cell)
             countryCell.tap()
             self.app.buttons.staticTexts[&quot;Move to info page&quot;].tap()
             self.app.navigationBars.buttons.element(boundBy: 0).tap()
             self.app.navigationBars.buttons.element(boundBy: 0).tap()
             }
        }
  }
  </code></pre>
  <p>at app.launch() app is getting crashed</p>