Simple project with clean architecture
Supported languages:
Create an application capable to read urls from Star Wars API, displaying these information in an application of type master-details. The requirements raised for this assignment shall test concepts of:
Requirements | |||
ID | Name | Description | |
REQ001 | Read QR Code | Application must be able to read an URL from a QR Code image, storing the collected data locally | |
REQ002 | Display people list | Display to the person a list with all read people containing, at least, person’s name and URL | |
REQ003 | Display user details | When click on a list item, application must display person’s details including a list of movies that that character was part of. Among the details; | |
REQ004 | Allow information caching | All information once loaded from web into app must be persisted locally and accessible offline | |
REQ005 | Allow URL typing to gather character information | In order to enable emulator use and automation testing app must provide another way to collect character information that doesn't make use of the camera sensor | |
REQ006 | Internationalize the application | Add support for portuguese language |
Figure 01: sample qr codes generated on: http://br.qr-code-generator.com/
Individual images can be found here
One of the most importants gains that the MVP pattern brings to the project is the fact that all business logic gets isolated on Presenter Layer, it means, all code worthy to be tested is well encapsulated on classes with low dependency on OS components. This pattern alied with a Dependency Injection Container and Mock Frameworks (such as Mockito and PowerMockito) allows the developer to take full advantage of Unit Tests.
Despite the good coverage - over the classes that are worthy testing - it is always a good idea to include automation tests on the project. Currently, the offical adviced automation tool is Espresso that counts with a faboulous tool embbeded on Android Studio that lets the developer record automation steps while manipulation the app as an user. In order to develop this concept, the following story was created:
Test Scenarios | |
ID | Description |
S001 | As an user I should be able to: - start the application; - click on left corner menu to manually insert a character's URL; - Type the URL and hit okay; - See that the application has loaded the information correponding the typed URL on the screen; - Check that the name is correct; |
Figure 02: sample automation test generated using Espresso
OkHttp: “(...) HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth. OkHttp is an HTTP client that’s efficient by default:
OkHttp perseveres when the network is troublesome: it will silently recover from common connection problems. If your service has multiple IP addresses OkHttp will attempt alternate addresses if the first connect fails. This is necessary for IPv4+IPv6 and for services hosted in redundant data centers. OkHttp initiates new connections with modern TLS features (SNI, ALPN), and falls back to TLS 1.0 if the handshake fails. Using OkHttp is easy. Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks. OkHttp supports Android 2.3 and above. For Java, the minimum requirement is 1.7…”_
Gson: “(...) A Java serialization/deserialization library that can convert Java Objects into JSON and back…”
RxAndroid: “(...) ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming...”
In order to make this application work, follow the steps below:
Copyright 2017 Uzias Santos Ferreira
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.