## 1 Introduction  
Software engineering (SE) is an important discipline when developing software systems, especially in large-scale systems [1; 2]. SE is concerned with all processes of software production. It is \"a systematic approach to the analysis, design assessment, implementation, test, maintenance and reengineering of software\" [1]. Thus, it is clear that the engineering of a software is an important problem-solving activity. SE ensures control over software functionalities, quality, and resources [1; 2]. Hence, it ensures complete software development and requirement satisfaction. The urge of applying SE processes is of vital importance especially to large, complex systems including networking and security service systems [3; 4; 5; 6]. Such systems are associated with risks that increase in unattended environments such as wireless networks. Therefore, embracing a holistic approach of any weakness along the engineering process of the system is required [1; 2; 3; 4; 5; 6] to secure the networks from vulnerabilities that may lead to future security breaches. Security concerns have become particularly acute in systems deployed over wireless networks [7; 8; 9; 10; 11; 12]. In recent years, advances in micro-electronic systems technology, digital electronics, and wireless communications that have enabled the development of Wireless Sensor Networks (WSNs) [6; 13] have been witnessed. WSN is a self-organized network that consists of hundreds to thousands sensor nodes that are connected by wireless links [4]. These wireless sensors are small in size, low-cost, low-power, multi-functional, and communicate over short-ranges [4; 5; 6; 14]. Sensor nodes have the capability of sensing, collecting, processing, and communicating in an autonomous manner [8; 13]. WSNs are one of the most promising technologies and they have been embraced more than ever [6; 8; 15]. They have been used and deployed in different environments for different purposes, so their applications vary--for instance, military, habitat monitoring, disaster management, and environmental applications [8; 11; 16]. However, due to the distributed nature, cost, size, and power constraints of the sensor nodes, WSNs result in stringent limitations on node resources such as energy, computational speed, memory, and communication bandwidth. These limitations pose several challenges such as sensor battery lifetime, efficient distributed signal processing, data processing, and network security [13; 16]. However, the two main and critical challenges are the sensors' lifetime (i.e., period of operation) and the security of the network [11; 17; 18]. As for the lifetime of WSNs, sensor nodes use batteries as their power supply, but they are limited in their resources. For example, if sensor network is installed and deployed in a far geographical space to monitor physical phenomenon, they will be unapproachable [18]. Hence, recharging or replacing those sensor nodes will cost more because of the far distance. As for the security of WSNs, owing to the network limitations, it is difficult to achieve security in applications deployed over WSNs [8]. These sorts of networks are usually deployed in remote and hostile environments to perform its tasks [4; 19; 12]. However, hostile environments are usually unattended. Due to that, WSNs lack physical protection (e.g., no switches or gateways to monitor the flow of information) resulting a potential of node compromising as well as low network security and protection [10; 15; 19]. Therefore, it is important to secure such networks from intrusions and attacks, especially in applications where security services are important. Efficient security mechanisms are in demand in order to be safeguarded and secured from attacks. As a first line of security defense, intrusion detection and prevention approaches can be used in order to reduce possible intrusions. Many types of attacks can be performed over a WSN, for example, Sinkhole Attack, Sybil Attacks, and Packet Dropping Attacks [20].