Please use this identifier to cite or link to this item: http://dspace.sti.ufcg.edu.br:8080/jspui/handle/riufcg/7883
Title: Geração automática de testes com objetos mock baseados em interações.
Other Titles: Automatic test generation with mock objects based on interactions.
???metadata.dc.creator???: SOUTO, Sabrina de Figueirêdo.
???metadata.dc.contributor.advisor1???: GUERRERO, Dalton Dario Serei.
???metadata.dc.contributor.referee1???: FIGUEIREDO , Jorge Cesar Abrantes de.
???metadata.dc.contributor.referee2???: COELHO, Roberta de Souza.
Keywords: Teste de Software;Teste de Unidade;Objetos Mock;Análise Estática;Análise Dinâmica;Software Testing;Unit Test;Mock Objects;Static Analysis;Dynamic Analysis
Issue Date: 31-Aug-2010
Publisher: Universidade Federal de Campina Grande
Citation: SOUTO, S. de F. Geração automática de testes com objetos mock baseados em interações. 2010. 133 f. Dissertação (Mestrado em Ciência da Computação) – Pós-Graduação em Ciência da Computação, Centro de Engenharia Elétrica e Informática, Universidade Federal de Campina Grande, Paraíba, Brasil, 2010. Disponível em: http://dspace.sti.ufcg.edu.br:8080/jspui/handle/riufcg/7883
???metadata.dc.description.resumo???: O objetivo de um teste de unidade é verificar o funcionamento de um software e procurar defeitos na menor parte testável, de forma isolada do restante do sistema. Porém, este isolamento nem sempre é possível devido às interações entre a a classe sob teste - CUT (Class Under Test) e seus colaboradores, fazendo-se necessário o uso de objetos mock para simular os colaboradores, em um mecanismo onde a CUT não sabe se ela está interagindo com colaboradores reais ou objetos mock. Desta forma, objetos mock podem ser de grande utilidade na escrita de testes de unidade, uma vez que isolam a CUT, tornando o teste mais eficaz e eficiente. Entretanto, escrever testes com objetos mock pode ser uma tarefa custosa, tediosa e repetitiva, mesmo com o suporte de frameworks, como o EasyMock [34] por exemplo, devido às atividades necessárias ao seu funcionamento. Dada a necessidade de se utilizar objetos mock nos testes de unidade e seus benefícios, e considerando a dificuldade envolvida no desenvolvimento e manutenção deste tipo de código, propomos e avaliamos uma técnica para automatizar o desenvolvimento de testes com objetos mock, gerando-os automaticamente para um determinado cenário de teste. Esta técnica tem por base a identificação das interações entre a CUT e seus colaboradores em um dado cenário de teste, através da análise estática e dinâmica de código. Após essas análises, a técnica provê a geração de código de teste com objetos mock para os colaboradores e interações identificadas. O código resultante consiste em uma nova versão do código do cenário de teste inicial, onde os colaboradores da CUT são substituídos por objetos mock, bem como suas interações. Considerando o baixo custo de se gerar automaticamente o código para os objetos mock, não se faz necessária a reutilização deste código, o qual poderá ser gerado novamente a cada modificação. Para avaliar nossa técnica realizamos um estudo experimental comparativo entre a forma manual e a automática de se desenvolver testes com objetos mock, através da observação do esforço empregado em tais atividades e o nível de cobertura de interações do código resultante, que tenta assegurar que o código gerado possui pelo menos a mesma precisão do código inicial. Os resultados da avaliação evidenciam que nossa técnica foi capaz de reduzir o esforço empregado no desenvolvimento de testes com objetos mock, resultando em um código melhor e mais preciso comparado ao manual.
Abstract: The main purpose of unit tests is to verify the correct work of software and search for defects in the smallest part of the system, in isolated way. However, this isolation not always is possible due to the relationship among the CUT (Class Under Test) and its collaborators, needing the use of mock objects to simulate the collaborators behavior, by a mechanism that the CUT has no science if it is interacting with real collaborators or mock objects. As a result, mock objects can be very useful to write unit tests because they isolate the CUT, improving both efficiency and effectiveness of unit testing. On the other hand, writing tests that use mocks can be a tedious, repetitive, and costly task, even with the support of frameworks, due to the necessary procedures for it working. Given the high importance in the use of mock objects and its benefits, and considering the mentioned drawbacks, we propose a technique that automates the development of tests with mock objects, by automatically generating them for a given testing scenario. This technique is based on automatically identifying interactions among the CUT and its collaborators in a given testing scenario, via both static analysis and dynamic analysis of the code. After these analyses, the technique generates code of test with mock objects for those collaborators and the identified interactions, resulting on a new version of the initial testing scenario code, where the collaborators are replaced by mock objects as well its interactions. Considering the low cost in automatically generate test code with mock objects, it is not necessary maintain this code, which can be generated for each change in the testing scenario. In order to evaluate our technique, we performed a comparative study, by means of experimentation, between the manual and automatic way of develop tests with mock objects, by observing the spent effort (development time and size of produced code) on those procedures and the interaction coverage level of the resulting code, which tries to assure that the generated code contains in minimum the same quality of the input code. The evaluation results demonstrate that our technique was able to reduce the spent effort on developing tests with mock objects, resulting on a better and more precise code when compared to the one manually developed.
Keywords: Teste de Software
Teste de Unidade
Objetos Mock
Análise Estática
Análise Dinâmica
Software Testing
Unit Test
Mock Objects
Static Analysis
Dynamic Analysis
???metadata.dc.subject.cnpq???: Ciência da Computação
URI: http://dspace.sti.ufcg.edu.br:8080/jspui/handle/riufcg/7883
Appears in Collections:Mestrado em Ciência da Computação.

Files in This Item:
File Description SizeFormat 
SABRINA DE FIGUEIRÊDO SOUTO - DISSERTAÇÃO (PPGCC) 2010.pdfSabrina de Figueiredo Souto - Dissertação PPGCC 20101.49 MBAdobe PDFView/Open


Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.