Swift Framework for TestRail's API

Related tags

Testing QuizTrain
Overview

QuizTrain πŸ“ πŸš†

QuizTrain is a framework created at Venmo allowing you to interact with TestRail's API using Swift. It supports iOS, macOS, tvOS, and watchOS.

To use QuizTrain you must have a valid TestRail license and instance to access.

Licensing

QuizTrain is open source software released under the MIT License. See the LICENSE file for details.

Installation

Carthage

After upgrading to the latest version of Carthage add the following to your Cartfile or Cartfile.private file:

github "venmo/QuizTrain" ~> 2.1.0

See Adding frameworks to an application for further instructions. Once complete import QuizTrain in any Swift files you wish to use QuizTrain in.

Cocoapods

In your Podfile add the following line to your target and save the file:

pod 'QuizTrain', '~> 2.1.0'

Run pod install, open your project .xcworkspace file, and you should now be able to import QuizTrain into your code.

Usage

Create an ObjectAPI to get, add, update, delete, and close items on your TestRail instance.

let objectAPI = ObjectAPI(username: "[email protected]", secret: "your_api_key_or_password", hostname: "yourInstance.testrail.net", port: 443, scheme: "https")

Alternatively you can use API directly if you would rather work with basic Swift types. Generally it is better to use ObjectAPI as API is a lower level of abstraction. For differences see comments in API.swift and ObjectAPI.swift.

Example Project

See the QuizTrain Example project to view how you can integrate QuizTrain with your unit tests and UI tests on iOS.

Example Code

Below shows a limited number of examples. For all examples see ObjectAPITests.swift.

Get all Cases in a Project

    objectAPI.getCases(inProjectWithId: 5) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let cases):
            print(cases) // Do something with cases.
        }
    }

Add a Case

    let section: Section = ...
    let newCase = NewCase(estimate: nil, milestoneId: nil, priorityId: nil, refs: nil, templateId: nil, title: "New Case Title", typeId: nil, customFields: nil)
    
    objectAPI.addCase(newCase, to: section) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let `case`):
            print(`case`.title) // Do something with the newly created `case`.
        }
    }

Update a Suite

    var suite: Suite = ...
    suite.description = "Updated description for this suite."
    suite.name = "Updated name of this suite."
    
    objectAPI.updateSuite(suite) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let updatedSuite):
            print(updatedSuite.description) // "Updated description for this suite."
            print(updatedSuite.name) // "Updated name of this suite."
        }
    }

Delete a Section

    let section: Section = ...
    
    objectAPI.deleteSection(section) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(_): // nil on successful deletes
            print("The section has been successfully deleted.")
        }
    }

Close a Plan

    let plan: Plan = ...
    
    objectAPI.closePlan(plan) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let closedPlan):
            print(closedPlan.isCompleted) // true
            print(closedPlan.completedOn) // timestamp
        }
    }

Get a Relationship

    let milestone: Milestone = ...
    
    milestone.parent(objectAPI) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let optionalParent):
            if let parent = optionalParent {
                print("Milestone \(milestone.id) has a parent with an id of \(parent.id).")
            } else {
                print("Milestone \(milestone.id) does not have a parent.")
            }
        }
    }

Get Completed Runs in a Project using a single Filter

    let filters = [Filter(named: "is_completed", matching: true)]
    
    objectAPI.getRuns(inProjectWithId: 3, filteredBy: filters) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let completedRuns):
            for completedRun in completedRuns {
                print(completedRun.isCompleted) // true
            }
        }
    }

Get Plans in a Project using multiple Filters

    let project: Project = ...
    let filters = [Filter(named: "offset", matching: 3),
                   Filter(named: "limit", matching: 5)]
    
    objectAPI.getPlans(in: project, filteredBy: filters) { (outcome) in
        switch outcome {
        case .failure(let error):
            print(error.debugDescription)
        case .success(let plans): // There will be 5 or less plans.
            for plan in plans {
                print(plan.name)
            }
        }
    }

Errors

See the Errors document.

Testing

See the QuizTrainTests Readme.

Entities

Image of Entities

Comments
  • Can't find how to update current run with test cases ?

    Can't find how to update current run with test cases ?

    Any help how to update current run with test cases ? I suppose it should be really easy , but

    var run: Run?

        run.case_ids = [77]
        
        localApi.updateRun(run!) { _ in return }
    

    And it says Value of type 'Run?' has no member 'case_ids'

    opened by VasilijSviridov 3
  • Add support for the new Bulk API Endpoint data structure

    Add support for the new Bulk API Endpoint data structure

    It seems that the latest TR release came with some changes to the GET API endpoints:

    E.g get_cases "These bulk endpoints will no longer return an array of all entities, but will instead return an object with additional pagination fields and an array of up to 250 entities."

    New response content:

    {"offset": 0,
      "limit": 250,
      "size": 250,
      "_links":{
        "next": "/api/v2/get_cases/1&limit=250&offset=250",
        "prev": null
      },
      "cases":[
    	{ "id": 1, "title": "..", .. },
    	{ "id": 2, "title": "..", .. },
    	..
    ]
    }
    

    Any plans to add support for the new data structure in QuizTrain?

    opened by georgev21 1
  • Repair Carthage usability by removing erroneous submodule reference

    Repair Carthage usability by removing erroneous submodule reference

    In order to be able to use Carthage to manage QuizTrain as a dependency, it can't have any missing or broken submodules references in the .gitmodules file. As there are no submodules for QuizTrain as it currently stands, we removed the entire file to get it to work.

    h/t to https://davidwalsh.name/git-remove-submodule for the instructions for proper submodule cleanup

    opened by dlewanda 1
  • Add support for new APIs introduced in TestRail 5.7

    Add support for new APIs introduced in TestRail 5.7

    TestRail 5.7 introduced some new APIs which QuizTrain currently does not support. This includes:

    QuizTrain should add support for these new endpoints.

    enhancement 
    opened by dgallagher-venmo 1
  • Added URL Path and Skip SSL init params

    Added URL Path and Skip SSL init params

    • Resolve issue #20 and #21

    Adding 'path' as optional params allows for QuizTrain to be used in more customized TestRail configuration environments

    Adding ability to skip SSL certification validation allows users to add QuizTrain into in-house projects protected by internal network.

    opened by shaneong 0
  • Add ability to skip SSL certificates as optional initialisation parameter

    Add ability to skip SSL certificates as optional initialisation parameter

    Most TestRail instances are hosted in an internal network, using internally signed server certificates that does not work well with URLSession's internal cert checker.

    Optional parameter should be provided to skip SSL certs through approving URLSessionDelegate

    opened by shaneong 0
  • Bump version from 2.0.0 to 2.1.0.

    Bump version from 2.0.0 to 2.1.0.

    • Increased version from 2.0.0 to 2.1.0 for Cocoapods support.
    • Updated README installation instructions.
    • Updated QuizTrain.podspec spec.version to 2.1.0.
    opened by dgallagher-venmo 0
  • Added support to create new CaseField's over the API.

    Added support to create new CaseField's over the API.

    • Added addCaseField() to API and ObjectAPI.
    • Added NewCaseField models.
    • Added end-to-end and model tests for NewCaseField.
    • Bumped version to 1.2.1.
    • Bumped example project to use 1.2.1.
    opened by dgallagher-venmo 0
  • Accessing files from expired URL

    Accessing files from expired URL

    Hello,

    I'm trying to access the following files documented here but the url appears to have expired: http://blog.venmo.com/engineering/2018/10/19/quiztrain-a-swift-framework-for-testrails-api

    TestManager.swift XCTContextExtensions.swift

    opened by craig-jamieson 1
Releases(2.1.1)
Owner
Venmo
Venmo
A Matcher Framework for Swift and Objective-C

Nimble Use Nimble to express the expected outcomes of Swift or Objective-C expressions. Inspired by Cedar. // Swift expect(1 + 1).to(equal(2)) expect(

Quick 4.6k Dec 31, 2022
The Swift (and Objective-C) testing framework.

Quick is a behavior-driven development framework for Swift and Objective-C. Inspired by RSpec, Specta, and Ginkgo. // Swift import Quick import Nimbl

Quick 9.6k Dec 31, 2022
BDD Framework and test runner for Swift projects and playgrounds

Spectre Special Executive for Command-line Test Running and Execution. A behavior-driven development (BDD) framework and test runner for Swift project

Kyle Fuller 392 Jan 1, 2023
AutoMocker is a Swift framework that leverages the type system to let you easily create mocked instances of your data types.

AutoMocker Context AutoMocker is a Swift framework that leverages the type system to let you easily create mocked instances of your data types. Here's

Vincent Pradeilles 39 May 19, 2022
Boilerplate-free mocking framework for Swift!

Cuckoo Mock your Swift objects! Introduction Cuckoo was created due to lack of a proper Swift mocking framework. We built the DSL to be very similar t

Brightify 1.5k Dec 27, 2022
Mockit is a Tasty mocking framework for unit tests in Swift 5.0

Mockit Introduction Mockit is a Tasty mocking framework for unit tests in Swift 5.0. It's at an early stage of development, but its current features a

Syed Sabir Salman-Al-Musawi 118 Oct 17, 2022
BDD-style framework for Swift

Sleipnir Sleipnir is a BDD-style framework for Swift. Sleipnir is highly inspired by Cedar. Also In Norse mythology, Sleipnir is Odin's steed, is the

Railsware 846 Nov 22, 2022
A convenient mocking framework for Swift

// Mocking let bird = mock(Bird.self) // Stubbing given(bird.getName()).willReturn("Ryan") // Verification verify(bird.fly()).wasCalled() What is Mo

Bird Rides, Inc 545 Jan 5, 2023
A mocking framework for Swift

SwiftMock SwiftMock is a mocking framework for Swift 5.2. Notes on the history of this repo September 2015: first version of this framework November 2

Matthew Flint 257 Dec 14, 2022
Swift framework containing a set of helpful XCTest extensions for writing UI automation tests

AutoMate β€’ AppBuddy β€’ Templates β€’ ModelGenie AutoMate AutoMate is a Swift framework containing a set of helpful XCTest extensions for writing UI autom

PGS Software 274 Dec 30, 2022
A simple and lightweight matching library for XCTest framework.

Match A simple and lightweight matching library for XCTest framework. Getting started Swift Package Manager You can add Match to your project by addin

MichaΕ‚ Tynior 6 Oct 23, 2022
Genything is a framework for random testing of a program properties.

Genything is a framework for random testing of a program properties. It provides way to random data based on simple and complex types.

Just Eat Takeaway.com 25 Jun 13, 2022
A light-weight TDD / BDD framework for Objective-C & Cocoa

Specta A light-weight TDD / BDD framework for Objective-C. FEATURES An Objective-C RSpec-like BDD DSL Quick and easy set up Built on top of XCTest Exc

Specta / Expecta 2.3k Dec 20, 2022
Switchboard - easy and super light weight A/B testing for your mobile iPhone or android app. This mobile A/B testing framework allows you with minimal servers to run large amounts of mobile users.

Switchboard - easy A/B testing for your mobile app What it does Switchboard is a simple way to remote control your mobile application even after you'v

Keepsafe 287 Nov 19, 2022
Remote configuration and A/B Testing framework for iOS

MSActiveConfig v1.0.1 Remote configuration and A/B Testing framework for iOS. Documentation available online. MSActiveConfig at a glance One of the bi

Elevate 78 Jan 13, 2021
AB testing framework for iOS

ABKit Split Testing for Swift. ABKit is a library for implementing a simple Split Test that: Doesn't require an HTTP client written in Pure Swift Inst

Recruit Marketing Partners Co.,Ltd 113 Nov 11, 2022
Keep It Functional - An iOS Functional Testing Framework

IMPORTANT! Even though KIF is used to test your UI, you need to add it to your Unit Test target, not your UI Test target. The magic of KIF is that it

KIF Framework 6.2k Dec 29, 2022
iOS UI Automation Test Framework

Deprecation: EarlGrey 1.0 is deprecated in favor of EarlGrey 2.0 which integrates it with XCUITest. Please look at the earlgrey2 branch. EarlGrey 1.0

Google 5.5k Dec 30, 2022
T - A simple testing framework using closures and errors

t Quickly test expectations What is t? t is a simple testing framework using clo

OpenBytes 6 Nov 7, 2022