DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Continuous Integration and Continuous Delivery for Xamarin.iOS With VSTS

Continuous Integration and Continuous Delivery for Xamarin.iOS With VSTS

Jakub Jedryszek shares his experiences using Visual Studio Team Services to support Continuous Integration and Continuous Delivery for Xamarin.

Jacob Jedryszek user avatar by
Jacob Jedryszek
·
Nov. 21, 16 · Tutorial
Like (2)
Save
Tweet
Share
4.51K Views

Join the DZone community and get the full member experience.

Join For Free

visual studio team services has great continuous integration and continuos delivery support for xamarin. recently, i was configuring pipeline that would build the project, run unit tests (with xunit), run ui tests (with xamarin test cloud), and, if all tests pass, deploy a new version of the app to hockey app. during the process of creating the vsts build definition, i encountered a few problems that i think are worth to share with you.

to make a basic build definition with building xamarin.ios project and deploying to hockey app with vsts+xamarin check james montemagno’s continuous integration for ios apps with visual studio team services first.

here are the issues i had that were not described anywhere online:

  • i couldn’t use the visual studio test task for running xunit tests because every build definition on vsts can be executed by only one build agent, and to build a xamarin project, i needed the mac build agent.
  • how to run ui tests (with xamarin test cloud) using the same build that would be later on deployed to hockey app. test cloud requires init code that later on shouldn’t be present in deployed app.

running xunit tests with mac build agent

this requires adding two tasks to build definition:

  1. command line task to run tests with mono and xunit console runner.
  2. publish test results task to display results in build summary.

first, install xunit console runner nuget package. to run tests, add a command line task with following settings:

  • tool: mono
  • arguments: packages/xunit.runner.console. 2.1.0 /tools/xunit.console.exe yourapp .unittests/bin/debug/ yourapp .unittests.dll -xml unittestsresults.xml

remember to replace yourapp with your app name and set the same xunit runner version that you have installed.

to publish test results, add the publish test results task with the following settings:

  • test result format: xunit
  • test result files: **/unittestsresults.xml
  • always run: true

running xamarin ui tests with test cloud before deploying to hockeyapp

the solution there is rather simple: build in debug mode that has test_cloud preprocessor directive defined, run tests, and then build again in release mode before deploying to hockey app.

delete files before build

for a while, i couldn’t figure out why my tests are not passing when they were run from vsts while they passed on my machine. it turned out, vsts was using old builds for tests. i am not sure about macincloud , but if you are using your own build agent running on your mac, the directories that contain binary files are not being cleaned up before next build automatically. to avoid using old builds, you can add, at the beginning of your pipeline, a delete files task and delete everything from bin/* and obj/* .

summary

the final build definition looks like this:

azure status vsts build definition

let me know if i missed some details; i would be happy to add them! also, if you know a better way of doing this, let me know as well!

Continuous Integration/Deployment unit test Integration app Delivery (commerce)

Published at DZone with permission of Jacob Jedryszek, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Create Spider Chart With ReactJS
  • Is DevOps Dead?
  • What Is API-First?
  • Key Elements of Site Reliability Engineering (SRE)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: