You better test yourself before you wreck yourself — App Testing
The first must-have is the specifications which describes what each thing in the app should be/is doing. Afterwards, backend has to write unit tests for parts which contain business logic and integrate them into their integration and deployment workflow. This is where unit tests come in handy. Unit tests should be written to test just the code
Unit tests should be performed by testing just the code, without testing the UI or anything else (filtration functions, sorting functions etc.) throughout the specification list.
Next on the list are UI tests, which are basically visual tests (clicking on this does this, clicking on that does that), everything must perform the way it was planned, no exceptions.
Integration tests are optional but they are still very useful. Integration tests are used for workflow testing (testing how parts of the app interfere with eachother).
Finally, the acceptance test which is performed by QA or PM (going through user stories and checking if it fits them). Afterwards, QA test which means testing the app in different conditions (using thousands of random ways for testing purposes).
The most important tests for developers are Unit and UI, they consume a lot of time but they force you to write clean code in order make the test process much easier. NOTHING goes into production until it passes all the tests.
THERE ARE NO EXCEPTIONS.
Mobile Technology is transforming the way people use their cell phones. Although demand is highest for consumer apps, enterprise applications are evolving too, allowing businesses to work more productively. Right from Publishers, Retailers, Automobile Dealers, Financial Service Providers, Pharmaceuticals & Healthcare Providers, the mobile application usage trend has now extended to schools and Universities providing faster interaction between staff and students.
Due to the ever-growing demand for mobile apps, decision makers are focusing on creating mobile strategies and roadmap before implementing the application for their users. It is important to build an app with all features and functionality required by the customer and which is beneficial to the app user, but it is even more critical to have a rigorous mobile testing plan before the mobile app is deployed. A comprehensive plan gives customers the confidence that the app will function as intended on different devices with varying screen sizes, resolutions, internal hardware, operating systems and across telecom operator networks.
Mobility Testing Process
A typical end-to-end mobile testing process, should start from creating test cases of the application, performing user acceptance and finally device testing stage.
Developers need to understand the whole picture of each feature and how it relates to the rest of the system. In my experience, it’s important to drive UI development with examples, and, where there is much business logic, executable tests. Tests that serve as specifications become living documentation later on. Push test automation down as far as possible. If you can test an algorithm at the unit, API or service level, by all means, do so. But there can be a good ROI on testing business rules at the UI level.
Today’s test frameworks and drivers allow us to do powerful test automation at the user interface level. While automation can provide documentation and a safety net for future changes, the UI must still be judged by human senses. Experienced exploratory testers are a must, and they should consider pairing with actual customers or customer proxies to make sure the user experience is good enough.
Be sure to develop your user interface testing features incrementally and iteratively. Have you ever tried to develop a five-step UI wizard only to reach the deadline with four steps completely finished but the fifth step completely missing? That’s of no use to anyone. Identify a “thin slice” or “steel thread” through the five steps, and start there. It might be as simplistic as navigating from one page to the next, with no real functionality. But that is code you can write, test, automate tests for and show to your customers. Then you can incrementally flesh it out with more features. You might still be missing a few features by the deadline, but your five-step wizard is usable anyway.
Be sure to measure outcomes once you deliver to production, too. Our jobs don’t end with the release. Find ways to get feedback about whether the UI provided an adequate user experience and met business goals. Use that information to drive not only future features, but also your approach to testing them.“
Android testing (unit/UI tests)
Espresso is the latest Android test automation framework that got open-sourced by Google, making it available for developers and testers to hammer out their UIs. Espresso has an API that is small, predictable, easy to learn and built on top of the Android instrumentation framework. You can quickly write concise and reliable Android UI tests with it.
It’s quite reliable, synchronizing with the UI thread and fast because there is no need for any sleeps (tests run on same millisecond when an app becomes idle). But it does not have support for webviews as well.
Calabash is a cross-platform test automation framework for Android and iOS native and hybrid applications. Calabash’s easy-to-understand syntax enables even non-technical people to create and execute automated acceptance tests for apps on both of these mobile platforms. Calabash’s tests are described in Cucumber and then converted to Robotium or Frank in run time. It supports about 80 different natural language commands (controllers), and new controllers can be implemented in Ruby or Java.
JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit.
JUnit is linked as a JAR at compile-time; the framework resides under package for JUnit 3.8 and earlier, and under package for JUnit 4 and later.
A research survey performed in 2013 across 10,000 Java projects hosted on GitHub found that JUnit, (in a tie with slf4j-api), was the most commonly included external library. Each library was used by 30.7% of projects.
A JUnit test fixture is a Java object. With older versions of JUnit, fixtures had to inherit from , but the new tests using JUnit 4 should not do this. Test methods must be annotated by the annotation. If the situation requires it, it is also possible to define a method to execute before (or after) each (or all) of the test methods with the ) and ) annotations.
iOS testing (unit/UI tests)
A couple of testing frameworks with examples provided.
With the proliferation of iOS devices year over year, the threshold of iOS success is higher than ever before. More companies like startups and SMEs find it not financially sustainable to acquire every piece of iOS devices with different OS versions and HW specs. On the other way, testing apps or games manually is not anymore an ideal option for QA process due to low efficiency and scalability issue.
Though iOS is still a more closed operating system compared to Android, many open source test automation frameworks and tools can be utilized to create robust automated tests. Along with the help of a cloud-based testing solution, it enables developers/testers to verify app quality more efficient in a scalable way and makes iOS testing tasks easier.
Today we’d like to go through 5 widely used iOS testing frameworks nowadays with simple code samples to give you a basic understanding of getting started with your iOS testing. If you are also interested in Android test automation frameworks, do not forget to check out Top 5 Android Testing Frameworks, where code samples are provided as well.
Appium is popular due to its flexibility and usability on both Android and iOS, and it works on native, hybrid and web applications. For iOS testing, it uses JSONWireProtocol to engage with iOS applications using Selenium WebDriver. Thanks for that, Appium does support mobile web testing very well and its use cases are very similar as if Selenium would be used for web testing.
2. XCTEST / KIF
XCTest is tightly coupled with Xcode but is still usable with both real iOS devices and simulators. XCTest allows developers to write tests for components at any level and also provides the framework for UI testing capabilities. XCTest tests are grouped into subclasses of XCTestCase. Writing any tests with XCTest should be trivial to iOS developers as XCTest is fully compatible with both Objective-C and Swift.
KIF (Keep It Functional) is an iOS integration test framework that is closely related to and uses XCTest test targets. KIF tests can be executed directly in XCTestCase or any subclass. KIF allows for easy automation of iOS applications by leveraging the accessibility attributes that the OS system makes available for those with visual disabilities.
Calabash is another great cross-platform framework that works perfectly with Android and iOS apps. One of the major differences to other frameworks is that Calabash tests are written in Cucumber. That means the test is written like a specification and is simple and easy to read even for non-tech people, but still executable by the automation system.
To some degree, EarlGrey is the ‘Espresso for iOS’. It’s also developed and open sourced by Google. Google uses this test framework to test many iOS native apps including Google Calendar, YouTube, etc. As the codename goes, lots of similarities can be found between Espresso and EarlGrey. For example, EarlGrey tests will automatically wait for events (animations, network requests etc.) before trying to interact with the UI.
5. JEST / JASMINE
BONUS: UI AUTOMATION
The Automation instrument has a complete element hierarchy that represents your app’s user interface. To view that hierarchy, use the logElementTree method to write an outline of it to the log.
Though iOS app testing is totally different than Android app testing, you can use either Appium or Calabash to create test scripts that can be used to do crossplatform testing. That being said, every framework has its advantages and everyone of you have different needs for the projects you are working on. It’s recommended to do some further research, learn more about each framework and choose the one you are comfortable with. Happy iOS testing.
Additional informative material (YouTube)