One Test Script To Rule Them All: True Cross-Platform Test Automation for Video Apps Written in React Native
Write one test script for your app UI, across all devices. From mobile to connected TV devices and everything in between.
This piece was written with consultation from fellow Software Developers in Test, Paul Foster and Simon Granger.
We here at You.i TV challenged ourselves to find a better solution to our testing woes.
Our engine, You.i Engine One, uses a single-codebase approach to deploy TV apps across mobile and tablet, streaming devices, consoles, and Smart TVs–over 11 platforms in total. Using one codebase to deploy the same app makes development stronger, faster, and more flexible.
The only downside? Individually testing the app on each and every device. It’s a pain.
As of today, the process of testing UI is cumbersome. Fast-changing UI elements and expected app behavior can crash tests. It’s very vulnerable.
So we asked ourselves, what if we have one codebase to develop and deploy TV apps, why not do the same for testing? Why not establish a single script for all platform sanity testing?
So, with that in mind, we set out to develop a single-script approach to testing video apps in a cross-platform capacity. That’s right. One test script to rule them all. One app, many devices. We’re calling it the Cross-Platform Test Automation Layer (CPTAL). Here’s how we did it:
Our journey to develop a cross-platform automated testing solution was inspired by our existing work with React Native (RN).
Apps written in RN undergo a binding process into C++ so our engine can process and deploy to every platform we offer.
And that’s where things get interesting. Although RN is primarily used for iOS & Android development, the fact that it’s binding into our engine grants it access to platforms such as PS4, Tizen, and even Roku.
If you’d like a detailed explanation of how we’ve successfully brought RN to 11+ platforms, you can learn more, here.
To summarize, we treated our engine as another platform in the RN library. We know that RN abstracts native iOS and Android controls. So, we added You.i Engine One as a third ‘OS’ layer, which in turn includes every platform we support. That means any control (button, menu, scrub bar, etc.) applied to iOS and Android can be abstracted to a platform we support.
Our engine is able to abstract its underlying features and properties when developing TV applications. The work done via programming languages binding has proven that the technology layer used to create applications is independent of the underlying features of the engine, i.e. Engine functionality/features became mutually exclusive.
All this to say, we determined our CPTAL has to be an integrated layer within our engine. It needs to be similar to our technology layer. A third-party solution cannot grant us the platform reach we desire without You.i Engine One support. Furthermore, we established that our testing layer will be abstracted in order to allow us to include every major testing tool in-market.
Mobile & Beyond
Having RN stretch past mobile into TV devices intrigued us. We decided to investigate further.
First, we needed to decide on a solution that already exists, which specializes in mobile UI test automation. We decided on Appium.
Appium is a tool that is used to automate the UI experience on iOS and Android, only. It uses a server as a middleman to talk to a device and execute commands. The script sends requests to a server, the server connects to a socket in the device and sends commands to the automation layer of the app. For Android it’s one layer, for iOS it’s yet another, each created by their respective companies and Appium unifies this.
If you have the same app, with the same UI running on Android and iOS devices, you should be able to automate it with the same script, right? Appium does just that and it works quite well.
We took that concept and applied it to our new engine testing layer.
Similar to what we devised for our RN abstraction, You.i Engine One is simply another platform in the Appium playground. Which means that apps running the same UI will test for the same control, regardless of device.
If you’re designing your tests correctly, you’re sending actions to the app with a measurable expectation to validate the action succeed. For example; you need to log in to the app on all platforms? The actions are the same; enter a username, a password and press a login button. You then check for a failure message or the proper landing screen.
Since we abstracted our test automation layer, other open source tools such as Detox could be used to leverage the cross-platform test automation feature of the engine.
Any app deployed using our engine has the capability to look and behave the same way. If one of our clients chooses to go down this route, then writing an individual script for every platform, even though we are testing the same function, is a tedious and labor-intensive process that strips away time and resources.
One codebase remedies those pains and gives your test team peace of mind–which is beneficial for everyone involved.
We hope you enjoyed reading You.i TV’s journey in establishing a cross-platform test automation layer for UI testing. If you or your company has devised something similar, let us know because we’d love to continue the conversation!
Are you an existing You.i TV customer and are interested in a CPTAL workshop? Reach out to your Project Manager to set up a session.
Learn more about You.i Engine One