Agent Oriented Software Testing – Role Oriented approach

Several Agent Oriented Software Engineering (AOSE) methodologies were proposed to build open, heterogeneous and complex internet based systems. AOSE methodologies offer different conceptual frameworks, notations and techniques, thereby provide a platform to make the system abstract, generalize, dynamic and autonomous. Lifecycle coverage is one of the important criteria for evaluating an AOSE methodology. Most of the existing AOSE methodologies focuses only on analysis, design, implementation and disregarded testing, stating that the testing can be done by extending the existing object-oriented testing techniques. Though objects and agents have some similarities, they both differ widely. Role is an important attribute of an agent that has a huge scope and support for the analysis, design and implementation of Multi-Agent System (MAS). The main objective of the paper is to extend the scope and support of role towards testing, thereby the vacancy for software testing perception in the AOSE series will be filled up. This paper presents an overview of role based testing based on the V-Model in order to add the next new component as of Agent-Oriented Software testing in the agent oriented development life cycle.


I. INTRODUCTION
A software development methodology refers to the framework that is used to structure, plan, and control the process of developing a software system.A wide variety of such frameworks have evolved over the years, each with its own recognized strengths and weaknesses.Now an increasing number of problems in industrial, commercial, medical, networking and educational application domains are being solved by agent-based solutions [1].The key abstraction in these solutions is the agent.An "agent" is an autonomous, flexible and social system that interacts with its environment in order to satisfy its design agenda.In some cases, two or more agents should interact with each other in a multi agent system (MAS) to solve a problem that they cannot handle alone.The agent oriented methodologies provide us a platform for making system abstract, generalize, dynamic and autonomous.This important factor calls for an investigation of suitable agentoriented engineering frameworks and testing techniques, to provide high-quality software development process and products Agent Oriented Software Engineering (AOSE) is an umbrella term in which several researches have been proposed on new varieties of metaphors, formal modelling approaches and techniques, and development methodologies and tools, specifically suited towards agent-oriented paradigm.Several AOSE methodologies [4] were proposed for developing software, equipped with distinct concepts and modelling tools, in which the key abstraction used in its concepts is that of an agent.Some of the more popular AOSE methodologies were MASCommonKADS (1996)(1997)(1998), MaSE(1999), GAIA(2000), MESSAGE(2001), TROPOS(2002), PROMETHEUS(2002), ADLEFE(2002), INGENIAS(2002), PASSI(2002), AOR Modeling(2003).
Several AOSE methodologies were analysed and compared and found that the strong weakness observed from almost all the methodologies were, there is no proper testing mechanism for testing the agent-oriented software.Our survey states that the agent based software are currently been tested by using Object-Oriented (OO) testing techniques, upon mapping of Agent-Oriented (AO) abstractions into OO constructs [3].However agent properties such as Autonomy, Proactivity, and Reactivity etc., cannot be mapped into OO constructs.There arises the need for proper testing techniques for agent based software.
Role is an important attribute of an agent that has a huge scope and support for the analysis, design and implementation of Multi-Agent System (MAS) [2].A role can be defined as the capability enabler that exposes to the agent that plays it a set of actions [9].Roles are created to do something and it has the responsibility of achieving specific system goals and subgoals.Roles provide a well-defined interface between agents and cooperative processes [10].This allows an agent to read and follow, normative rules established by the cooperation process even if not previously known by the agent.The major motivation to introduce such roles is to increase the agent system"s adaptability to structural changes.
The main objective of our paper is to propose a testing mechanism to test a multi-agent system based on agent"s important mental state, the role.

A. Lifecycle Coverage of AOSE Methodologies
For designing and building software systems, several software development paradigms were proposed such as structural, procedural, declarative and object-oriented technique.Recently agent oriented paradigm is used for designing and building software systems which is considered to www.ijacsa.thesai.orgbe an extension of object oriented paradigm.Agents are the software program which works on behalf of human to carry some task which has been delegated to it and take their own decision according to the requirement.Agent based systems are meant for solving complex problem that too in distributed environment.
A methodology is indented to provide guidelines at every stage of software development process such as requirement analysis, design, implementation and testing.Several AOSE methodologies were proposed in the literature and every methodology deals with analysis and design phase of the agent based software development and very little attention is made for implementation and testing.When compared to implementation, testing has been neglected overall by the methodologies.Based on the survey made on several AOSE methodologies, it is very clear that the existing AOSE methodologies does not support testing phase, stating that testing the agent system has been accommodated using the traditional and object-oriented testing techniques.Table .1 tabulates the AOSE methodologies and their corresponding lifecycle coverage [4].

B. Testing in AOSE Methodologies
The goal oriented testing methodology [5] contributes to the existing Tropos methodology by providing a testing process model, which complements the Tropos methodology and strengthens the mutual relationship between goals and test cases.The support for testing in prometheus methodology is limited to only debugging support [5].
Role is an important mental attribute of an agent and often agent changes its roles to achieve its designated goal.Roles are intuitively used to analyze agent systems, model social activities and construct coherent and robust teams of agents.Roles are a useful concept in assisting designers and developers with the need for interactions.Roles provide a well-defined interface between agents and cooperative processes.Their major motivation to introduce such roles is to increase the agent system"s adaptability to structural changes.Among the existing AOSE methodologies, Generic Architecture for Information Access (GAIA) methodology [6] and Multiagent Systems Engineering (MaSE) methodology [7] were role-based methodologies for development of multi-agent systems.The GAIA methodology models both the social aspect and agent internals aspect of MAS.The methodology covers the analysis and design phase.Role model and Interaction model are constructed in analysis phase.With reference to the analysis phase, the agent model, service model and acquaintance model are constructed in the design phase.During the analysis phase of MaSE [7], a set of roles are produced, that describes entities which perform some function within the system.Each role is responsible for achieving the goal.

III. PROPOSED WORK
A software is been tested at different abstraction level such as unit, integration, system and acceptance.The main objective of this paper is to propose an effective agent-oriented testing technique that suits specifically for an agent based system.The proposed testing technique is oriented towards role, which is one of the important state/attribute of an agent.Role is defined as a capability enabler that exposes to the agent that plays it a set of actions.The V-model [8] represented in figure 1 shows the development and its corresponding role based testing activity.The left branch of the V represents the specification flow, and the right branch represents the role oriented testing flow.

A. Role Model
An attractive feature of agent-orientation is that it provides a powerful metaphor for describing, understanding and modeling information systems.A role is intended to enable software engineers to use it as a metaphor effectively to develop such cooperative information systems.A Multi-agent system is one which involves more than one agent that works in a coordinated way to achieve the overall goal of the system.Let us consider that, the number of agents involved in the MAS as "x".Every agent in the MAS is intended to achieve a goal in turn many sub-goals.Let us assume that the number of goals of an agent is "i".
The agent to achieve its goals and sub-goals has to play many roles within the agent as well as takes role in another agent i.e in certain cases the output from an agent might be the input to another agent.In such cases, the agent changes its current role and takes another role to accomplish the task given.Let us assume that the number of roles to achieve the agent"s goal is "j".Moreover, a role is defined as the set of capabilities and expected behavior.In simple words, role is a set of actions or responsibilities to be handled by an agent.In this regard, a role can have "k" number of responsibilities.Hierarchical representation of MAS down to responsibility is depicted in fig. 3 and is mathematically been represented as below.
Testing follows bottom-up approach in the proposed roleoriented testing.Test cases are written to test whether the responsibilities hold by the individual roles taken by the agent works as per the requirement.
Testing the responsibilities corresponding to their respective role ensures that the agent plays its role as per the intended goal.As long as the goals are getting satisfied, it is understood that the individual agent is performing well that suits the system.The following is the steps involved in roleoriented testing.STEP 1: Select the Agent to be tested.

B. Role Oriented Unit Testing
Our testing approach focuses primarily on the smallest building block of the Multi-Agent System, the agent.The basic idea behind the unit testing in MAS is to verify whether the individual agent (unit) in isolation performs its responsibilities under various conditions.
Every individual agent has its own goal to be achieved and plans to do to fulfill the goal.In addition to goal and plan, role is one important mental state of the agent, which is defined as a set of capabilities and expected behavior.A role [9][10] can be represented as <Goal, Responsibilities, Protocol, Permissions>  Goal, for which the agent playing this role is responsible Let us consider an agent based university information system in which staff is one of the agent involved in the system.The goal of the staff agent is to be the best staff in the university.To achieve this goal, the staff agent has to take many roles such as teacher role, student counselor role, researcher role, administrator role etc., Every role has its own responsibilities, say for example, teacher role has the following responsibilities such as regular to class, handling classes properly, taking attendance, evaluating students, identifying weak students, etc.
Thus to test a single agent, scenarios (test cases) are to be developed to test whether all the responsibilities of the corresponding agent"s role got satisfied.When all the roles are been tested and working fine, then by default we claim that the goal of the agent is been tested, thereby the individual agent is tested successfully.XML notations are used to define roles and their capabilities.

C. Role Oriented Integration Testing
Integration testing in conventional software development is that to progressively integrate the tested units (module, program, procedure, function) either incrementally or nonincrementally, so as to check whether the software units in an integrated mode are working properly.In an object-oriented software development, integrated testing is to verify the interaction among classes (interclass).The relationships among classes are the basic characteristics of an object-oriented system and define the nature of interaction among classes and objects at runtime.Multi-agent system is a logical collection of agents that interact with each other in a way that implements the functionality of the system.After ensuring that the individual agent in isolation is working as per the requirement, the next immediate step is to integrate the agents involved in the MAS so as to test the interaction, and communication among agents.Scenarios in which one agent interacts with another agent so as to comply with the role it holds are identified and tested.The protocol involved in communication among agent is also tested during integration.

D. Role Oriented System Testing
System testing verifies that all elements (hardware, people, databases) are integrated properly so as to ensure whether the overall product met its requirement and achieved the expected performance.System testing also deals with non-functional requirements of the software such as recovery testing, security testing, stress testing and performance testing.System testing in agent oriented approach will test the complete functionality and test the system as a whole.Here the perceptions and actions of all the agents are tested as a whole by providing proper test cases.

E. Role Schema
Role schema provides a well-defined interface between agents and cooperative processes.This allows an agent to read and follow, normative rules established by the cooperation process even if not previously known by the agent.Their major motivation to introduce such roles is to increase the agent system"s adaptability to structural changes.Role schema involves role name, agent name, goal to be achieved, description of the role, protocol and related activities, permissions and responsibilities.IV.CASE STUDY To illustrate the role-based unit testing approach, an agent based online shopping system involving buyer agent, seller agent and bidder agent was developed using MaSE methodology.MASE is an iterative process.It deals the capturing the goals and refining the roles of an agent.It appears to have significant tool support.agentTool is a graphically based, fully interactive software engineering tool, which fully supports each step of MaSE analysis and design.Fig. 3 shows the snapshot of the agentTool with which online shopping system is been analysed and designed.The analysis phase involves capturing goal, Applying use cases and Refining roles whereas the design phase involves Creating agent classes, Constructing conversations, Assembling agent classes and System design.Agent-based Online shopping system is been implemented using JADE ( a software platform that provides basic middleware layer functionalities which are independent of the specific application and which simplify the realization of distributed applications that exploit the software agent abstraction.This paper comes out with a testing mechanism specifically for the agent software based on agent"s mental attribute, the role.The first step in the role-oriented testing is to identify the GRRe (Goal, Role, Responsibilities).
Let us consider a simple example derived from online shopping system.One of the goals of the online shopping system is to buy an item.To achieve this goal the agent has to take registrar role (registration process) and the Payer role (payment).Every role has its own responsibilities, say providing the registration detail is the responsibility of the registrar role and providing shipping detail is the responsibility of the payer role.

A. Deriving Test cases
According to our approach, the role of an agent comprises the logic of the test.As every role of an agent has number of responsibilities to get satisfied, the derivation of test case focuses on the responsibilities and thereby validates whether the role hold by the agent servers the purpose.Table 3 brings out the test case structure and some sample test case adopted for role oriented testing mechanism towards agent based online shopping system.In addition to the agent based online shopping system (P1) that we explored in the previous chapters we also developed few other agent based systems namely E-learning system (P2), Air ticket reservation system (P3), E-Novel System (P4) and E-Auction system (P5).
All the systems were developed using MaSE methodology.We intend to test all the agent based systems (P1 to P5) with the existing object oriented testing technique and with our proposed role based testing technique.We made a statistical comparison of object-oriented testing versus role-oriented testing techniques using the following metrics [11] The above mentioned four metrics are calculated for five sample experimental projects P1 to P5.The calculated metrics are tabulated in Table .IV for further analysis and interpretation.From the above table, it is very clear that our proposed role oriented testing is more efficient for testing the agent-based system rather than existing object-oriented testing technique.For further analysis and comparison the following graphs are plotted from the table data.From the graph, we may come to a conclusion that for testing an agent based system, an agent oriented testing technique say, role oriented testing will be more appropriate and effective too.

VII. CONCLUSIONS
In this paper, a role oriented testing approach has been proposed for an agent system.The proposal helps the MAS developers in testing the individual unit of the agent based system namely, the agent.The testing mechanism is based on the role which is an important mental attribute of an agent.Every agent has its own role to perform so as to achieve its goal.Moreover the agents can even change their roles when the need arises so as to achieve the goal.Analysing the Goal-Role relationship, it is found that, as long as the agent performs its role properly, the goal of the system is been achieved by default.Thus testing whether the agent performs its role properly is a challenging task.This paved way for a roleoriented testing mechanism by which the role functionalities were tested by deriving appropriate test cases.To evaluate the proposed testing technique, 5 agent based systems were tested using object-oriented testing technique as well as role-oriented testing technique.The results of the testing techniques were tabulated and interpreted and it seems that the results are encouraging.

STEP 2 :
Identify Goals (G i ), Roles (R j ) and their corresponding Responsibilities(Re k ) STEP 3: Design Role Model Diagram (A x (G i R j Re k ) STEP 4: Analyze role model (A x (G i R j Re k ) STEP 5: Define the interacting agents and situations.STEP 6: Make the interacting agents as Pseudo agents.STEP 7: Identify environmental factors pre-conditioning input trigger Re k STEP 8: Identify fulfillment criteria that satisfies Responsibility STEP 9: Create test suite for Re k corresponding to R j STEP 10: Run test cases Which indicates the functionalities of agents playing such roles  Protocol, which indicates how an agent playing such role can interact with agents playing other role  Permissions, which are a set of rights associated with the role.

Figure. 3
Figure.3 represents all the semantic information about the agent such as goal, role, responsibilities and protocols.

Figure 3 .
Figure 3. XML Notation for defining Role and its

Figure 6 .
Figure 6.JADE Development EnvironmentV.ROLE ORIENTED TESTING OF ONLINE SHOPPING SYSTEMTesting is an important activity of the software development process.Efficiency of the testing techniques determines the quality of the software.AOSE methodologies struggle to compete with the existing programming paradigm as there is a lack of proper testing mechanism.

Figure 7 .
Figure 7. Sample Goal, Role, Responsibility representation [12],1.Defect Removal Efficiency (DRE), DRE = No. of defects resolved / Total no. of defects at the moment of measurement.2. Test coverage (TC), TC= number of detected faults / number of predicted faults.3. Test Case Effectiveness (TCE) No. of defects detected using test cases*100/Total no of defects detected 4. Number of Tests Per Unit Size (TPUS) Number of test cases per KLOC / FP where, KLOC represents Kilo Lines of Code & FP represents Function Point.

Sl.No Name of the Methodology Life-Cycle Coverage
The entire Role

TABLE II .
ROLE SCHEMA Role Name : Teacher Agent involved : Staff Goal: To be the best staff in the university Description: This role helps in identifying whether the teacher teaches well or not Protocol and Activities: Be regular, Handling classes, Taking attendance, Evaluating students Permissions: Read Request query, Result, Security policy, Change Result format // encrypt, Request format // decrypt Responsibilities: Activeness: (Take attendance + Be regular+[Receive Questions from students+ Answer question from students]+ Teach subject+ Evaluate students + Submit result) Completeness: Lecturer is a good teacher

TABLE III
Buy an item GoalRoleResponsibility www.ijacsa.thesai.orgVI.TEST RESULT INTERPRETATION AND EVALUATION