Ir al contenido

Documat


Resumen de Automated Test Case Generation for RESTful Web APIs: Towards a Testing as a Service Model

Alberto Martín López

  • español

    Las interfaces de programación de aplicaciones (APIs) web permiten a los sistemas software interactuar entre sí a través de la red. Las APIs web son la piedra angular de la integración de software, ya que permiten acceder a datos y operaciones a través de Internet de una manera estándar, mediante interacciones HTTP. Las APIs web modernas suelen seguir el estilo arquitectónico REST (REpresentational State Transfer), siendo denominadas APIs web RESTful (o simplemente APIs REST). Las APIs REST están muy extendidas en la industria. Muchas empresas como Google, Twitter o Netflix las utilizan para exponer sus servicios a otras aplicaciones externas y a usuarios finales, así como para integrar sus propios servicios internamente. Dado el extendido uso de las APIs web, y especialmente de las APIs REST, resulta fundamental probarlas de manera exhaustiva, puesto que muchos sistemas dependen de ellas. Las pruebas manuales de APIs son una práctica común en la industria, sin embargo, se trata de una tarea tediosa, propensa a errores, y que consume una gran cantidad de tiempo. En los últimos años, la automatización de pruebas de APIs REST se ha convertido en un tema de interés tanto para el mundo académico como para el industrial. La academia ha centrado su investigación principalmente en la generación automatizada de casos de prueba, empleando sobre todo técnicas (pseudo-)aleatorias para derivar casos de prueba a partir de la especificación de la API. La industria, por otra parte, se ha centrado principalmente en la provisión de herramientas fáciles de usar que permitan diseñar casos de prueba de una manera sencilla (aunque de forma manual) y automatizar su ejecución. Al mismo tiempo, algunas empresas como RapidAPI y Sauce Labs están concentrando sus esfuerzos en el desarrollo de plataformas de Pruebas como Servicio (TaaS), a través de las cuales ofrecen servicios continuos (24/7) de pruebas y monitorización de APIs web, de acuerdo a diferentes planes de precio. Como consecuencia, existe una clara brecha entre academia e industria, ya que los enfoques de investigación se centran en automatizar la generación de casos de prueba (pero con resultados limitados a entornos controlados), y las soluciones industriales dan prioridad a la automatización de la ejecución de las pruebas. El objetivo principal de esta tesis doctoral es proporcionar soluciones para la automatización de pruebas de APIs REST, con la finalidad de avanzar el estado del arte impulsado por las necesidades de la industria. Con este propósito, presentamos un conjunto de algoritmos, técnicas y herramientas para automatizar el proceso de pruebas completo, incluyendo la generación de casos de prueba, la ejecución y el reporte de resultados, y evaluamos las soluciones propuestas en escenarios realistas, incluyendo APIs comerciales utilizadas por millones de usuarios. En concreto, nuestras contribuciones principales son las siguientes: 1) presentamos técnicas innovadoras de generación de casos de prueba para APIs REST, por ejemplo, las pruebas con soporte para restricciones, que permiten probar APIs que presentan restricciones complejas entre sus parámetros de entrada (p. ej., YouTube, Stripe y Yelp); 2) integramos esta y otras técnicas de pruebas en RESTest, un framework de pruebas de caja negra para APIs REST que incluye diversas estrategias de generación de casos de prueba y datos de prueba; 3) reducimos la necesidad de intervención humana en el proceso de pruebas mediante la aplicación de técnicas de inteligencia artificial; y 4) proponemos un ecosistema de pruebas completo basado en RESTest que permite la generación continua y automatizada de pruebas para APIs RESTest, alcanzando un nivel de automatización y exhaustividad muy superior al modelo de TaaS ofrecido actualmente en la industria. Gracias a este ecosistema, hemos encontrado más de 200 errores con un alto grado de automatización en APIs populares como Spotify, Marvel y Foursquare. Nuestros reportes de errores han ayudado a los desarrolladores a mejorar sus APIs, incluyendo correcciones de errores y actualizaciones de documentación en las APIs de Amadeus y YouTube. En definitiva, esta tesis propone enfoques novedosos para aumentar la automatización y la exhaustividad de las pruebas de APIs REST, y sienta las bases para el avance hacia un modelo de TaaS en el que las APIs se prueban y supervisan continuamente, mejorando la fiabilidad de los sistemas orientados a servicios.

  • English

    Web Application Programming Interfaces (APIs) allow software systems to interact with each other over the network. Web APIs are the cornerstone of software integration since they provide a uniform and standard way to access data and functionality over the Internet, via HTTP interactions. Modern web APIs typically follow the REpresentational State Transfer (REST) architectural style, being referred to as RESTful web APIs. RESTful web APIs are widespread in industry. Many companies such as Google, Twitter or Netflix use them to expose their services to other third-party applications and end users, as well as to integrate their own services together. Given the pervasiveness of web APIs, and especially RESTful APIs, testing them thoroughly is critical, as many systems depend on them. Manual testing of APIs is a common practice in industry, nonetheless, it is time-consuming and error-prone. RESTful API testing automation has become a popular topic in both academia and industry in recent years. Academia has focused its research mainly on the automated generation of test cases, mostly employing (pseudo-)random techniques to derive test cases from the API specification. Industry, however, is primarily concerned with the provision of usable tools that help design test cases more easily (although still manually) and automate their execution. In parallel, some companies such as RapidAPI and Sauce Labs are shifting towards the Testing as a Service (TaaS) model, where they offer continuous (24/7) testing and monitoring services of web APIs, according to different pricing plans. As a result, there is a clear gap between research approaches— concentrated on automated test case generation, but with evaluation results limited to lab settings—and industrial solutions—focused on automated test case execution. The main goal of this dissertation is to provide solutions for the automated testing of RESTful APIs, with a focus on advancing the state of the art driven by industrial needs. To this end, we present a set of algorithms, techniques and tools to automate the whole testing process, including test case generation, execution and reporting, and we evaluate the proposed approaches in real-world scenarios, including commercial APIs used by millions of users. In particular, we make the following contributions: 1) we present innovative test case generation techniques for RESTful APIs such as constraint-based testing, enabling the testing of highly constrained APIs such as YouTube, Stripe and Yelp; 2) we integrate this and other techniques into RESTest, a black-box testing framework for RESTful APIs supporting varied test case and test data generation strategies; 3) we reduce the need of human intervention when testing APIs by leveraging artificial intelligence techniques; and 4) we propose a comprehensive testing ecosystem based on RESTest that enables the automated and continuous testing of APIs, shifting the model of TaaS currently offered in industry to a new level. With this ecosystem, we have found over 200 bugs in a highly automated fashion in popular APIs such as Spotify, Marvel and Foursquare. What is more, our reports have guided developers on improving their APIs, including bug fixes and documentation updates in the APIs of Amadeus and YouTube. All in all, this dissertation establishes novel approaches to make the testing of RESTful APIs more automated and thorough, and it paves the way towards a TaaS model where APIs are continuously tested and monitored, improving the overall reliability of service-oriented systems.


Fundación Dialnet

Mi Documat