CRAIS - Testing, everywhere

Aniello Barletta, PyCon 6, April 17-19 2015, Florence

Presentation Agenda

(AKA What i'll do to improve the quality of your sleep..)

1. Who am I

2. What I do

3. CRAIS Platform & Architecture

4. CRAIS in our QA Automation Platform

5. CRAIS Evolutions & Future plans

6. Demo / Q&A Session

BUT FIRST..

A program that has not been tested does not work.

 

(Bjarne Stroustrup, The C++ Programming Language,

October 1985)

If a defect is known at the initial stage then it should be removed during that stage/phase itself rather than at some later stage. It's a recorded fact that if a defect is delayed for later phases it proves more costly. A defect if identified and removed during the requirement and design phase is the most cost effective, while a defect removed during maintenance is 20 times costlier than during the requirement and design phases.

WHO AM I

Hi, I'm Nello :)

Actual Employement:

QA Automation Engineer / Tech lead @ Buongiorno

(NTT DoCoMo Group)

 

Past Employements:

1. Software Analyst (Telecom Italia, Telecom Matrix, Wind, INPS)

2. Test Engineer (Ericsson)

3. Network Engineer / System Administrator (Scolarship @ National Research Council, Cybernetic Department)

WHAT I DO

WHAT I DO

 

1. Active QA Infrastructure Maintenance (Update & Deploy processes, Network analysis, Debugging etc..)

 

2. New Features Planning, Design & Develop, along with the QA Manager & the stakeholders

 

3. Test Suites & External Libraries Development

using both Javascript (less) & Python (more)

CRAIS

Platform & Architecture

Appium Broker on steroids pt.1

CRAIS permits to spawn / respawn Appium Instances over:

1. USB Hotplug recognition (ADB / libimobiledevice)

2. Remote Method Invocation Mechanism (WIP, PyRO)

 

Main Features:

Automatic Device recognition (Android & iPhone at now)

Simple configuration (based on ConfigObj Module)

Secure (ZODB transactions & Serpent serialization for RMI)

Easy to Bootstrap

Ehm.. Appium?

Appium is an open source mobile automation tool for iOS and Android.

 

  • Appium does not require any modification to the source code of your application before running tests.
  • Since Appium uses the Selenium JSON Wire Protocol, you can write your tests in any language supported by Selenium.
  • Appium uses first-party automation frameworks from Apple and Google, so tests replicate user behavior very accurately.

 

Sorry again, ZODB?

The ZODB is a native object database, that stores your objects while allowing you to work with any paradigms that can be expressed in Python. Thereby your code becomes simpler, more robust and easier to understand.

Also, there is no gap between the database and your program: no glue code to write, no mappings to configure.

  • Transparent persistence for Python objects
  • Full ACID-compatible transaction support (including savepoints)
  • History/undo ability
  • Efficient support for binary large objects (BLOBs)
  • Pluggable storages
  • Scalable architecture

 

__really__ sorry, PyRO?

Pyro means PYthon Remote Objects. It is a library that enables you to build applications in which objects can talk to eachother over the network, with minimal programming effort.

You can just use normal Python method calls, with almost every possible parameter and return value type, and Pyro takes care of locating the right object on the right computer to execute the method.

It is designed to be very easy to use, and to generally stay out of your way. But it also provides a set of powerful features that enables you to build distributed applications rapidly and effortlessly.

Pyro is written in 100% pure Python and therefore runs on many platforms and Python versions, including Python 2.x, Python 3.x, IronPython, and Pypy.

Appium Broker on steroids pt.2

CRAIS

How we use it?

Selenium GRID Extension

Grid uses a DefaultCapabilityMatcher to match the machine(Node) requested by test script in the grid setup. Currently it uses only the Platform, Browser and its version to find the requested node.

 

This can be extended to match the Android / iPhone device ID or the System Type or any other Machine configuration to decide the node -> device_id

 

Selenium GRID Extension

import org.openqa.grid.internal.utils.DefaultCapabilityMatcher;
import java.util.Map;
 
public class MyCapabilityMatcher extends DeviceCapabilityMatcher {
    private final String device_id = "device_id";
    boolean allCapabilitiesAvailability = false;
    @Override
    public boolean matches(Map<String, Object> nodeCapability, Map<String, Object> requestedCapability) {
        boolean defaultCapabilitiesAvailability = super.matches(nodeCapability, requestedCapability);
        if (! requestedCapability.containsKey(device_id)){
            return defaultCapabilitiesAvailability;
        }
        else{
            boolean nodeOSAvailability = nodeCapability.get(nodeOS).equals(requestedCapability.get(nodeOS));
            allCapabilitiesAvailability = (defaultCapabilitiesAvailability && nodeOSAvailability);
            return allCapabilitiesAvailability;
        }}}

 

Selenium GRID Extension

{
  "host": null,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.crais.DeviceManager",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,

  "cleanUpCycle": 5000,
  "timeout": 300000,
  "browserTimeout": 0,
  "maxSession": 5,
  "jettyMaxThreads":-1
}

 

Selenium GRID Extension

java -cp *;. org.openqa.grid.selenium.GridLauncher -role hub -capabilityMatcher MyCapabilityMatcher -hubConfig hubconfig.json

Ta-Daaaaa!

#SHOWTIME

CRAIS

Evolutions & Future Plans

Evolutions & Future plans

1. Complete CRAIS Implementation

 

2. Extend CORE & RMI functionalities

(On-demand emulators creation, route test by device specifications etc..)

 

3. CRAIS Cluster -  Manage HA using ZEO

ZEO, Zope Enterprise Objects, extends the ZODB machinery to provide access to objects over a network

 

Q / A Session

Thank You!!

Github: https://github.com/shadeimi

Twitter: https://twitter.com/sh4deimi

Linkedin: it.linkedin.com/in/aniellobarletta

crais

By Aniello Barletta

crais

CRAIS Presentation / PyCon 2015

  • 950