Xamarin Certification Xamarin Testing and Deployment 1 — Questions and Answers
Question 1: Which testing framework is recommended for unit testing shared Xamarin code?
- NUnit or xUnit (Correct answer)
- Espresso
- XCTest
- Robolectric
Correct answer: NUnit or xUnit
NUnit and xUnit are the standard .NET unit testing frameworks used to test shared Xamarin business logic and ViewModels.
Question 2: What is Xamarin.UITest used for?
- Automated UI testing of iOS and Android apps using C# (Correct answer)
- Performance profiling
- Screenshot diffing only
- Mocking network calls in tests
Correct answer: Automated UI testing of iOS and Android apps using C#
Xamarin.UITest provides an automated UI testing framework that drives real device or simulator interactions using C# test code.
Question 3: Which cloud service provides device farms for running Xamarin.UITest on real physical devices?
- App Center Test (formerly Test Cloud) (Correct answer)
- Firebase Test Lab
- BrowserStack only
- AWS Device Farm only
Correct answer: App Center Test (formerly Test Cloud)
App Center Test (formerly Xamarin Test Cloud) runs Xamarin.UITest suites across hundreds of real iOS and Android devices in the cloud.
Question 4: What does Moq provide in the context of Xamarin unit testing?
- A mocking library for creating test doubles of interfaces and abstract classes (Correct answer)
- A UI automation runner
- A real device connection layer
- An HTTP mock server
Correct answer: A mocking library for creating test doubles of interfaces and abstract classes
Moq is a .NET mocking library used to create mock implementations of interfaces for isolating the unit under test.
Question 5: In Xamarin.UITest, which method is used to locate a UI element by its accessibility label?
- app.Query(x => x.Marked("label")) (Correct answer)
- app.FindById("id")
- app.GetElement("name")
- app.AccessibilityQuery("label")
Correct answer: app.Query(x => x.Marked("label"))
app.Query(x => x.Marked()) locates elements by their accessibility label, text, or Id cross-platform.
Question 6: Which Xamarin App Center feature provides continuous integration and automated builds?
- App Center Build (Correct answer)
- App Center Crashes
- App Center Analytics
- App Center Push
Correct answer: App Center Build
App Center Build connects to source repositories and triggers automated iOS or Android builds on each commit.
Which testing framework is recommended for unit testing shared Xamarin code?