Work

Incremental Modular Testing in Aspect Oriented Programing

Year: 2016
Type: dissertation
Abstract: Developing good quality software is a hard task.The development cycle is composed of several tasks that must fit perfectly in order to produce software that is usable, maintainable, reliable, extensible and secure.The reason why it is so hard to attain these goals is that software is extremely complex.A large software product is composed of several parts that must be perfectly integrated like in a giant jigsaw puzzle.If done correctly, the parts that compose a software product, let us call them modules, are going to be as loosely coupled as possible.Modules should need to know as little as possible about the inner workings of other modules.This so-called modularity is of paramount importance as it makes modules more understandable, autonomous and promotes reusability.The ideal scenario would be one where each module is only responsible for one concern.Developing software would then be a question of composing these modules together.Unfortunately, although software development paradigms and techniques are surely focused in achieving this perfect separation of concerns, there are still some concerns that get inevitably scattered and tangled throughout the code.Aspect Oriented Programming (AOP) is a paradigm that promises to tame these crosscutting concerns and separate them into their own units of modularity.The way it proposes to do so is to enable the developer to pinpoint specific points of interest in the code, using a domain specific language, and then inject context aware code into those points.In this way, a concern that used to be scattered, can be contained and still affect many different parts of the code.Software testing provides stakeholders a measure of the quality of the software being produced.It is one of the activities of the development cycle and is extremely important in order to achieve good quality software.Unit testing is specially v important when we are trying to create modular software, as it allows testing each module almost independently from others.Unfortunately, as we will show in this thesis, using AOP hinders the usage of unit testing.You can either throw away part of the modularity gained by using it or drop some unit tests.This happens due to the capability of AOP to change the behavior of existing modules, making tests that have been specifically created for those modules only work when the AOP code is not present.Changing the tests to account for the AOP code breaks the modularity, and the only other existing option is to remove those tests.In this thesis, we propose using semi-automatic code inspection to create a tree of the dependencies between modules and use an incremental testing approach that allows each software layer to be tested in isolation.As layers are added, one after the other, if a certain part of the code breaks a previous test, it will be possible to mark the broken tests as being replaced by new tests that take into account the modifications that have been introduced by the AOP code.This allows unit tests in lower layers to still be usable without breaking the modularity promised by AOP.A testbed was created to test the proposed approach and we were able to create and use unit tests that would otherwise be impossible to run in the complete system.We also showed how the approach is able to tackle some AOP specific software faults.To help with the tests, we developed a reference implementation of a support tool.We believe that the approach being presented solves an important problem that prevents the adoption of AOP from being more widespread.We do not assume to have solved all AOP problems, but we think this thesis presents an important step in the right direction as it enables a more sane usage of tests in conjunction with aspects.vi Resumo O desenvolvimento de software de boa qualidade é uma tarefa complicada.O ciclo de desenvolvimento é composto por várias tarefas que têm de se coordenar perfeitamente, a fim de produzir software utilizável, mantível, confiável, extensível e seguro.A razão porque é tão difícil de atingir estes objetivos é que o software é extremamente complexo.Um produto de software de grandes dimensões é composto por várias peças complexas que têm de se encaixar perfeitamente como num puzzle gigante.Se feito corretamente, as peças que compõem um projeto de software, vamos chamá-las de módulos, vão ser fracamente acoplados.Os módulos devem precisar saber tão pouco quanto possível sobre o funcionamento interno dos outros módulos.A modularidade é de grande importância, pois acaba por produzir módulos mais fáceis de perceber e promove a sua reutilização.Idealmente, cada módulo deveria ser responsável por apenas um único interesse (em inglês concern).O desenvolvimento de software seria então uma questão de composição destes módulos.Infelizmente, apesar da existência de técnicas e paradigmas de programação focados em conseguir uma perfeita separação destes interesses, ainda existem alguns que ficam inevitavelmente espalhados e misturados ao longo do código.A Programação Orientada a Aspectos (AOP) é um paradigma que promete separar esses interesses transversais nas suas próprias unidades de modularidade.A forma como se propõe fazê-lo é permitindo ao programador que identifique pontos de interesse no código, usando uma linguagem específica do domínio e, em seguida, injecte código com acesso ao contexto nesses pontos.Desta forma, um interesse que esteja espalhado, pode ser contido e ainda assim afectar diferentes partes do código.vii O processo de testes fornece às partes interessadas uma medida da qualidade do software produzido.É uma das fases do ciclo de desenvolvimento, e é extremamente importante a fim de conseguir que o software seja de boa qualidade.O teste de unidade é especialmente importante quando estamos a tentar criar um software modular, pois permite testar cada módulo separadamente, isto é, sem a influência de outros módulos.Infelizmente, como ficará demonstrado nesta tese, a utilização de AOP dificulta o uso de testes de unidade.A solução é descartar alguns testes ou perder parte da modularidade ganha com o uso de AOP.Isto acontece devido à capacidade que os aspectos têm de alterar o comportamento dos módulos existentes, fazendo que testes que foram criados especificamente para esses módulos não funcionem quando certos aspectos estão presentes.Alterando os testes para terem em conta o código AOP quebra a modularidade, e a única outra opção existente é remover esses testes.Nesta tese, propomos a utilização de métodos de inspeção de código para criar uma árvore de dependências entre módulos e o uso de uma abordagem de teste incrementais que permitem testar cada camada de software em isolamento.À medida que as camadas são adicionadas, uma após a outra, quando uma nova camada, que contém aspectos, é adicionada, será possível marcar testes que sejam quebrados por esta nova camada como sendo substituídos por novos testes que levam em consideração as alterações que tenham sido introduzidas por código AOP.Isto permite que testes de unidade em camadas mais baixas ainda possam ser utilizados sem quebrar a modularidade prometida pelos aspectos.Foi criado um projecto para servir de bancada de testes para a abordagem proposta e, nesse projecto, fomos capazes de criar e usar testes de unidade que de outra forma seriam impossíveis de executar.Também mostramos como a abordagem é capaz de resolver algumas falhas comuns específicas ao AOP.Para ajudar com os testes, desenvolvemos uma ferramenta de apoio de referência.Acreditamos que a abordagem apresentada resolve um problema importante que impede uma adopção mais alargada do AOP.Não assumimos ter descoberto a solução para todos os problemas relacionados com AOP, mas achamos que esta tese apresenta uma passo importante na direcção certa, uma vez que permite um uso mais fácil de testes em conjunto com os aspectos.
Language: English
Subfield: Software
Open Access status: green
OpenAlex ID: W2467458373
Cites: 67
Cited by:
Related to: 10