The Agent that Rebuilt the Build Host

“Are you done using the Mac yet?” This was a common sentence
I heard uttered though out the offices of the clients I would work at doing
various mobile projects with Xamarin in companies where they only sprung for 1
mac for the mobile team to use to build iOS apps. It was that, or the colorful
choice words from a developer’s mouth when visual studio would crash and the Xamarin
Build host still thought another machine was connected. In fact, unless you
have worked on a Mac Laptop with a Windows VM, you probably have fought with
the build host at some point in time. Thankfully, the Dev Team at Xamarin, has
worked hard to no longer make this a problem in their latest roll out of Xamarin
dubbed Xamarin 4. Their solution to this once plaguing Issue?  Xamarin Mac Agent.

Above: The Toolbox and Banana Finder solutions are connected to the mac at the same time!

Unlike the old build host which ran as a secondary program
on the mac, slow and rather clunky to use and allowing only 1 computer to be
connected at a time, The Xamarin Mac Agent has changed all this by being
rewritten from the ground up giving developers a faster setup and connection
time, while allowing multiple connections to this box at one time. They achieve
this by connecting to the mac over SSH and starting new MSBuildProcess on the
windows side, each managing their own SSH connection to the build host which
them manages the iOS designer, and the Build agent. They also have made the UI
interface of connecting to Visual studio much easier to use and work with, and
a clearly visible connection icon is present when connected to the Xamarin Mac
Agent.

Above: a photo of just how clean and clear the new Xamarin Mac Agent is to the developer.

You can
find out more about how the Build Host works as well as how you can get yourself
up and running using this latest innovation here: https://developer.xamarin.com/guides/ios/getting_started/installation/windows/xamarin-mac-agent/

Advertisements

UI Testing with Xamarin Test Cloud

image

As you may or may not know, Xamarin has released version 1.0
of Xamarin Test Cloud. With that on top of the 60 min a month base Xamarin
gives you to test how your app looks on more than 1,700 devices spanning
android and iOS tablets and phones. This intrigued me, so I decided I wanted to
learn more about how to integrate TC into my projects.

As luck would have it, I have just the demo app I want to
try it out on: my networking & connectivity talk for Xamarin Dev Days
Madison. (For more info see https://ti.to/xamarin/dev-days-madison)
Unfortunately this project is incomplete, but that’s okay because you can keep
updating your code to match, which is awesome as it is not reliant on you to
keep regenerating new projects or code to keep it up to date. While there are
many ways to get your apps into test cloud and your tests started, I started
out by adding a UITest Project to my app in Xamarin Studio. 

You can add it
yourself:

  1. In iOS Ctrl + Click on the solution of the app
    you wish to add the UITest to > Add > Add New Project
  2. From here a window pops up asking you to choose
    a new project. Click on “Tests” in the Cross-Platform Section.
  3. If it is not already Click on UITest Project in
    Xamarin Test Cloud.
  4. Click Next to continue
  5. Name your project and click continue. I like to
    follow the format of appname.platform. so in this case, it would be
    LoginWithMasterDetail.UITest

Now that we have our UITest Project created, we can start getting it set up. There are 2 main files in a new UITest Project Solution, Tests.cs and AppInitializer.cs. The AppInitializer Helps the UITest & Test Cloud find the apk and the ipa for your app for its respective platforms to be run. You can configure it by entering in
.AppBundle (“../../../iOS/bin/iPhoneSumulator/debug/XamarinForms.iOS.app”) ” as an example for iOS. You may have to edit the path to match your environment and avoid and issues along the way and allowing your project to be seen and built. The Test.cs is where the UITests will be stored and run.

You can test for many things in your code from simply “How does it look” to walking through every strep a user would take while using the app. While I recommend looking at the API for the full list of functionality that you can do with UITesting, You can use it to check more complex things like Scrolling Strategy, Change the GPS of the device to simulate physical movement happening, and even the ability to query certain view elements to make a match.

Once your test is built and to your liking, you are ready to move on to getting it deployed to test cloud. For this blog post, I chose to use Xamarin Studio on iOS and deploy to Xamarin test cloud with an iOS app to test with. However if you are more comfortable in the command line, you can deploy it to test cloud from there. You can also deploy to Test Cloud via Calabash which runs in ruby. They both have their own ways to write tests and push code, so use what you are most comfortable with.

To deploy to Test Cloud from Xamarin Studio, you must first must go into the Unit Tests tab on the right hand side of Xamarin Studio. If you do not see it there, you can get to it from the top navigation menu of OSX and go to View -> Sketch (also found by View->Pads->Unit Tests). Once you are there, Ctrl + Click on Test Apps (You can find it by looking for a blue circle with the play symbol inside of it) and choose “Add App Project”. You should see a window pop up that has a list of your projects on it. This shows a list of all compatible project types. Select the projects you wish to deploy to test cloud. (In this case it would be only iOS as that is what I am doing in the demo, however checking both or just android will not affect your results. Once you have selected the projects you wish to run, click okay and you will see that the projects are now listed with info about what target, os, device type it is set to.

Once your project is added to the test list, you can Ctrl + Click on your UI test project (if you are following my naming convention form earlier you would be looking for the one that is .UITest) and chose deploy to test cloud. If you have not already done so, you may want to go to the test cloud site and get your app set up.

NOTE: This is where I got stuck and had to do some research. When I would try to build, it kept failing saying that it could not find my .ipa file. Make sure you Xamarin Studio is set to Debug (nothing after it) and navigate to your [iOS Proj]/Bin/Debug/ folder and look to see if it was there. If not you have to do a build to get it to work. With me, I had done a build but it named the project LoginWithMasterDetailiOS.10.ipa making XS not able to find it. Once you have successfully built the ios app. rename the .ipa file to not have that 10 in the name and you should successfully build.

And that’s it. The rest is rather strait forward, following the steps, choosing what devices and waiting for it to run. Happy Testing!

Unleash Your Inner UI Monkey with Xamarin Test Cloud

For those of you who have not yet heard, all Xamarin Subscriptions
Include Xamarin Test Cloud Device Minutes. This is awesome as any android developer
will know, it’s hard to know what your app will look like when your device
looks proper on all the Android devices in existence (currently there are over
7,000) combine that with all the windows, and ios devices,  it’s hard to know how your app will turn out
looking UI wise.

Now you might be saying “But Mitch, I use <insert one of
the many UI testing services here>, I don’t want to use Xamarin test cloud.”
And you are in your own right to use whatever
service you want, but here are some reasons you would want to.

1.      
You already have time paid for

2.      
Xamarin Test Cloud is an awesome product that
the Xamarin team has been hard at work to develop.

3.      
If you use Calabash or Xamarin UI Test, You are
not getting the full range of devices unless you own them that you could be
with Xamarin Test Cloud.

4.      
A lot of the services out there are mostly for
Phone Gap app UI Testing.

5.      
You can test Xamarin, iOS, & Android apps

I could blab on more about test cloud, but why not try it out
for yourself!  https://xamarin.com/test-cloud

Xamarin University, Certification Studying, and More!

image

Greetings from the Developer Cave!

For those of you who are not aware, on July 17th I
got my Email stating that I am eligible for the Xamarin Certification, and that
made me think back to this past month and all the time I have spent with the
instructors. While at the time of writing, the certification track in Xamarin
University has 15 classes, which is by no means the end to them. At time of
posting there are 67 Classes on a wide variety of topics as well as Guest
Lectures, Lighting talks, and recordings from Evolve Conferences. You also get
8, 30 min one on one sessions with an instructor to ask questions, get code
reviews, architectural guidance, or help with mobile strategy and of course,
you can test for your certification, good for a year from the date you get
certified.

I have spent the month of July going though and taking
advantage of as many classes as I could (yes I know I get a year access) and get
up to speed on all the Xamarin Development goodness. I also am a Visual and Kinesthetic
learning, which makes online classes rather interesting, especially when
creating notes to reference/study from later, which leads into lots and lots
and lots of notes. At the time of writing I have been though 46 of 67 unique classes
(remember, I started in July and posting this on July 20) and at the request of
some of my instructors I am providing proof of these notebooks existence (13 in
total, I also burned out 4 of the Xamarin pens I have gotten as swag over the
years)

image
image

However even with all this exhaustive notation, I still get pretest
anxiety. Why you ask, that is because that the 150 questions on the test are
pulled not only from the classes and material in the class, but also each class
has additional info to read and pull from (each of the 15 classes have at least
2 or more reference links which I could easily double my amount of notebooks to
complete my notations. However, I don’t have that many Xamarin pens to burn
out, so I turned to the web for help and guides. A lot of work has been done by
Xamarin to help people prepare (and some by others who have taken the exam to
help those who have yet to.

While Xamarin provides guidance on their Certification page,
They provide a list of items to review on that page as well but I also fount
links like http://www.kymphillpotts.com/xamarin-certification-exam-study-guide/
, http://xamarino.com/2014/05/studyguide-for-xamarin-mobile-developer-exam/
, and http://www.leftycoder.com/zero-xamarin-30ish-days-xamarin-university-experience/
as all good places that I am using to help me study.

Hopefully things go well…