Tuesday, August 16, 2011

Software Testing - Prototype Model for Developers

A prototype is an early sample or model built to test a concept or process or to act as a thing to be replicated or learned from. It has been taken from the greek word - prototypon meaning primitive form.
Prototyping model was developed to counter the limitations of waterfall model. The basic idea behind prototyping model is that instead of freezing the requirements before any design or coding can begin, a throwaway prototype is built to understand the requirements. This prototype is build based on currently known requirements.
The throwaway prototype undergoes design, coding, testing but each of these phases are not formal. The prototype is developed and delivered to client, client uses this prototype and gets the actual feel of the system.
Client interacts with the system and gets better understanding of the requirements of the desired system, this at last results in more stable requirements from clients.
Prototyping model is mostly used for projects where the requirements are not very clear from client. When a prototype is developed using known unclear requirements and given to customer he uses the prototype and gets the feel of the software system and then produces concrete requirements.
In prototyping model the focus of the development is to include those features which are not properly understood as prototype is anyway to be discarded. So the well known requirements are not implemented in the prototype.

Development Approach of Prototyping Model

Development approach for prototyping model is quick and dirty, main focus is on quick development rather than high quality prototype. Minimal documentation is done like Test Plan, Design Documents, Test Cases Documents are not prepared. Minimum testing is done as testing consumes major part of expenditure.

Prototype Models Types

Patch Up Prototype  : This type of Prototype Model encourages cooperation of different developers. Each developer will work on a specific part of the program. After everyone has done their part, the program will be integrated with each other resulting in a whole new program. Since everyone is working on a different field, Patch Up Prototype is a fast development model. If each developer is highly skilled, there is no need to overlap in a specific function of work. This type of software development model only needs a strong project manager who can monitor the development of the program. The manager will control the work flow and ensure there is no overlapping of functions among different developers.

Non-Operational Prototype  :  A non-operational prototype model is used when only a certain part of the program should be updated. Although it’s not a fully operational program, the specific part of the program will work or could be tested as planned. The main software or prototype is not affected at all as the dummy program is applied with the application. Each developer who is assigned with different stages will have to work with the dummy prototype. This prototype is usually implemented when certain problems in a specific part of the program arises. Since the software could be in a prototype mode for a very long time, changing and maintenance of specific parts is very important. Slowly it has become a smart way of creating software by introducing small functions of the software.

First of a Series Prototype  :  Known as a beta version, this Prototype Model could be very efficient if properly launched. In all beta versions, the software is launched and even introduced to the public for testing. It’s fully functional software but the aim of being in beta version is to as for feedbacks, suggestions or even practicing the firewall and security of the software. It could be very successful if the First of a Series Prototype is properly done. But if the program is half heartedly done, only aiming for additional concept, it will be susceptible to different hacks, ultimately backfiring and destroying the prototype.

Selected Features Prototype  :  This is another form of releasing a software in beta version. However, instead of giving the public the full version of the software in beta, only selected features or limited access to some important tools in the program is introduced. Selected Features Prototype is applied to software that are part of a bigger suite of programs. Those released are independent of the suite but the full version should integrate with other software. This is usually done to test the independent feature of the software.

Advantages 

  1. In prototyping model requirements are frozen at a later stage by which time they are likely to be stable.
  2. Client or end users already get experience with the prototype system. It is more likely that the requirements specified after prototype will be very close to actual requirements.
  3. Reduces risks associated with the projects.

Disadvantages

              1.  Since its being built out of the concept most of the models presented in the  
                   early stages are not complete.
              2.  Since the prototype changes from time to time its a nightmare to create a
                   document for this software.

 


Sunday, August 7, 2011

Software Testing - 4 (Courtesy : www.buzzle.com)

Software Testing Methodologies

Waterfall Model
The waterfall model adopts a 'top down' approach regardless of whether it is being used for software development or testing. The basic steps involved in this software testing methodology are:
  1. Requirement analysis
  2. Test case design
  3. Test case implementation
  4. Testing, debugging and validating the code or product
  5. Deployment and maintenance
In this methodology, you move on to the next step only after you have completed the present step. There is no scope for jumping backward or forward or performing two steps simultaneously. Also, this model follows a non-iterative approach. The main benefit of this methodology is its simplistic, systematic and orthodox approach. However, it has many shortcomings since bugs and errors in the code are not discovered until and unless the testing stage is reached. This can often lead to wastage of time, money and valuable resources.

V Model
The V model gets its name from the fact that the graphical representation of the different test process activities involved in this methodology resembles the letter 'V'. The basic steps involved in this methodology are more or less the same as those in the waterfall model. However, this model follows both a 'top-down' as well as a 'bottom-up' approach (you can visualize them forming the letter 'V'). The benefit of this methodology is that in this case, both the development and testing activities go hand-in-hand. For example, as the development team goes about its requirement analysis activities, the testing team simultaneously begins with its acceptance testing activities. By following this approach, time delays are minimized and optimum utilization of resources is assured.

Spiral Model
As the name implies, the spiral model follows an approach in which there are a number of cycles (or spirals) of all the sequential steps of the waterfall model. Once the initial cycle is completed, a thorough analysis and review of the achieved product or output is performed. If it is not as per the specified requirements or expected standards, a second cycle follows, and so on. This methodology follows an iterative approach and is generally suited for very large projects having complex and constantly changing requirements.

Rational Unified Process (RUP)
The RUP methodology is also similar to the spiral model in the sense that the entire testing procedure is broken up into multiple cycles or processes. Each cycle consists of four phases namely; inception, elaboration, construction and transition. At the end of each cycle, the product or the output is reviewed and a further cycle (made up of the same four phases) follows if necessary. Today, you will find certain organizations and companies adopting a slightly modified version of the RUP, which goes by the name of Enterprise Unified Process (EUP).

Agile Model
This methodology follows neither a purely sequential approach nor does it follow a purely iterative approach. It is a selective mix of both of these approaches in addition to quite a few new developmental methods. Fast and incremental development is one of the key principles of this methodology. The focus is on obtaining quick, practical and visible outputs and results, rather than merely following theoretical processes. Continuous customer interaction and participation is an integral part of the entire development process.

Rapid Application Development (RAD)
The name says it all. In this case, the methodology adopts a rapid development approach by using the principle of component-based construction. After understanding the various requirements, a rapid prototype is prepared and is then compared with the expected set of output conditions and standards. Necessary changes and modifications are made after joint discussions with the customer or the development team (in the context of software testing). Though this approach does have its share of advantages, it can be unsuitable if the project is large, complex and happens to be of an extremely dynamic nature, wherein the requirements are constantly changing.

Software Testing -3 (Courtesy : www.buzzle.com)

Software testing - Revisited ;)

Before moving further towards introduction to software testing, we need to know a few concepts that will simplify the definition of software testing.
  • Error: Error or mistake is a human action that produces wrong or incorrect result.
  • Defect (Bug, Fault): A flaw in the system or a product that can cause the component to fail or misfunction.
  • Failure: It is the variance between the actual and expected result.
  • Risk: Risk is a factor that could result in negativity or a chance of loss or damage.
Thus Software testing is the process of finding defects/bugs in the system, that occurs due to an error in the application, which could lead to failure of the resultant product and increase in probability of high risk. In short, software testing have different goals and objectives, which often include:
  1. finding defects;
  2. gaining confidence in and providing information about the level of quality;
  3. preventing defects.
If you are new to the field of software testing, then the article software testing for beginners will be of great help.

Scope of Software Testing

The primary function of software testing is to detect bugs in order to correct and uncover it. The scope of software testing includes execution of that code in various environment and also to examine the aspects of code - does the software do what it is supposed to do and function according to the specifications? As we move further we come across some questions such as "When to start testing?" and "When to stop testing?" It is recommended to start testing from the initial stages of the software development. This not only helps in rectifying tremendous errors before the last stage, but also reduces the rework of finding the bugs in the initial stages every now and then. It also saves the cost of the defect required to find it. Software testing is an ongoing process, which is potentially endless but has to be stopped somewhere, due to the lack of time and budget. It is required to achieve maximum profit with good quality product, within the limitations of time and money. The tester has to follow some procedural way through which he can judge if he covered all the points required for testing or missed out any. To help testers to carry out these day-to-day activities, a baseline has to be set, which is done in the form of checklists. Read more on checklists for software tester.

Software Testing Key Concepts
  • Defects and Failures: As we discussed earlier, defects are not caused only due to the coding errors, but most commonly due to the requirement gaps in the non-functional requirement, such as usability, testability, scalability, maintainability, performance and security. A failure is caused due to the deviation between an actual and an expected result. But not all defects result to failures. A defect can turn into a failure due to the change in the environment and or the change in the configuration of the system requirements.
  • Input Combination and Preconditions: Testing all combination of inputs and initial state (preconditions), is not feasible. This means finding large number of infrequent defects is difficult.
  • Static and Dynamic Analysis: Static testing does not require execution of the code for finding defects, whereas in dynamic testing, software code is executed to demonstrate the results of running tests.
  • Verification and Validation: Software testing is done considering these two factors.
    1. Verification: This verifies whether the product is done according to the specification?
    2. Validation: This checks whether the product meets the customer requirement?
  • Software Quality Assurance: Software testing is an important part of the software quality assurance  . Quality assurance is an activity, which proves the suitability of the product by taking care of the quality of a product and ensuring that the customer requirements are met.
Steps for Software Testing

Along with finding defects in the software, software testing aims to verify and validate the software, so that it complies with the business and technical requirements, works exactly as it is expected to and can be implemented again, when the existing factors do exist. Although software testing can be implemented at any point of time in the software development life cycle, it is normally implemented after the development stage has come to an end. Till the software development process is underway, it is the developers, who carry out the testing process, commonly referred to as white box testing. After the software has been handed over to the testing team, starts the black box testing. This brings us to what are the essential steps of software testing. Let's find out.

Note Scope of Testing
Although software testing aims to find defects in the software, it is important to note, that testing cannot assure that the software will work perfectly under all circumstances. It will only assure that the software will work perfectly under certain predetermined conditions. It is in the scope phase that it is decided upon, 'what is the software suppose to do'. It is important that the testing team understands the aim of the software. This will help in understanding the real time scenario, where the software is exactly going to be used. The documents created before the development process started should be analyzed and business rules have to be understood for the same. If there is any variance found in the document, the same should be raised during the meeting with the development team. Along with all the other tasks, there an important factors, which should not be forgotten while deciding the scope of testing. It is the stage when software testing stop. Else there are chances, that the testing process will go in a never ending loop.

Decide Testing Approach
Once the scope has been decided upon, the next stage of software testing is to decide the testing approach, that is going to be used. The methods and tools, which need to be used for the process are decided upon. At this stage, it is important to take the client assumptions and various dependencies and limitations into consideration.

Decide Testing Tasks
Now that the testing approach has been decided upon, the next step is to decide the tasks, that have to be completed in each testing phase. The documents to be delivered to the internal client (development team and stakeholders) and to the external client (end user) have to be decided upon. Giving the documents to the internal and external client keeps them in loop about the happenings.

Estimate Time and Budget
The next step is to estimate the time and budget necessary for the entire software testing lifecycle as well as for each of the phase of the cycle. In case any of the budget is overshooting, measures can be taken to curb them and get them on track.

Identify the Testing Phases
Now starts the actual task of testing the software. Normally, start and end date of each of the testing phase is identified, along with the phases that may overlap. It is in this phase that different software testing methodologies are used to test the software. Each of the methodology used has a different aim, while testing the software. This helps in testing maximum aspects of the software. The exit criteria for each of the phase is identified as well, so that the testing process can be stopped after the exit criteria has been met. When bugs have been identified in the software, the same are reported to the Testing Manager. The Manager creates a report along with the conditions in which the bug was reported. This is then forwarded to the development team, who study the bugs. They may accept some of the bugs and reject some of the bugs. After which they normally give the time necessary for fixing the bugs. Once the bugs are fixed, the software is sent back to the testing team for further testing.

Decide Testing Environment
The different hardware and software requirements necessary for testing the software should be identified in advance. Normally, wide range of test environments are decided upon. For example, if it is a software intended for use on the internet, then the software is tested on all the prominent browsers. There are times, when the software may work perfectly fine on one browser, but may show errors, when it is run on another browser.

Decide Retesting Strategy
If there is a problem with the software, it is sent back to the development team. When the problem has been fixed, the testing team has to test the software. The strategy to retest the software has to be place for the same.

Decide Regression Testing Strategy
Often it happens, that one defect is fixed and another defect is created. The aim of regression testing is to ensure that no more new bugs have been introduced in the software and the software is working perfectly.

Closure of Testing Activities
After the exit criteria has been met, start the test closer activities. In this step, the key outputs are captured, results, log, documents related to the project are put together. All of these go a long way and often prove to be of help for the future projects. 

Software Testing - 2 (Courtesy : the-software-experts.de)

What is not Software Testing?

  • Test is not debugging. Debugging has the goal to remove errors. The existence and the approximate location of the error are known. Debugging is not documented. There is no specification and there will be no record (log) or report. Debugging is the result of testing but never a substitution for it.
  • Test can never find 100% of the included errors. There will be always a rest of remaining errors which can not be found. Each kind of test will find a different kind of errors.
  • Test has the goal to find errors and not their reasons. Therefore the activity of testing will not include any bug fixing or implementation of functionality. The result of testing is a test report. A tester must not modify the code he is testing, by no means! This has to be done by the developer based on the test report he receives from the tester.

What is Software Testing?

  • Test is a formal activity. It involves a strategy and a systematic approach. The different stages of tests supplement each other. Tests are always specified and recorded.
  • Test is a planned activity. The workflow and the expected results are specified. Therefore the duration of the activities can be estimated. The point in time where tests are executed is defined.
  • Test is the formal proof of software quality.

Overview of Test Methods

Static tests
The software is not executed but analyzed offline. In this category would be code inspections (e.g. Fagan inspections), Lint checks, cross reference checks, etc.

Dynamic tests
This requires the execution of the software or parts of the software (using stubs). It can be executed in the target system, an emulator or simulator. Within the dynamic tests the state of the art distinguishes between structural and functional tests.

Structural tests
These are so called "white-box tests" because they are performed with the knowledge of the source code details. Input interfaces are stimulated with the aim to run through certain predefined branches or paths in the software. The software is stressed with critical values at the boundaries of the input values or even with illegal input values. The behavior of the output interface is recorded and compared with the expected (predefined) values.

Functional tests
These are the so called "black-box" tests. The software is regarded as a unit with unknown content. Inputs are stimulated and the values at the output results are recorded and compared to the expected and specified values.

Test by progressive Stages

The various tests are able to find different kinds of errors. Therefore it is not enough to rely on one kind of test and completely neglect the other. E.g. white-box tests will be able to find coding errors. To detect the same coding error in the system test is very difficult. The system malfunction which may result from the coding error will not necessarily allow conclusions about the location of the coding error. Test therefore should be progressive and supplement each other in stages in order to find each kind of error with the appropriate method.

Module test
A module is the smallest compilable unit of source code. Often it is too small to allow functional tests (black-box tests). However it is the ideal candidate for white-box tests. These have to be first of all static tests (e.g. Lint and inspections) followed by dynamic tests to check boundaries, branches and paths. This will usually require the employment of stubs and special test tools.

Component test
This is the black-box test of modules or groups of modules which represent certain functionality. There are no rules about what can be called a component. It is just what the tester defined to be a component, however it should make sense and be a testable unit. Components can be step by step integrated to bigger components and tested as such.

Integration test
The software is step by step completed and tested by tests covering a collaboration of modules or classes. The integration depends on the kind of system. E.g. the steps could be to run the operating system first and gradually add one component after the other and check if the black-box tests still run (the test cases of course will increase with every added component). The integration is still done in the laboratory. It may be done using simulators or emulators. Input signals may be stimulated.

System test
This is a black-box test of the complete software in the target system. The environmental conditions have to be realistic (complete original hardware in the destination environment).

Which Test finds which Error? 

 

Possible error Can be best found by Example
Syntax errors Compiler, Lint Missing semicolons, Values defined but not initalized or used, order of evaluation disregarded.
Data errors Software inspection, module tests Overflow of variables at calculation, usage of inappropriate data types, values not initialized, values loaded with wrong data or loaded at a wrong point in time, lifetime of pointers.
Algorithm and logical errors Software inspection, module tests Wrong program flow, use of wrong formulas and calculations.
Interface errors Software inspection, module tests, component tests. Overlapping ranges, range violation (min. and max. values not observed or limited), unexpected inputs, wrong sequence of input parameters.
Operating system errors, architecture and design errors Design inspection, integration tests Disturbances by OS interruptions or hardware interrupts, timing problems, lifetime and duration problems.
Integration errors Integration tests, system tests Resource problems (runtime, stack, registers, memory, etc.)
System errors System tests Wrong system behaviour, specification errors.

Friday, August 5, 2011

Software testing

Introduction


Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects).
Software testing can be stated as the process of validating and verifying that a software program/application/product:
1.   meets the requirements that guided its design and development;
2.   works as expected; and
3.   can be implemented with the same characteristics.
Software testing, depending on the testing method employed, can be implemented at any time in the development process. However, most of the test effort occurs after the requirements have been defined and the coding process has been completed. As such, the methodology of the test is governed by the software development methodology adopted.
Different software development models will focus the test effort at different points in the development process. Newer development models, such as Agile, often employ test driven development and place an increased portion of the testing in the hands of the developer, before it reaches a formal team of testers. In a more traditional model, most of the test execution occurs after the requirements have been defined and the coding process has been completed.

Testing methods

White-box testing : White-box testing (also known as clear box testing, glass box testing, transparent box testing, and structural testing) is a method of testing software that tests internal structures or workings of an application, as opposed to its functionality . In white-box testing an internal perspective of the system, as well as programming skills, are required and used to design test cases. The tester chooses inputs to exercise paths through the code and determine the appropriate outputs. This is analogous to testing nodes in a circuit, e.g. in-circuit testing (ICT).
While white-box testing can be applied at the unit, integration and system levels of the software testing process, it is usually done at the unit level. It can test paths within a unit, paths between units during integration, and between subsystems during a system level test. Though this method of test design can uncover many errors or problems, it might not detect unimplemented parts of the specification or missing requirements.
White-box test design techniques include:
•       Control flow testing
•       Data flow testing
•       Branch testing
•       Path testing

Black-box testing : Black-box testing also known as opaque box testing is a method of software testing that tests the functionality of an application as opposed to its internal structures or workings . Specific knowledge of the application's code/internal structure and programming knowledge in general is not required. Test cases are built around specifications and requirements, i.e., what the application is supposed to do. It uses external descriptions of the software, including specifications, requirements, and designs to derive test cases. These tests can be functional or non-functional, though usually functional. The test designer selects valid and invalid inputs and determines the correct output. There is no knowledge of the test object's internal structure.
This method of test can be applied to all levels of software testing: unit, integration, functional, system and acceptance. It typically comprises most if not all testing at higher levels, but can also dominate unit testing as well.


Grey box testing : Grey box testing (American spelling: gray box testing) involves having knowledge of internal data structures and algorithms for purposes of designing the test cases, but testing at the user, or black-box level. Manipulating input data and formatting output do not qualify as grey box, because the input and output are clearly outside of the "black-box" that we are calling the system under test. This distinction is particularly important when conducting integration testing between two modules of code written by two different developers, where only the interfaces are exposed for test. However, modifying a data repository does qualify as grey box, as the user would not normally be able to change the data outside of the system under test. Grey box testing may also include reverse engineering to determine, for instance, boundary values or error messages.
Incremental integration testing : Bottom up approach for testing i.e continuous testing of an application as new functionality is added; Application functionality and modules should be independent enough to test separately. done by programmers or by testers.
Functional testing : This type of testing ignores the internal parts and focus on the output is as per requirement or not. Black-box type testing geared to functional requirements of an application.
End-to-end testing : Similar to system testing, involves testing of a complete application environment in a situation that mimics real-world use, such as interacting with a database, using network communications, or interacting with other hardware, applications, or systems if appropriate.
Sanity testing : Testing to determine if a new software version is performing well enough to accept it for a major testing effort. If application is crashing for initial use then system is not stable enough for further testing and build or application is assigned to fix.
Regression testing : Testing the application as a whole for the modification in any module or functionality. Difficult to cover all the system in regression testing so typically automation tools are used for these testing types.
Acceptance testing : Normally this type of testing is done to verify if system meets the customer specified requirements. User or customer do this testing to determine whether to accept application.
Load testing : Its a performance testing to check system behavior under load. Testing an application under heavy loads, such as testing of a web site under a range of loads to determine at what point the system’s response time degrades or fails.
Stress testing : System is stressed beyond its specifications to check how and when it fails. Performed under heavy load like putting large number beyond storage capacity, complex database queries, continuous input to system or database load.
Performance testing : Term often used interchangeably with ‘stress’ and ‘load’ testing. To check whether system meets performance requirements. Used different performance and load tools to do this.
Usability testing : User-friendliness check. Application flow is tested, Can new user understand the application easily, Proper help documented whenever user stuck at any point. Basically system navigation is checked in this testing.
Install/uninstall testing : Tested for full, partial, or upgrade install/uninstall processes on different operating systems under different hardware, software environment.
Recovery testing : Testing how well a system recovers from crashes, hardware failures, or other catastrophic problems.
Security testing : Can system be penetrated by any hacking way. Testing how well the system protects against unauthorized internal or external access. Checked if system, database is safe from external attacks.
Compatibility testing : Testing how well software performs in a particular hardware/software/operating system/network environment and different combination s of above.
Comparison testing : Comparison of product strengths and weaknesses with previous versions or other similar products.
Alpha testing : In house virtual user environment can be created for this type of testing. Testing is done at the end of development. Still minor design changes may be made as a result of such testing.
Beta testing : Testing typically done by end-users or others. Final testing before releasing application for commercial purpose.
Monkey testing : A monkey test is a unit test that runs with no specific test in mind. The monkey in this case is the producer of any input. For example, a monkey test can enter random strings into text boxes to ensure handling of all possible user input or provide garbage files to check for loading routines that have blind faith in their data. The test monkey is technically known to conduct stochastic testing, which is in the category of black-box testing.
Gorilla testing : Testing one particular Module, funcitonality heavily.


Testing levels

Tests are frequently grouped by where they are added in the software development process, or by the level of specificity of the test. The main levels during the development process as defined by the SWEBOK guide are unit-, integration-, and system testing that are distinguished by the test target without implying a specific process model.Other test levels are classified by the testing objective.
Unit testing : Unit testing refers to tests that verify the functionality of a specific section of code, usually at the function level. In an object-oriented environment, this is usually at the class level, and the minimal unit tests include the constructors and destructors.
These types of tests are usually written by developers as they work on code (white-box style), to ensure that the specific function is working as expected. One function might have multiple tests, to catch corner cases or other branches in the code. Unit testing alone cannot verify the functionality of a piece of software, but rather is used to assure that the building blocks the software uses work independently of each other.
Unit testing is also called component testing.

Integration testing : Integration testing is any type of software testing that seeks to verify the interfaces between components against a software design. Software components may be integrated in an iterative way or all together ("big bang"). Normally the former is considered a better practice since it allows interface issues to be localized more quickly and fixed.

Integration testing works to expose defects in the interfaces and interaction between integrated components (modules). Progressively larger groups of tested software components corresponding to elements of the architectural design are integrated and tested until the software works as a system.
System testing : System testing tests a completely integrated system to verify that it meets its requirements. System testing of software or hardware is testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. System testing falls within the scope of black box testing, and as such, should require no knowledge of the inner design of the code or logic.
System Integration Testing : System integration testing is the process of verifying the synchronization between two or more software systems and which can be performed after software system collaboration is completed. It verifies that a system is integrated to any external or third-party systems defined in the system requirements.