Mutation operators for JADE mobile agent systems - ACM Digital Library

27 downloads 0 Views 116KB Size Report
Mutation Operators for JADE Mobile Agent Systems. Ahmad A. Saifan. Computer Information Systems Department. IT & CS Faculty. Yarmouk University – Jordan.
Mutation Operators for JADE Mobile Agent Systems Ahmad A. Saifan

Heider A. Wahsheh

Computer Information Systems Department IT & CS Faculty Yarmouk University – Jordan

Computer Information Systems Department IT & CS Faculty Yarmouk University – Jordan

[email protected]

[email protected]

Abstract Mobile Agent System (MAS) is a distributed software system responsible for supporting and managing mobile agents. It is suitable to develop many applications for mobile computing. Testing and debugging MASs is hard to do, due the complex execution of MAS. In this paper we are interested in using mutation analysis to evaluate, compare and improve quality for MASs. There are many mutation operators in the literature. However, they are insufficient for MASs. This paper we extract 26 mutation operators for JADE MASs. Those mutation operators are categorized into four levels based on the specific fault features of JADE Mobile Agent System.

Categories and Subject Descriptors D.2.5 [Software Engineering]:[Testing and Debugging]

General Terms Algorithms, Performance.

Keywords; JADE; Mobile Agent; Mutation Operator; Mutation testing

1. INTRODUCTION Mutation testing is a method of software testing which involves modifying programs source code syntactic in small way. It creates slightly modified versions of the program, then it helps the tester to find test inputs that will cause the modified programs to behave differently from the original. The modified versions can be typical programming errors, such as: using the wrong operator or variable named which is called mutants. These mutants are created using mutation operators which encode rules that help ensure the software is well tested [1]. A mobile agent is a specific form of mobile code; we have a contrast between the remote evaluation and code on demand programming paradigms. Mobile agents are active in that they can choose to migrate between computers at any time during their execution. This makes them a powerful tool for implementing distributed applications to develop real applications and services in wireless communication and mobile device, such as: PDAs, Cell phones, Bluetooth, and WiFi, which presented good trade-off between the portability and processing capabilities [2, 3]. Distribution and mobility of the agents from node to node add the complexity to understand, design, develop, implement, and test MAS. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. ICICS’12, April 3–5, 2012, Irbid, Jordan. Copyright 2012 ACM 978-1-4503-1327-8/04/2012…$10.00.

Testing and debugging MAS is hard to do, due the complex execution of MAS. We have many problems in testing such as: debugging simple, single-threaded, non-distributed software [2]. The purpose of mutation testing is to help the tester to develop effective test case, through evalute the fault finding effectiveness of a test suite and other verification technique. It consider as an important automating phase of a tester’s process, which earlier imagining the faults in the code, and ensure the correctness of the developed component in the future[4]. Our attention in this paper is to apply mutation testing on the Mobile Agent Systems (MASs), which is a distributed software system responsible for supporting and managing mobile agents, researches interest in MAS technology has largely been driven by the exploitation of Java as a commonly available mobile code technology and platform [5]. While MASs are considered a very interesting technology to develop applications for mobile and distributed computing, there are many mobile agent platforms have been developed, such as Aglets, JADE, Voyager, Grasshopper, Tryllian, and SPRINGS, some of them have been ceased and others continue releasing new versions that fix bugs detected or offer new interesting features [6]. The MAS have many features like model, elements, asynchronous communications, messages, call/messages by name, movements by name, GUI tools, level of activity, and security mechanism, so the selection of platform based on which provides these features in the best way [6]. In this paper we use JADE 3.6 version (Java Agent DEvelopment framework) that is a very popular platform for the development of agent-based systems developed by Telecom Italia Lab since July 1998 [6]; as a FIPA compliant multi-agent environment.

2. BACKGROUND AND RELATED WORK Many mutation operatros have been proposed in the literature such as: mutation operators for concurrent Java program [7], two types of mutation operators for MuJava tool [8] which are method-level operators and class-level operators. Moreover, there are mutation operators that are used to test some concepts in object oriented programming languages, such as: inheritance, polymorphism, and dynamic binding [9]. The different mutation operators which mentioned in [7, 8, and 9] are not suitable to test the MASs, due the wide and different features in MASs such as mobility. The work on mobile agent architectures continues to be an area of considerable research effort and there is ongoing work to investigate the appropriateness of various architectures for different environments. It seems that relatively little work has been done to support quality assurance techniques such as: testing and verification of mobile agent systems as stated in [10]. Some mutation operators for Aglet mobile agent systems have been

proposed in [10]. Some of these mutation operators can be applied for JADE mobile agent systems and most of them can not applied. So we proposed new mutation operators for Jade mobile agent systems

While mutation testing originated as a means of creating more effective test suites, by brings a whole new level of error-detection to the software developer, which creating more effective test suites, the tester can be more confident that his program is adequately tested.

A.

We proposed four categories of mutation operators for JADE MASs. The categories are: Agent setup and creation, Mobility, Agent message passing, and Agent behavior. Table 2 presents the complete list of JADE mutation operators.

JADE Mobile Agent System

JADE is a framework fully implemented in the Java language and is distributed in Open Source [11], used to facilitate the development of interoperable intelligent multi-agent systems that is used by a heterogeneous community of users as a tool for both supporting research activities and building real applications [12]. JADE platform support many other features of Mobile Agent System, some of these characteristics is similar with other platform, and some specific with JADE. Table 1 summarizes these features and shows some distinguished between it and other platforms [6].

Table 2. JADE MUtation operators Operator category Agent setup and creation

Table 1. Platform Features [6] Feature in JADE 1. Model: in JADE it is a Behaviors.

Description Its philosophy for programming MAS

2. Asynchronous communications.

Is transmission without need to acknowledgement from receiver. This will be robustness, especially in wide area network. Whether the agents can communicate by passing messages among themselves. Whether it is possible to indicate the target of a message/call by specifying a userfriendly name Agent mobility is the ability for an agent program to migrate or to make a copy (clone) itself across one or multiple network hosts. Whether it is shipped with graphical tools.

3. Messages (with FIPA).

4. Call/messages by name.

5. Mobility.

6. GUI Tools

7. Level of activity (very high in JADE).

The level of activity associated with the platform, new versions released, updates to its web page, mailing lists.

Other platforms Voyager, Grasshopper, Tracy, SPRINGS is Procedural, in Aglets it is Events. Voyager, Grasshopper, Tracy, SPRINGS, Aglets and Tryllian support it.

Mobility

Voyager not support this feature.

Tracy and SPRINGS. Agent Message passing

Voyager, Grasshopper, Tracy, SPRINGS, Aglets and Tryllian support it.

Some in Aglet. No GUI tool in Voyager, SPRINGS and Tracy. Very low in Aglet and Tracy. High in SPRINGS and Voyager Medium in Tryllian. None in Grasshopper.

JADE is suited for applications that require the execution of possibly long and complex tasks that can be triggered at any point in time and not just in response to user inputs. Those application involve several interactions between internal components, and especially one-tomany and many-to-many interactions, used in application require components to dynamically appear and disappear in the system and find each other at runtime [12].

3. JADE MUTATION OPERATORS

Agent behavior

Mutation Operator Description RSM: Remove setup method. RSMWO: Replace setup method with any other method. MCNAP: Modify createNewAgent object pararmeter. MCNFP: Modify createNewAgent file name pararmeter. CDMD: Change doMove Destinations. IWBM: Insert doWait statement before doMove. IDSBM: Insert doDelete statement before doMove. RANMS: Remove agent name from doMove statement. SDMS: Switch doMove statement. RDMS: Remove doMove statement. RDMOS: Replace doMove with other statement. DMOSS: Put doMove statement out of switch statement. RAMS: Remove afterMove statement. RGM: Remove get method. CMC: Change message content. RSS: Remove send statement. RARS: Remove addReceiver statement. RRP: Remove receives parameter statement. RRRS: Replace receive with blockingReceive statement. CBRP: Change blockingReceive parameter. MCMIE: Move Communication method with IfElse. RNUM: Remove notifyUser method. RABM: Remove addBehaviour method. ROEM: Remove onEnd method. ROTM: Remove onTick method. RHETOM: Remove handleElapsedTimeout method.

A. Agent setup and creation The protected method of agent setup is an empty placeholder for application specific startup code. Agent developers can override it to provide necessary behavior. When this method is called the agent will be registered with the agent Platform Agent Management System (AMS) and is able to send and receive messages. We have the following mutation operators with agent setup: Remove setup method (RSM). Original Code protected void setup() { sendMessage();}

Apply RSM /*protected void setup() { sendMessage();} */

Applying this mutation operator means that removing agent. In this case the agent will not be able to recive or send any message, which means that the agent is idle. Replace setup method with any other method (RSMWO). Original Code Apply RSMWO protected void setup() { protected void afterMove() sendMessage();} {sendMessage();}

Applying this mutation operator means that the statement that was in setup method will be executed afte rmoving the agent to another location which means the order of the execution will be changed. For the agent creation we have createNewAgent method that creates the agent instance but does not start it. The agent can starts the execution of its code by using the method start(). Start method has three parameters; name of agent, file that contains agent and object passed to the agent. The following two mutation operators are related to the createNewAgent method. Modify the third pararmeter of createNewAgent (MCNAP). Original Code Apply MCNAP String name = "JADE" ; String name = "JADE" ; AgentContainer c = AgentContainer c = getContainerController(); getContainerController(); try {AgentController a = try {AgentController a = c.createNewAgent( name, c.createNewAgent( name, "Pong", null ); "Pong", getName ); a.start(); } a.start(); } Applying MCNAP operator makes the agent who is using this parameter to miss its value. If the value of this parameter is the name of the agent, then by using this mutation operator the agent will lose the communication with the other agents. Modify createNewAgent file name pararmeter (MCNFP). Original Code Apply MCNFP String name = "JADE" ; String name = "JADE" ; AgentContainer c = AgentContainer c = getContainerController(); getContainerController(); try { AgentController a = try {AgentController a = c.createNewAgent( name, c.createNewAgent( name, "Pong", null ); "Pong", getName ); a.start();} a.start();} Using this mutation operator means modify class name of agent that is going to create. If the file does not exist then a runtime exception occurs.

B. Mobility In JADE doMove statement is used to migrate an agent from host to another. This method allows the agent to move to the new destination (location) and execute its code there. More specifically, the agent class contains a set of methods that are dedicated for managing an agent mobility. These methods are: doMove(), beforeMove(), afterMove(), doClone(), beforeClone() and afterClone(). The three former methods handle the process of moving the agent whereas the three latter handle the process of cloning the agent [13]. The following operators will describe the mutation operators related to the mobility feature. Change doMove Destinations (CDMD). This mutation operator will change the destination of the agent when it is going to move. Original Code Location nextSite; Location prevSite; doMove(nextSite); Applying CDMD makes the agent incorrect desination).

Apply CDMD Location nextSite; Location prevSite; doMove(prevSite); to be lost (move the agent to an

Insert doWait statement before doMove (IWBM).

Original Code doMove(nextSite);

Apply IWBM Long time=60000; doWait(time); doMove(nextSite); Insert doWait method before doMove method means delaying the movement of that agent. Insert doDelete statement before doMove (IDSBM). Original Code Apply IDSBM doMove(nextSite); doDelete(); doMove(nextSite); Using this mutation operator the agent will be killed instead of moving it. Remove Agent name from doMove statement (RANMS). Original Code Apply RANMS A.doMove(nextSite); doMove(nextSite); Applying this mutation operator makes moving the agent by himself to the given destinations instead of moving the agent a. In this case, we are moving the wrong agent which means changing the behaivour of the system. Switch doMove statement (SDMS). Original Code Apply SDMS Statement n a.doMove(nextSite); a.doMove(nextSite); Statement n; Applying this mutation operator makes the n statement not be executed and this will cause an agent to lose some data when it is moved. Remove doMove statement (RDMS). Original Code Apply RDMS a.doMove(nextSite); // a.doMove(nextSite); Applying this mutation operator means keeping the agent in its location without moving it to the new location. Replace doMove with other statement (RDMOS). Original Code Apply RDMOS a.doMove(nextSite); a. doDelete(); In this mutation operator we replace doMove method with other methods such as doDelete, doClone. In the previous code instead of moving an agent we killing it with this mutation operator. By replacing the doMove method with doClone method using RDMOS operator instead of moving the agent to the new location we make an instance of that agent in the same location. Put doMove statement out of switch statement (DMOSS). Original Code Apply DMOSS switch(ev.getType()) { doMove(nextSite); case MOVE_EVENT: switch(ev.getType()) Iterator moveParameters = { ev.getAllParameter(); …. nextSite } =(Location)moveParameters.next(); doMove(nextSite); Applying this mutation operator means that agent will move to a new destination regardless of the condition. Moreover, when the agent is moved all the code after doMove() statement will be discarding (not exected).

Remove some methods related to move agent (RAMS). Original Code protected void afterMove() { System.out.println(getLocalNa me()+" has cloned itself.");}

Apply RAMS /*protected void afterMove() { System.out.println(getLocalNam e()+" has cloned itself.");}*/

The statement inside the method afterMove() will be executed after the agent moved to the new location. So removing these statements changes the behaviour of the whole system. Same mutation operator could be applied to the beforeMove() method where the code inside the beforeMove() method will be executed before the agent moves to the new location. Remove get method (RGM). Original Code Apply RGM case 2: case 2: value = loc.getProtocol(); //value = loc.getProtocol(); In JADE we have many gets method some of them affect on mobility such as: getName, getProtocol, getAddress. Remove any one of these methods from the code cause change in the behavior of the system.

C. Agent message passing A fundamental characteristic of multi-agent systems is that individual agents communicate and interact. This is accomplished through the exchange of messages. JADE follows FIPA standards so that ideally JADE agents could interact with agents written in other languages and running on other platforms. There are many parts in the message in addition to its conten such as: the intended recipients, the sender and the message type. It is essential for the message as a whole to respect a common format. In JADE, messages strictly to the ACL (Agent Communication Language) standard which allows several possibilities for the encoding of the actual content. The following mutation operators related to the agent message passing category: Change message content (CMC). Original Code ACLMessage msg = new ACLMessage( ACLMessage.INFORM ); msg.setContent("I am here" ); this.send(msg);

Apply CMC ACLMessage msg = new ACLMessage( ACLMessage.INFORM ); msg.setContent("hi" ); this.send(msg);

The CMC operator replaces the content of the message by another message. The CMC operator will make the agent send an incorrect message (not be handeled by the reciver agent) to another agent. Remove sendMessage statement (RSS). Original Code Apply CMC private void sendMessage() /*private void sendMessage() {….} {….}*/ Removing the call of sendMessage method means removing the communication between agents. Remove addReceiver statement (RARS). Original Code Apply CMC private void sendMessage() { private void sendMessage() { AID r = new AID AID r = new AID ("jack@"+getHap(), ("jack@"+getHap(), AID.ISGUID); AID.ISGUID); ACLMessage aclMessage = new ACLMessage aclMessage = ACLMessage(ACLMessage.RE new QUEST); ACLMessage(ACLMessage. aclMessage.addReceiver(r);} REQUEST); //aclMessage.addReceiver(r); }

By using addReceiver method we can add several receivers to the message and the one send broadcasts it to all of them. Removing addReceiver method means that no agent will receive the message that is sent by the agent. Remove receives parameter (RRP). Original Code Apply RRP ACLMessage aclMessage = ACLMessage aclMessage = myAgent.receive(mt); myAgent.receive(); Receive method (without parameter) is used by the agent to receive the first ACL message from the agent message queue if any. However, receive(message template) method is used to receive the first matching ACL message from the agent queue if any. Using RRP operator makes the agent to receive incorrect message. Replace receive with blockingReceive statement (RRRS). Original Code Apply RRRS ACLMessage aclMessage = ACLMessage aclMessage = myAgent.receive(mt); myAgent.blockingReceive(mt); blockingReceive method is used to blocks and suspends the whole agent until a message is available in the queue. Using RRRS operators will chages the behaivour of the whole system. Change blockingReceive parameter (CBRP). Original Code Apply CBRP ACLMessage aclMessage = myAgent.blockingReceive();

ACLMessage aclMessage = myAgent.blockingReceive(100); or ACLMessage aclMessage = myAgent.blockingReceive(mt); or ACLMessage aclMessage = myAgent.blockingReceive(mt, 100);

When we apply CBRP operator the receiving agent suspends all its activities until a message arrives. Three parameters comes with three cases; 1) time to receives an ACL message from the agent message queue, waiting at most a specified amount of time, 2) with pattern that receives an ACL message matching a given message template, 3) with pattern and time that receives an ACL message matching a given message template, waiting at most a specified time, each case happen instead of Receives an ACL message from the agent message queue. This method is blocking and suspends the whole agent until a message is available in the queue. Move Communication method with IfElse (MCMIE). Original Code Apply MCMIE If (condition) If (condition) {send(aclMessage);} {} else else {…} {send(aclMessage);} By using MCMIE operator the agent will send a message in a wrong condition.

Remove notifyUser method (RNUM). Original Code notifyUser("Cannot buy book "+title);

Apply RNUM // notifyUser("Cannot buy book "+title);

NotifyUser method is used to send back a notification message to subscibe agent. So removing this statement means no notification message will be sent.

D. Agent Behavior There are some method that areimportant and they are very critical affect that changes the behavior of the MASs. Such of these methods is onTick. This method is defined for specifying some actions that must be performed at every tick. Another method is addBehaviour which adds some behavior. handleElapsedTimeout method is a method that is called when the timeout is elapsed. onEnd method that is used to return the exit value of the last exeuted state. The following are the mutation operators related to agent behaviour category. Remove addBehaviour method (RABM). Original Code Apply RABM addBehaviour(new /* addBehaviour(new CyclicBehaviour(this) { CyclicBehaviour(this) { public void action() { public void action() { System.out.println("Cycling"); System.out.println("Cycling"); } } }); });*/ Applying this mutation operator means removing some action on system that changes it behavior. Remove onEnd method (ROEM). Original Code Apply ROEM public int onEnd() { /* public int onEnd() { myAgent.doDelete(); myAgent.doDelete(); return super.onEnd(); return super.onEnd(); } } */ Removing onEnd using ROEM operator will not allow us to get the exit value of the last executed statement of that agent. Remove onTick method (ROTM). Original Code Apply ROTM addBehaviour(new /*addBehaviour(new TickerBehaviour(this, 1000) { TickerBehaviour(this, 1000) { protected void onTick() { protected void onTick() { System.out.println("Agent System.out.println("Agent "+myAgent.getLocalName()+": "+myAgent.getLocalName()+ tick="+getTickCount()); ": tick="+getTickCount()); } } }); });*/ Applying this mutation operator cause some actions not be performed at every tick. Remove handleElapsedTimeout method (RHETOM). Original Code Apply RHETOM addBehaviour(new /*addBehaviour(new WakerBehaviour(this, 10000) { WakerBehaviour(this, 10000) { protected void protected void handleElapsedTimeout() { handleElapsedTimeout() { System.out.println("Agent System.out.println("Agent "+myAgent.getLocalName()+": "+myAgent.getLocalName()+": It's wakeup-time. Bye..."); It's wakeup-time. Bye..."); myAgent.doDelete(); myAgent.doDelete(); } } }); });*/ Removing handleElapsedTimeout method makes some of the events not be handled when timeout is elapsed.

4. CONCLUSION This paper shows valuable of mutation testing research technique which generates software tests and evaluates its quality. We focused on Mobile Agent System field, based on JADE framework which

have many of the characteristics required to facilitate testing mission. We extracted different mutation operator based on specific fault features of Mobile Agent System, categorized them in four categories. We believe that JADE mutation operators are comprehensive and representative of real bugs. Our classification of mobile agent operators shows that the operators are well distributed across the majority of bug that may occurred in MASs. This is still an ongoing project, and we expect to extend in mutation operators extracted that will improve software tests and evaluates its quality.

5. REFERENCES [1]

U. Praphamontripong, and J. Offutt, “Applying Mutation Testing to Web Applications,” Sixth Workshop on Mutation Analysis (Mutation 2010), Paris, France. pp. 1-10, April 2010.

[2]

Vigna, “Mobile Agents: Ten Reasons For Failure,” Proceedings of the 2004 IEEE International Conference on Mobile Data Management (MDM’04), pp. 1-2, 2004.

[3]

O. Urra, S. Ilarri, and E. Mena, “Testing Mobile Agent Platforms Over the Air,” Data Engineering Workshop, 2008. ICDEW 2008. IEEE 24th International Conference, pp. 152 159, April 2008.

[4]

B. H. Smith, and L. Williams,"should software testers use mutation analysis to augment a test set?," Journal of Systems and Software, vol. 82, no. 11, pp. 1819–1832, November 2009.

[5]

H. Artail, and E. Kahale, “MAWS:Aplatform-independent framework for mobile Agents usingWeb services,” Parallel Distrib, 66, pp. 428- 443, 2006.

[6]

S. Vitabile, V. Vitabile, C. Militello, and F. Sorbello, “An extended JADE-S based framework for developing secure Multi-Agent Systems,” Computer Standards and Interfaces, 31, pp. 913-930, 2009.

[7]

J. S. Bradbury, J. R. Cordy, and J. Dingel, “Mutation Operators for Concurrent Java J2SE 5.0,” MUTATION '06 Proceedings of the Second Workshop on Mutation Analysis, IEEE Computer Society Washington, DC, USA, pp.1-10, 2006.

[8]

J. Offutt, Y. Ma, and Y. Kwon, “An Experimental Mutation System for Java,” WERST Proceedings/ACM SIGSOFT SEN, pp. 1-3, Semptember 2004.

[9]

Y. Ma, Y. Kwon, and S. Kim, “Statistical Investigation on Class Mutation Operators ,” ETRI Journal, 31, (2), pp. 1-11, 2009.

[10] A. Saifan, J. Dingel, J.Bradbury, and E. Posse, “Implementing

and Evaluating a Runtime Conformance Checker for Mobile Agent Systems,” ICST 2011, pp. 269-278, 2011. [11] F. Bellifemine, G. Caire, A. Poggi, and G. Rimassa, “JADE: A

software framework for developing multi-Agent applications,” Information and Software Technology, 50, pp. 10-21, 2008. [12] X. Vila, A. Schuster, and A.Riera, “Security for a Multi-Agent

System based on JADE,” computers and security, 26, pp. 391400, 2007. [13] C. Su, and C. Wu, “JADE implemented mobile multi-Agent

based, distributed information platform for pervasive health care monitoring,” Applied Soft Computing, 11, pp. 315-325, 2011.

Suggest Documents