Category: C#

7 Key Decisions for Any New Xamarin Project

While there is no shortage of information out there to help you get started with Xamarin, making the most of the right tools and established best practices can really kickstart your development efforts.

On any new project you’ll face some key questions such as: Xamarin.Forms or Native UI? What architecture and/or frameworks are appropriate? How should I persist the state of my applications? What is the best tooling to test, build and deploy my apps? The choices you make here can be the difference between making a real impact in the early stages of your project and being left reinventing the wheel.

Continue reading “7 Key Decisions for Any New Xamarin Project”

Xamarin.Forms vs Xamarin Native

If you are new to Xamarin, one of the hardest things to understand in the early stages is which flavour of Xamarin to choose. Should you target specific platform UIs with Xamarin.Platform or write a single XAML UI with Xamarin.Forms?

Why are there two choices? How is the Xamarin newcomer supposed to choose? And why can it seem so difficult to get a straight answer?

Continue reading “Xamarin.Forms vs Xamarin Native”

Talk: Test Automation in Practice with Xamarin Test Cloud

This is a talk I did for the SWmobile group with Kevin West back in February 2016. The practical advice from the talk is covered in 5 Common Pitfalls of UI Test Automation.

Why do UI Automation projects often fail? With many automated test frameworks, getting started with your first few tests is the easy part. Building a sustainable, flexible test suite that gives you valuable data on the quality of your applications can be daunting to say the least.

Let us take you from those first few tests to an end-to-end BDD process that has become part of our everyday work. Discover how having rejected the idea of a dedicated QA team, the core development team take responsibility for quality and invest in a process that delivers value for them.

Learn how Test Cloud solves many of the issues that typically derail automation projects, how to handle ongoing maintenance, how to maximise test reuse between platforms and how adopting the Page Object pattern can help build test cases that can handle even a complete UI redesign with ease.

Use Explicit Interface Implementation to Hide Visitor Traversal

The Visitor Design Pattern is a great way to separate your model data and relationships from the operations you want to perform on that data. However, there are some downsides to using it, one of which we can mitigate by taking advantage of explicit interface implementation in C#.

Continue reading “Use Explicit Interface Implementation to Hide Visitor Traversal”

An OO Application Technical Test Strategy

As the Test Pyramid tells us, unit and integration tests should make up the bulk of our test strategy. But where we draw the line between the two, how they complement each other and their relationship with our acceptance tests can be a source of confusion.

Building on my Hexagonal Architecture series of posts, I’ll walkthrough an example that outlines my usual strategy for technical tests by building the test configuration of a Ports and Adapters application.

Continue reading “An OO Application Technical Test Strategy”

View Model Navigation by Convention in MVVM Light

Having not used MVVM Light for a while, I came back to it recently to put together a small Xamarin.Android app. It’s a great toolkit and I’d forgotten just how quickly you can get up-and-running with navigation, bindings and tests.

When it comes to hooking up the NavigationService, i’ve started to adopt a view model navigation pattern that differs from the usual MVVM Light navigation examples.

Continue reading “View Model Navigation by Convention in MVVM Light”

Automatically Generating NUnit Test Cases

I recently came across a need to populate the TestCase attribute of an NUnit test case programatically.
In case you’re not familiar with TestCase, here’s an example:


    [TestCase(1, 1, 2)]
    [TestCase(1, 2, 3)]
    [TestCase(2, 2, 4)]
    public void APlusBEqualsC(int a, int b, int c)
    {
        Assert.AreEqual(c, a + b, $"Expected {a} + {b} = {c}");
    }

As is hopefully clear from the sample above, TestCase lets you vary the inputs to an NUnit test method while reusing the test code itself.
For each TestCase attribute supplied, a new test is created using the supplied parameter list.

But what if you want to generate these TestCase attributes through code?

Continue reading “Automatically Generating NUnit Test Cases”