XCFit 7.0 Released: XCTActivity, New Xcode Templates and Multiple CI Services Support

The new version of XCFit-7.0 has been just released with some new features. XCFit already supports for Xcode 9 and Swift 4 as part of version 6.0 release. XCFit is Full Stack Protocol Oriented BDD in Xcode for iOS app with Swift using XCUITest. XCFit allows us to write BDD Style API/Contract level, UI and Acceptance Test with Swift in human readable language using tools like Given/When/Then format. In this short post, we will see what’s new in XCFit-7.0.

XCFit 7.0

This version has some new features like XCTActivity, New Xcode Templates and Continuous Integration services support. We will see following new things in details

  • XCTActivity Support
  • New Xcode Templates for Xcode 9 and XCTActivity Support
  • Multiple Continuous Integration Services Support for XCFit

XCTActivity Support

UI Tests are usually long-running and a lot of actions happening there e.g tapping buttons, swiping etc. As of now,  XCTest reports show all the actions in the test reports which is not particularly readable. Activities are the way to organise those actions into the group by giving a meaningful name so XCTest result will use that activity name in the result to make it more readable. You can read more about activities on Apple official documentations here
We can sprinkle activities on any set of actions e.g launch app in clean state

When we run the test then in the test report we will see “Given I have launched the app in clean state”  which is more readable. We can still access underlying actions by expanding the activity.

XCFit pre-defined steps are now supported by XCTActivity. All the steps now wrapped in the XCTActivities so that Xcode reports will be readable. You will see this in the demo video at the end of this post.

New Xcode Templates

If you have used XCFit then you probably know that XCFit provides Xcode templates to get started with Protocol Oriented BDD within Xcode. The XCFit templates can be installed using Rubygem

You may need to use sudo  if you are using system (pre-installed) Ruby(2.0). XCFit gem will be used to set all the Xcode Templates for Xcode. Current Xcode Templates has Xcode group structure which looks like this

Protocol Oriented BDD Template

  • Feature.swift

This file has It’s your feature will all the requirements (tests) which can be implemented as Acceptance tests. This file contains Swift protocols.

  • FeatureSteps.swift

This file contains template code how to implement step definition for the given feature using Swift extension on top of feature protocols. It also has the examples how to use XCTActivity while implementing step definitions.

  • FeatureElements.swift

This file contains all the XCUIElements related to the feature. We can store all the XCUIElements in the form of Swift enums.

  • UITestBase.swift

This is a base class for all the Tests. Once XCFit imported then we can extend this class with XCFit to get the pre-defined steps. This class has all the setup and teardown code.

  • YOUR_TARGET_Test.swift

This is actual test file where you call Given When Then from Extensions. This class extends UITestBase class which has all the required setup to get started.

Hope this new templates will be handy to setup protocol oriented BDD for any iOS project.

Top 5 Cloud CI Services Supports

Recently, I ran an online Olympics of the top 5 Cloud-based CI services and evaluated against XCFit. The cloud-based CI Services involved are

There are detailed blogs of how they have performed which are linked below

  1. Introduction to iOS CI Olympics
  2. iOS CI Olympics-Player One: BuddyBuild
  3. iOS CI Olympics-Player Two: Bitrise
  4. iOS CI Olympics-Player Three: TravisCI
  5. iOS CI Olympics-Player Four: Nevercode 
  6. iOS CI Olympics-Player Five: CircleCI 
  7. Announcing Winner of the 2017 Cloud iOS CI Olympics

As a result of this Olympics, every commit of XCFit is being tested against all these cloud-based CI services.

The builds are configured for each CI services which execute the unit and UI tests for the XCFit. The status of each build is being displayed in the README as shown below.

 

Video Demo: XCFit 7.0

Below is approx 6 min Youtube video showing a usage of new XCFit features and how to use with Xcode 9 and Swift 4. This video demonstrates XCFit from scratch.

[embedyt] http://www.youtube.com/watch?v=m2u0CGiwV_8[/embedyt]

Enjoy the new features of XCFit. Happy BDD for iOS app !