Visual Studio Mobile Center is now Visual Studio App Center. Learn more here.
Five-star mobile apps are all about consistent and predictable output. It’s not a good experience for users when an app suddenly crashes or doesn’t format correctly on their mobile screens. Developers can easily avoid these scenarios by testing for various scenarios on different devices, and Visual Studio Mobile Center makes it easy to test your mobile applications on a diverse set of unique physical devices with different configurations.
Visual Studio Mobile Center makes it easy to test Android and iOS mobile apps with features such as:
- Technology Agnostic Testing: Tests can run on mobile apps written using C# (Xamarin), Java, Objective-C or Swift.
- Diverse Device Configurations: Select from hundreds of unique physical devices with configuration specifications including model, OS version, and hardware specs.
- Support for Multiple Test-frameworks:Choose from different test frameworks, such as Appium, Calabash, Espresso, or Xamarin.UITest.
- Detailed Log and Error Report: Along with screenshots for each step you requested, Visual Studio Mobile Center also provides a detailed test report with stack-trace in case an error occurs while executing the test.
Xamarin Test Recorder
Writing tests is easy with Xamarin Test Recorder. Add a Xamarin.UITest project in your solution and point to an existing project. Use the
record button to launch your app on a device and follow the UI to record tests, which can be run inside Visual Studio Mobile Center.
public void TranslateItTestRun()
app.Tap(x => x.Marked("UsernameEntry"));
app.EnterText(x => x.Marked("UsernameEntry"), "This is fantastic!");
app.Tap(x => x.Marked("RegisterButton"));
app.Tap(x => x.Marked("TextToTranslateEntry"));
app.EnterText(x => x.Marked("TextToTranslateEntry"), "welcome");
app.Tap(x => x.Marked("TranslateButton"));
app.WaitForElement(x => x.Marked("TranslatedTextLabel"), "Time out!", new TimeSpan(0, 0, 0, 10));
app.Screenshot("Tapped on view with class: AppCompatButton with text: Translate with marked: TranslateButton");
You can also write tests manually using the frameworks mentioned above. Here’s a code-snippet to log in inside the app and test a translation. Using Mobile Center CLI (with Node.js) this test project, along with the original APK/IPA, can be uploaded directly to Visual Studio Mobile Center. It will then run all the required tests and provide you with detailed results.
Setting Up Build Automation with Tests
Run these tests automatically by configuring build automation to execute these tests whenever there is a new build.
Testing mobile apps for all possible scenarios and circumstances is one way to make sure your app gives predictable and consistent results. Visual Studio Mobile Center makes it easy to test all of your mobile apps on a diverse set of unique physical devices with different configurations. To make sure the quality of your mobile apps isn’t compromised, there’s also an option to run these tests automatically for every build.
The sample used for this blog post can be found on my GitHub