Subscribe by Email


Showing posts with label Simulate. Show all posts
Showing posts with label Simulate. Show all posts

Saturday, July 28, 2012

What is virtual user script? Why do you need to parametrize fields in your virtual user script?


Nowadays, the concept of the virtual user is quite common in the field of load testing. 

What is a Virtual User?


- Virtual user is one of the quite useful tools have been ever invented in the field of software engineering. 
- Virtual users can be used in a number of ways for testing load, stress or capacity of any software system or application you want. 
- It will be the easiest to define a virtual user as a virtualized representation of a real world user which has been specifically designed for simulating the same interactions and behaviors with the software system or application or web site to be tested in a way that a real world user would do exactly. 

Let us take an example, suppose at a peak your web site got 100 users over a particular hour. It becomes quite easy for you to simulate the same behavior using 100 virtual users making use of the scripts that invoke quite similar interaction and the navigation exactly as your real users do. Today such virtual users are also available that can playback the recorded scripts. 

In this article we discuss about what a virtual user script is and what is the need for parameterizing the fields in a virtual user script.  

What is a Virtual User Script & Need to Parametrize fields?


The fact that almost all of the scripts of the virtual user are automated is quite common. 
- For each and every automated script a particular entry point is marked by the script statement in virtual user. 
- From this point, the actions of the automated scripts are much similar to that of the real world users. 
- At any point these virtual user scripts can be made to click on any of the buttons or the windows, type some words, and move the mouse around and so on.
- Not only scripts, there are certain functions that are supported well by the virtual user and these functions can act as an extension to the virtual user scripts. 
- These functions have been given a general name called “tasks”. 
- These tasks consist of a procedure along with a list of parameters and in some cases they may also include an optional return value. 
- The information regarding the environment of the target computer is also collected by the virtual user with help of a statement called the match statement. 
- A specific environment element is searched by this match statement with the help of some descriptor traits like the following:
  1. Static text
  2. Edit text
  3. Pictures
  4. Icons
  5. User items and so on.
- There is one more kind of statement that is used and is called the collect statement.
- It is used to collect all elements of a certain type in to the list.
- Afterwards the virtual user interacts with the software system or application environment using certain keywords like:
  1. Select
  2. Drag
  3. Type
  4. Close
  5. Click and so on.
- Common objects of the operating system like windows, buttons, bars, menus and scrolls are accessed by the virtual users. 
- The virtual user software package comes with a log file feature using which one can write out all the information from within a script. 
- This feature also provides the scripter with information regarding the current run time state of the virtual user scripts. 
- These virtual user scripts can also be debugged whenever required by logging with the printh statement. 
Another fact about virtual user is that there exists no type checking which serves as a very good idea to log the parameters that serve as input to every task.




Monday, July 9, 2012

List out the technical details of mock object?


Mock objects are much in talk these days and seem to be marking themselves as one of the effective tools in carrying out unit testing. 

What are Mock Objects?


- Mock objects are simulated objects counterparts of the original or the non mock object that is intended to mimic the behaviour and working of the original non mock object in a way that is controlled and defined. 
- Classes with heavy code bases are such a pain to test and can be tested only by the mock objects. 
- Ever tried implementing unit tests in a project but failed to do so because of the dependency of the module and difficulty in its isolation?
- Within a budget and time constraint it becomes difficult for configuring and setting up all the external dependencies of the modules. 
- Mock objects are a feasible option for overcoming such problems. 
- Problem with most of the mock tools is that they do not come with documentation so it becomes difficult to work them out. 
- These technical details of mock objects are the center point of this article. 
- Since the mock objects simulate the real object, they are said to possess the same interface as that of the real objects that they are imitating. 
- Nowadays many mock object frame works are available using which the programmers and developers can specify which all methods are to be invoked by the mock object and in which order. 
- Also, the parameters that have to be passed to the mock object can be specified along with the values that will be returned by the mock object. 
- We have divided the technical details of the mock objects in to three categories:
1. Mocks, fakes and stubs
2. Setting expectations
3. Writing log strings

Mocks, fakes and stubs: 
- Some consider the mock objects and fakes to be different things saying that the fakes are much simpler than the mock objects. 
- The fakes are simply used to represent just the interface of the object which they are mimicking and responses that they return are pre-arranged. 
- Thus, we can say a set of method stubs is provided by the fake objects. 
- On the other hand, the mock objects are fake objects but they help in determining whether some other object passes or fails the test to which it is subjected. 
- It does so by the verification whether of the interaction if any took place on the object. 
- Everything else apart from these two i.e., fake objects and mock objects is considered to be a stub. 
- Stub is anything unreal is fake and based up on its usage it can be classified as stubs and mocks. 
- Mock objects possess a little more functionality which is that their method implementations contain assertions that are truly theirs. 
- This furthermore implies that the context of each and every call is examined by the true mock object.
- The examination includes the checking of the order of calling of the methods and performing tests on the data that has been passed as arguments to the method calls.

Setting expectations: 
It is ensured by a mock setting that the calls to the system will cause the system to throw some exception like getting hanged or crashing.

Writing log strings: 
Mock methods can be used to make an entry to the public log strings which otherwise could result in invisible performance sapping bugs.


Monday, May 21, 2012

What is the use of a mock object in test driven development?


Over the years the idea of the mock object was materialized and today they are being used in numerous testing and development methodologies. Nowadays mock objects find their use in many testing methodologies like the unit testing and also in development processes such as the test driven development process. 
This article is focused up on the use of a mock object in the test driven development process. But, before moving further we shall give a brief discussion regarding the concepts of the mock object so that understanding the use of mock object in the test driven development becomes easy for you. 

Mock objects are known as the fake objects that in a way simulate the behaviour of an original or to say a non mock object whenever any of the following conditions are prevalent:
     
     1. If the non mock supplies non deterministic output.
     2. If the non mock object is difficult to be reproduced or recreated.
     3. If the non mock object is quite slow i.e., is using a complete data base.
     4. If the non mock object tends to change its behaviour.
     5. If the non mock object does not yet exists.
     6. If the non mock object demands information and methods exclusive to the testing purposes.

   

What are Mock Objects?


- Mock objects are nothing but fake objects but with a little more purpose of testing the other non mock objects with the method implementations having assertions of their own. 
- They are employed for the examination and verification of the context of each and every method call.
- Apart from this, they are also used to determine the order in which the methods are called and implemented using data that was passed as the arguments in the method calls.
- Mock settings are an effective means for ensuring that an exception is generated by the software system or application when the subsequent calls to it are made like it may hang, fail or crash etc. 
- With the mock settings, it has become possible to test the client behaviors against all the realistic faulty conditions as well as they can be developed also in the back end sub systems. 
- Without the use of mock objects it will be too difficult to test these conditions. 
- The mock system provides a simple and flexible way to test the realistic fault conditions since proper consideration is given to them.
- With the mock methods it has become easy to add entries to a public log string. 

Use of Mock Object in TDD


Now coming to the use of mock objects in the test driven development, mock objects are used in 
the test driven development during the writing of the software. 

- With the help of mock objects the programmers and developers are able to write and unit test functionality in a defined area by using the mock objects that provide all the interface requirements of the complex real objects rather than using the complex collaborating and underlying classes and objects. 
- With the help of mock objects the programmers are able to focus properly on the testing of the behavior of the SUT or system under test. 
- They don’t have worry about the objects on which it is dependent. 
- There are some practical speed issues also involved with the use of mock objects in the test driven development apart from the complexity issues.
- To develop a realistic piece of software employing the test driven development may require hundreds of unit tests. 
- If any communication is developed between these unit tests and the data bases, networked systems and web services, then it is possible that the suite of unit tests will become quite slow. 


Monday, May 14, 2012

What is the concept of penetration testing tools?


We all are quite familiar with what is a penetration test or a pen test. Every kind of software testing technique makes use of certain tools, so does penetration testing. 
This article is focused up on the tools that are meant for carrying out the penetration testing. Before moving on to the discussion about the tools, let us buck up with some concepts of penetration testing. 

About Penetration Testing


- Penetration testing gives a measure of the security of the software system or application or a computer network. 
- This is done by the simulation of the attacks as from the outside malicious attackers. 
- The attacker can also be an insider. 
- The attackers are classified in to outsiders and insiders on the basis of the approach of their access to the software system or application. 
- The attackers not having any authorized access to the system are called as outsiders and those who have any extent of authorized access to the system are called insiders. 
- The first step in the penetration test is the identification of the potential vulnerabilities of the system by carrying out an active analysis.
- These vulnerabilities are a consequence of the improper configuration of the software system or they may occur also because of flaws in the hardware and software components of the system. 
- Some of the technical counter measures may also revoke these vulnerabilities.
- The penetration is performed in the way that a potential attacker might follow to attack the system. 
- After the identification of these vulnerabilities, these are brought to the notice of the owner of the system. 
- These potential vulnerabilities are then coupled with a proper assessment of their potential impacts on the system as well as organization using several effective penetration tests. 
- Some technical counter measures are then designed to reduce their impact on the system. 

There are several reasons that make the penetration testing way more valuable. Now coming to the discussion regarding the penetration testing tools, since there are many ways in which the penetration testing can be carried out, there are several types of tools that can be employed for the penetration testing.

Approach used in Penetration testing


- Depending up on the amount of knowledge the tester has about the software system or application, either the black box approach or the white box approach is followed. 
- If the tester has less knowledge of the system, he/ she is likely to follow the black box approach.
- On the other hand if he/ she has ample amount of knowledge then the white box approach is used. 
- Accordingly the tools are chosen i.e., black box testing tools for black box approach and similarly white box testing tools for the white box approach. 
- It is required that the location and the extent of the system to be tested is determined properly before starting the testing. - For the white box approach the tester needs to know about the critical aspects like the IP address of the system and source code. 
- If the amount of knowledge is intermediate between the amounts required for the black box and white box approaches, then the grey box testing approach is allowed. 
- This involves the intermixing of the white box and black box testing techniques. 
- Both the white box testing tools as well as black box testing tools can be employed here. 
- All these three approaches have their own merits and demerits which are often debated.
- These tools are deployed for the creation of the hostile environment for the testing of environment.

Types of Penetration Testing Tools


1. Port Scanners
2. Vulnerability Scanners
3. Application Scanners
4. Web Application Assessment Proxy



Saturday, April 14, 2012

What are the advantages and limitations of a mock object?

Mock objects are nowadays quite popular with the testers. The mock objects are now being used widely for conducting unit testing and also in many software development processes like the test driven development.

- The mock objects are known for their mimicking behaviour of the other non mock or original objects for which they have been created.

- The mock objects are used under the context of the object oriented programming.

- They are nothing but the fake objects that are simulated in a way as to mimic the behavior of the real objects in a way that is properly controlled and defined.

- The behavior of most of the non mock or real objects is tested against the behavior of a mock object.

- You can compare the mock object with a crash test dummy that is used by the car designers to the impact of the vehicle on the human body.

Reasons for Use


Few of them have been mentioned below:

1. The real object provides non deterministic result like current temperature and time.
2. The real object has the states that cannot be easily recreated or reproduced such as a network error.
3. The real object is quite slow such as a data base that needs initializing before the commencing of the test.
4. The real object does not exist currently.
5. The real object tends to change its behaviour.
6. The real object is to include the information for the testing purposes.

Advantages of Mock Object



- One of the characteristic of the mock objects is that they possess the same interface as that of the real objects that they mimic.

- With such an arrangement the client stays unaware of whether he is using the real object or the mock object.

- With the use of mock objects it becomes easy for the programmer to specify which and all methods will be invoked and in what order and it can also be specified which parameters are to be passed to the mock objects.

- All this is done by using the mock object frame works.

- The mock objects can even mimic the behaviour of the complex objects, for example the network socket.

- The use of mock objects can help the programmer in various ways.

- The programmer can determine whether the object that is under test responds well to the variety of situations it is put in works properly or not.

Limitations of Mock Object


- Use of mock objects can lead to close coupling of the several unit tests similar to that in the actual implementation of the code that is under testing.

- If a programmer is using the mock object frame work, the order of and number of times the mock methods are to be invoked on a mock object can be specified.

- If the code is subsequently refactored, it may fail even though the contract of the previous implementation is followed in the method.

- The unit tests are known to test only the external behaviour of the mock methods rather than testing its internal implementation.

- Therefore, maintenance needed for the tests increases if there is an overuse of the mock objects.

- Mock objects need to model the real objects perfectly well which becomes difficult if the real object has not been written yet.


Monday, December 20, 2010

How does stress test execute?

A stress test starts with a load test, and then additional activity is gradually increased until something breaks. An alternative type of stress test is a load test with sudden bursts of additional activity. The sudden bursts of activity generate substantial activity as sessions and connections are established, where as a gradual ramp-up in activity pushes various values past fixed system limitations.
Ideally, stress tests should incorporate two runs, one with burst type activity and the other with gradual ramp-up to ensure that the system under test will not fail catastrophically under excessive load. System reliability under severe load should not be negotiable and stress testing will identify reliability issues that arise under severe levels of load.
An alternative, or supplemental stress test is commonly referred to as a spike test, where a single short burst of concurrent activity is applied to a system. Such tests are typical of simulating extreme activity where a count down situation exists. For example, a system that will not take orders for a new product until a particular date and time. If demand is very strong, then many users will be poised to use the system the moment the count down ends, creating a spike of concurrent requests and load.


Saturday, December 18, 2010

Overview of Stress Testing and its Focus..

Stress Tests determine the load under which a system fails, and how it fails. This is in contrast to load testing, which attempts to simulate anticipated load. It is important to know in advance if a stress situation will result in catastrophic system failure, or if everything just goes really slow. There are various varieties of stress tests, including spike, stepped and gradual ramp-up tests. Catastrophic failures require restarting various infrastructure and contribute to downtime, a stress-full environment to support staff and managers, as well as possible financial losses. If a major performance bottleneck is reached, then the system performance will usually degrade to a point that is unsatisfactory, but performance should return to normal when the excessive load is removed.
Before conducting a stress test, it is usually advisable to conduct targeted infrastructure tests on each of the key components in the system. A variation on targeted infrastructure tests would be to execute each one as a mini stress test.

What is the focus of stress tests?


In a stress event, it is most likely that many more connections will be requested per minute than under normal levels of expected peak activity. In many stress situations, the actions of each connected user will not be typical of actions observed under normal operating conditions. This is partly due to the slow response and partly due to the root cause of the stress event.

If we take an example of a large holiday resort web site, normal activity will be characterized by browsing, room searches and bookings. If a national online news service posted a sensational article about the resort and included a URL in the article, then the site may be subjected to a huge number of hits, but most of the visits would probably be a quick browse. It is unlikely that many of the additional visitors would search for rooms and it would be even less likely that they would make bookings. However, if instead of a news article, a national newspaper advertisement erroneously understand the price of accommodation, then there may well be an influx of visitors who cl amour to book a room, only to find that the price did not match their expectations.

In both of the above situations, the normal traffic would be increased with traffic of a different usage profile. So, a stress test design would incorporate a load test as well as additional virtual users running a special series of stress navigations and transactions.
For the sake of simplicity, one can just increase the number of users using the business processes and functions coded in the load test. However, one must then keep in mind that a system failure with that type of activity may be different to the type of failure that may occur if a special series of stress navigations were utilized for stress testing.


Monday, September 20, 2010

What is the possible test approach for simulation system ?

A simulation system's primary responsibility is to replicate the behavior of the real system as accurately as possible. Therefore, a good place to start creating a test plan would be to understand the behavior of the real system.

- Subjective Testing:
It mainly depends on an expert's opinion. An expert is a person who is proficient and experienced in the system under test. Conducting the test involves test runs of the simulation by the expert and then the expert evaluates and validates the results based on some criteria. Advantage of this approach is that it can test those conditions which cannot be tested objectively. Disadvantage is that the evaluation of the system is based on the expert's opinion which may differ from expert to expert.
- Objective Testing:
It is mainly used in the systems where the data can be recorded while the simulation is running. This testing technique relies on the application of statistical and automated methods to the data collected.
Statistical methods are used to provide an insight into the accuracy of the simulation. These methods include hypothesis testing, data plots, principle component analysis and cluster analysis.
Automated testing requires a knowledge base of valid outcomes for various runs of simulation. The knowledge base is created by domain experts of the simulation system being tested. The data collected in various test runs is compared against this knowledge base to automatically validate the system under test. An advantage of this kind of testing is that the system can continually be regression tested as it is being developed.


Sunday, September 19, 2010

Types of Simulation Systems: Dynamic, Discrete, Continuous and Social Simulation Systems

- Dynamic Simulation Systems: It has a model that accommodates for changes in data over time. This means that the input data affecting the results will be entered in to the simulation during its entire lifetime than just at the beginning. A simulation system used to predict the growth of the economy may need to incorporate changes in economic data is a good example of a dynamic simulation systems.

- Discrete Simulation Systems: These systems use models that have discrete entities with multiple attributes. Each of these entities can be in any state, at any given time, represented by the value of its attributes. The state of the system is a set of all the states of all its entities. This stage changes one discrete step at a time as events happen in the system. therefore, the actual designing of the simulation involves making choices about which entities to model. Examples include simulated battlefield scenarios, highway traffic control systems etc.

- Continuous Simulation Systems: If instead of using a model with discrete entities, we use data with continuous values, we will end up with continuous simulation.

- Social Simulation Systems: It is not a technique by itself but uses the various types of simulation described above. However, because of the specialized application of those techniques for social simulation, it deserves a special mention of its own. The field of social simulation involves using simulation to learn about and predict various social phenomenon such as voting patterns, migration patterns, economic decisions made by the general population etc.


Saturday, September 18, 2010

Types of Simulation Systems: Deterministic, Stochastic, Static Simulation Systems

Simulation is widely used in many fields. Some of the applications are :
- Models of planes and cars that are tested in wind tunnels to determine the aerodynamic properties.
- It is used in computer games e.g. simCity, car games etc. This simulates the roads, people talking, playing games etc.
- War tactics that are simulated using simulated battlefields.
- Most of the embedded systems are developed by simulation software before they ever make it to the chip fabrication labs.
- Stochastic simulation models are often used to model applications such as weather forecasting systems.
- Social simulation is used to model socio-economic situations.
- It is extensively used in the field of operations research.

Simulation systems can be characterized in numerous ways depending on the characterization criteria applied. Some of them are:
- Deterministic Simulation Systems: These systems have completely predictable outcomes. If given a certain input, we can predict the exact outcome. Another feature of these systems is idem-potency which means that the results for any given input are always the same. Examples include population prediction models, atmospheric science etc.
- Stochastic Simulation Systems: These systems have models with random variables. This means that the exact outcome is not predictable for any given input resulting in potentially very different outcomes for the same input.
- Static Simulation Systems: These systems use statistical models in which time does not play any role. These models include various probabilistic scenarios which are used to calculate the results of any given input. Examples of such systems include financial portfolio valuation models.


Facebook activity