DEV Community

Cover image for Adding Testing integration in swift using xctest
Japneet Singh
Japneet Singh

Posted on

4 1

Adding Testing integration in swift using xctest

Introduction

Welcome to an introduction to how to integrate testing in ios projects. The framework I chose for my project is XCtest which is an automation tool provided by Apple. Use the XCTest framework to write unit tests for your Xcode projects that integrate seamlessly with Xcode's testing. documentation

Setup

Please follow the instruction to set up the XCTest for your Xcode project.

  1. Image description
  2. Image description
  3. Image description

To run the tests in swift

$ swift test
Enter fullscreen mode Exit fullscreen mode

Shortcuts

These shortcuts are essential when writing unit tests in Xcode.

  1. Command + U to run all tests.
  2. Command + Option + Control + G to run latest test.

Errors encountered

Image description

Fixed errors

Image description

    if(input.isEmpty){
        print("Error. Please enter input folder or add suffix to file name")
        return
      }
Enter fullscreen mode Exit fullscreen mode

Outcome

Learning from testing is to cover all arguments or other ways possibilities of having errors. While testing helps to come up with all scenarios that can cover all errors. Commits: commits
Image description

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay