Monday, 3 November 2014

Functional and Non Functional types of Testing

Functional Testing
Functional Testing refers to verifying if the module performs its intended functions in accordance with the specification. The purpose is to ensure that the application’s behavior is as expected.
Different types of functional testing are explained below.
Unit Testing
  • Primary test performed on software is the ‘Unit Testing’ to see if a standalone module is working as per the requirements.
  • Testing done on a single, standalone module or unit of code to ensure correctness of the particular module.
  • Focuses on implementation logic, so the idea is to write test cases for every method in the module.
  • The aim of unit testing is to segregate each part of the program and prove that each of them is correct.
  • This type of testing is predominantly undertaken by the developers.
Integration Testing
In this testing individual software modules are combined and tested as a group. It is done after unit testing and before system testing.
It takes the unit tested modules as input, groups them in larger aggregates, applies tests defined in an Integration test plan. An integrated system which is ready for system testing is then delivered as the output.
Data transfer between the integrated modules is thoroughly tested.
Dummy modules interface viz. Stubs and Drivers are used in integration testing.
Drivers are programs designed exclusively for testing the calls to lower layers. It provides emerging low-level modules with simulated inputs and the necessaryresources to function.
Stubs are dummy software components used to simulate the behavior of a real component. They do not perform any real computation or data manipulation. It can be defined as a small program routine that is used in place of a longer program, to be loaded later or that is located remotely.
Two methods of integration are
Incremental
It involves adding unit tested modules one by one and checking each resultant combination. This process repeats till all modules are integrated and tested.
Correction is easy as the source and cause of error could be easily detected.
Big bang
Modules unit tested at isolation are integrated at one go and the integration is tested.
Correction is difficult because isolation of causes is complicated.
strategies of integration are
Bottom-Up Strategy
Process starts with low level modules of the program hierarchy in the application architecture
Test drivers are used
Top-Down Strategy
Starts at the top of the program hierarchy in the application architecture and travels down its Branches
Stubs are used until the actual program is ready
Smoke Testing
This is a quick & non exhaustive test performed on the new version of the software to see whether is performance is up to the required levels to accept it for major testing. This test is used to validate if the major functions of a piece of software work as intended.
Reasons, why a build could be rejected include
  • Major functionalities are not working fine or missing
  • Navigations are not appropriate
  • Look and feel is not according to specification
System Testing
This is a black-box type testing based on overall system requirement specifications. It is carried out end-to-end on an integrated system. During system test execution phase, defects detectable only by testing the entire system are identified.
Regression Testing
Regression testing is performed to check whether a defect fix or enhancement to the system has introduced a new failure. This refers to continuous testing of an application for each new build.
Regression testing should be tightly linked to functional testing, and be built from the successful test cases developed and used in functional testing. These test cases are then run regularly as regression test to verify that the new code being added is not effecting the existing application
User Acceptance testing(in a Black box testing)
One of the last phases of testing is Acceptance testing.It is typically done at the customer place. Generally users perform these tests which are ideally derived from the User Requirements Specification.
Alpha Testing: Simulated or actual operational testing performed by end users within a company but outside the core group which was involved in development.
Beta Testing: Beta testing comes after alpha testing and can be considered a form of external user acceptance testing. Versions of the software, known as beta versions, are released to a limited audience outside of the programming team. The software is released to groups of people so that further testing can ensure the product has few faults or bugs. Sometimes, beta versions are made available to the open public to increase the feedback field to a maximal number of future users.
 
Non Functional Testing
Non functional testing verifies if the application performs its intended functions as per the non functional requirements which could be performance, security, usability, compatibility etc.
Performance Testing:
This testing is carried out to analyze/measure the behavior of the system in terms of time, stability and scalability and the parameters generally used are response time, transaction rates etc. This is done to verify whether the performance requirements have been achieved.
Types of Performance Testing (Not a part of performance testing)
Load Testing
Load testing is defined as type of performance testing where performance of the application is monitored when subjected to different loads. Load is the measure of the number of users using the application. Real time work load situations are simulated for the application under test.
  • It models the expected usage of an application by a simulation of a large number of users’ simultaneously access of the program’s services
  • To determine at what load the system fails or system’s response time degrades
  • Relevance of this test is very high for multi-user systems
Stress testing
Stress testing is conducted to evaluate a system’s performance or that of a component at or beyond the limits of its specified requirements. Ideally, stress testing emulates the maximum capacity the application can support before causing a system outage or disruption. Based on the results of stress testing, system can be configured and fine tuned for optimal performance.
  • This test determines at which point the system fails while subjected to extreme pressure.
  • Useful when systems are being scaled up or being implemented for the first time.
  • System is monitored for performance loss and crashing during the load times.
Endurance Testing
This involves execution of the test with a sustained expected user load, over long period of time with normal ramp up and ramp down. Endurance testing helps in uncovering the performance bottlenecks like memory leaks, which becomes visible when the system is subjected to normal load for a prolonged time.
Volume Testing
Volume testing is the testing where the database is subjected to large data volumes to determine its point of failure. It is used to study the application behavior when the database is populated with production like data and to find the impact on the response time of the application and the overall health of the database.
Scalability Testing
Scalability testing is loading the system with increasing load simulating the expected business growth (user load growth) of the application down the years. This test is done to determine how effectively the system can scale to accommodate the increasing load and for system capacity planning for procurement of more resources down the line.
Compatibility Testing
Test to validate that the application functions the same way across different supported
  1. Hardware and software configurations
  2. Operating systems (OS)
  3. Web browsers
  4. Database types
Globalization Testing
To ensure that internationally localized versions do not have problems unique to language/currency etc
To validate whether application developed provide support for
1. Multi-language
  • Check whether messages are accurate
  • UI objects in all languages reflects same meaning
2. Multi Currency
Localization Testing
Subset of globalization testing and checks for a particular locale
Can be executed only on the localized version of a product
This test is based on the results of globalization testing, which verifies the functional support for a particular culture/locale.
Data Migration Testing
The Data Migration testing is done to validate the migration of the source data to the new platform say from one database to a different database or from one version of the database to a new version of the database.
Data Conversion Testing:
The Data Conversion testing is done to validate the Conversion of the source data to the target data. Data Conversion testing and implementation are practically inseparable. The Data Conversion testing plan should be made to confirm the following:
  • Whether or not the source data type has been converted to the target data type?
  • Is there any loss in the data?
  • Is data integrity maintained?
Security/Penetration Testing:
Security testing evaluates that an Information System maintains confidentiality, availability and integrity of data. The aim of security testing is to assess the sensitivity of the system against unauthorized internal or external access. Testing is done to ensure that unauthorized persons are not given access.
Special skills required for security testing
  • Ability to think like a hacker
  • Being aware of all known vulnerability & exploits
  • Thorough understanding of runtime environment
  • Identification of criticality and sensitivity of data assets
Usability testing
In usability testing, software is evaluated for the easiness with which user can learn and use the application.  Essentially it means testing the software to ensure its ‘user friendliness’.
Install/Un-Install Testing
Testing carried out to evaluate the instructions provided in the manual and the accuracy with which the installed application operates. This testing is carried out to evaluate that no residue remains after the un-installation of the application.
  • Occurs outside the development environment.
  • Includes the inventory of configuration items.
  • Installation test is conducted for demonstrating production readiness.
  • This type of testing frequently occurs on the computer system in which the software product will eventually be installed.
  • Done in case of full or partial upgrades












































































Test Levels

Testing levels are basically to identify missing areas and prevent overlap and repetition between the development life cycle phases. In software development life cycle models there are defined phases like requirement gathering and analysis, design, coding or implementation, testing and deployment.  Each phase goes through the testing. Hence there are various levels of testing.

The various levels of testing are:

1. Unit testing: It is basically done by the developers to make sure that their code is working fine and meet the user specifications. They test their smallest piece of code which they have written like classes, functions, interfaces and procedures. The input for the Unit Testing is from design document. It follows White box testing technique.

2. Component testing: It is also called as module testing. The basic difference between the unit testing and component testing is in unit testing the developers test their piece of code but in component testing the whole component is tested. A small functionality may have few units combining them forms a component.

For example, in a student record application there are two modules one which will save the records of the students and other module is to upload the results of the students. The modules are developed separately and when they are tested one by one then we call this as a component or module testing.

3. Integration testing: Integration testing is done when two modules are integrated, in order to test the behavior and functionality of both the modules after integration. Below are few types of integration testing:

  • Big bang integration testing – All the functionalities are integrated once and the interfaces are tested. It’s a failure model since the failures cannot be exactly pointed out
  • Top down – The main module is created and the sub system or sub modules are placed with the dummy modules called Stubs. The Stubs are the called modules.
  • Bottom up – The sub modules are created first and the main module is placed with the dummy module called Drivers. The Drivers are the calling module.
  • Functional incremental –The modules are functionally incremented and tested.

a. Component integration testing: In the example above when both the modules and components are integrated then the testing done is called as Component integration testing. This testing is basically done to ensure that the code should not break after integrating the two modules.

b. System integration testing: System integration testing (SIT) is a testing where testers basically test that in the same environment all the related systems should maintain data integrity and can operate in coordination with other systems.

4. System testing: In system testing the testers basically test the compatibility of the application with the system. The end to end or whole functionality is tested to verify that it meets all the requirements.

5. Acceptance testing: Acceptance testing is basically done to ensure that the requirements of the specification are met. This is done by the end users, follows the black box testing and the inputs are from the requirement document.

  • Alpha testing: Alpha testing is done at the developer’s site but not by the developers who have developed. It is done at the end of the development process.
  • Beta testing: Beta testing is also called as Field testing which is done at the customer’s site. It is done just before the launch of the product.

Thursday, 30 October 2014

Test Execution

In the STLC phases(Test planning, Test Preparation, Test Execution and Test Closure) the Test Execution is the one of the most important phase carried out by the Testers

    • Test Plan describes the planning of Test policy and Test strategy. A road map for the entire testing activity
    • Test Design describes the design techniques Example: Structural based, Specification based and Experienced based
    • Test Execution describes the actual execution of the Test
    • Test Closure describes the Entry and Exit criteria of test closure and Summary report of the Tests

Let us see the various phases in Test Execution,

  1. Build Verification Test(BVT)
  2. Test Case or Script execution
  3. Defect Reporting
  4. Re-testing or Regression Testing
  5. Test Execution status

1. When the developers are ready with the build, the build is released by the manager. Then the Testers will start the BVT by the sanity or smoke test. Only the after the test if the build not with the major defect it is accepted. else the build is rejected

2. Test cases are used in the manual Testing to find the defects where as the Test Scripts are used in the Automation testing to find the defects.

  • The specific test cases/script are identified and executed
  • Analyze the result by checking the difference in Expected Result and Actual Result
  • If Test pass then log the result with the proof of execution and update the Requirement Traceability matrix
  • If Test fails testers will raise a defect report and also update in the test execution log, Test status report

The step by step process of test execution

Case 1: “Pass”

  1. The results are recorded
  2. update the End user document(if required)

Case 2: “Fail”

  1. Record results
  2. Record the defect
  3. when the defect is resolved by the Developers, the Testers will do Re-Testing or Regression Testing
  • Verify and confirm the difference between the ER and AR
  • Analyze failure by changing the following,
    1. Condition
    2. Options and Settings
    3. Software and hardware configuration
    4. data
  • Incident summary is prepared

3. Defect Reporting

  • The defect can be reported in the excel sheet or in the respective defect management tool as per the Test policy which may vary project to project.
  • IEEE standard for the Test Defect Report
      • Defect ID
      • Defect Description
      • Build Version ID
      • Module name
      • Test Case ID
      • Reproducible
      • Severity
      • Priority
      • Test Environment
      • Status
      • Tester Name
      • detected on
      • Reported to
      • Reviewed by
      • Suggested Fix(Optional)

Bug Life Cycle

      • New – When a bug is raised it will be in the new state
      • Assigned – When the bug is assigned to the developer
      • Resolved – When developers fixed or rectified the bug
      • Reopen – When the resolution was deemed incorrect
      • Verified – When the QA verifies the solution works
      • Closed -  When the bug is verified and closed
      • Deferred or Rejected – When a bug is ignored or rejected by the developers when it is duplicate, invalid ro wont fix.

4. Re- Testing is done to confirm that the defect is fixed.

Regression Testing is done to check that the defect is fixed and the fixing does not cause a new defect in the unaffected area. Hence it is tested through automated scripts which may runs multiple times.

5. Test Execution Status

The test execution report contains

  • Total no of Test Cases
  • total no of test executed
  • no of failed
  • no of defect fixed
  • no of defect rejected

Saturday, 4 October 2014

White Box Testing vs Black Box Testing

WHITE BOX TESTING
The name symbolizes the ability to see through the software’s outer shell into its inner workings.
  • It is the testing of a software solutions internal coding and infrastructure.
  • It focuses primarily on strengthening security and the flow of inputs and outputs through the application and improving design and usability
  • It is also known as Unit testing, Clear, Open, Structural and Glass box testing.
  • The input is from the Design.
What do you verify in White Box Testing?
  • Basically verify the security holes in the code.
  • Verify the broken or incomplete paths in the code.
  • Verify the flow of structure mention in the specification document
  • Verify the Expected outputs
  • Verify the all conditional loops in the code to check the complete functionality of the application.
  • Verify the line by line or Section by Section in the code & cover the 100% testing.
The pre designed test cases are executed with the help of input data & compare the output with the expected one & found mismatch if any means you found a bug.
How do you perform WBT?
  1. Understand of the source code
  2. Create test cases and execute
WHITE BOX TESTING TECHNIQUES
CODE COVERAGE ANALYSIS
  • It identifies areas of a program that are not exercised by a set of test cases
  • It helps to identifying the gaps in a test case suite.
  • It allows you to find the area in the code to which is not executed by given set of test cases.
  • Upon identifying the gaps in the test case suite you can add the respective test case.
 
1. Statement Coverage:
Every possible statement is tested in the code to be tested at least once during the testing process.
2. Branch Coverage:
Checks every possible path (If-else and while loops) of a software application.
3. Condition Coverage
In this white box testing technique try to cover 100% Condition coverage of the code, it means while testing the every possible conditions in the code is executed at least once.
4. Decision/Condition Coverage:
In this mixed type of white box testing technique try to cover 100% Decision/Condition coverage of the code, it means while testing the every possible Decisions/Conditions in the code is executed at least once.
5. Multiple Condition Coverage:
In this type of testing we use to cover each entry point of the system to be execute once.
  • In the actual development process developers are make use of the combination of techniques those are suitable for their software application.
  • Using above mentions testing white box testing techniques the 80% to 90% code coverage is completed which might be sufficient with white box testing.
  • It is quite complex but the complexity involved has a lot to do with the application being tested.
Advantages of White Box Testing -
  • To start the testing of the software no need to wait for the GUI, you can start the White Box Testing.
  • As covering all possible paths of code so this is a thorough testing.
  • Tester can ask about implementation of each section, so it might be possible to remove unused lines of code which might be causing introduction of bug.
  • By executing equivalence use to approximates the partitioning.
  • As the tester is aware of internal coding structure, then it is helpful to derive which type of input data is needed to testing software application effectively
  • White box testing allows you to help in the code optimization.



Disadvantages of White Box Testing -
  • To test the software application a highly skilled resource is required to carry out testing who know the deep knowledge of internal structure of the code which increase the cost.
  • Update test script is required if changing the implementation too frequently.
  • If the application under test large is size then exhaustive testing is impossible.
  • It is not possible for testing each and every path/condition of software program, which might miss the defects in code.
  • White box testing very expensive type of testing.
  • To analyze each line by line or path by path is nearly impossible work which may introduce or miss the defects in the code.
  • To test each paths or conditions may require different input conditions, so to test full application tester need to create fill range of inputs which may be a time consuming.
BLACK BOX TESTING
  • The functionality of the software under test is checked without looking at the internal code structure, implementation details or knowledge of internal paths of the software.
  • Entirely based on the software requirements and specification.
  • Focusing on the inputs and outputs without knowing their internal code implementation.
  • It is also called as acceptance testing
  • the input is from the requirement
TYPES OF BBT
Functional Testing
  • Related to functional requirements of a system.
  • Done by the testers.
Non Functional Testing
Not related to a specific functionality, but non-functional requirements such as performance, scalability and usability.
Regression Testing
It is done after code fixes, upgrades or any other system maintenance to check the new code has not affected the existing code.
HOW TO PERFORM BBT?
Generic steps to be followed to carry out any type of BBT
  1. Initially requirements and specification of the system are examined
  2. Tester chooses valid inputs and invalid inputs to verify that AUT or SUT is able to detect them
  3. Tester determines expected outputs for all those inputs
  4. Software tester creates test cases with the selected input
  5. The test cases are executed
  6. Software tester compares the actual output with the expected outputs
  7. Defects if any are fixed and retested
BBT TECHNIQUES
Graph Based Testing Methods:
Each and every application is build up of some objects. All such objects are identified and graph is prepared. From this object graph each object relationship is identified and test cases written accordingly to discover the errors.


Error Guessing:
This is purely based on previous experience and judgment of tester. Error Guessing is the art of guessing where errors can be hidden. For this technique there are no specific tools, writing the test cases that cover all the application paths.


Boundary Value Analysis:
Many systems have tendency to fail on boundary. So testing boundry values of application is important. Boundary Value Analysis (BVA) is a test Functional Testing technique where the extreme boundary values are chosen. Boundary values include maximum, minimum, just inside/outside boundaries, typical values, and error values.

Extends equivalence partitioning
Test both sides of each boundary
Look at output boundaries for test cases too
Test min, min-1, max, max+1, typical values


BVA techniques:
1. Number of variables
For n variables: BVA yields 4n + 1 test cases.
2. Kinds of ranges
Generalizing ranges depends on the nature or type of variables

Advantages of Boundary Value Analysis
1. Robustness Testing – Boundary Value Analysis plus values that go beyond the limits
2. Min – 1, Min, Min +1, Nom, Max -1, Max, Max +1
3. Forces attention to exception handling


Limitations of Boundary Value Analysis
Boundary value testing is efficient only for variables of fixed values i.e boundary.


Equivalence Partitioning:
Equivalence partitioning is a black box testing method that divides the input domain of a program into classes of data from which test cases can be derived.


How is this partitioning performed while testing:
1. If an input condition specifies a range, one valid and one two invalid classes are defined.
2. If an input condition requires a specific value, one valid and two invalid equivalence classes are defined.
3. If an input condition specifies a member of a set, one valid and one invalid equivalence class is defined.
4. If an input condition is Boolean, one valid and one invalid class is defined.


Comparison Testing:
Different independent versions of same software are used to compare to each other for testing in this method.

TOOLS USED FOR BBT?
Largely depends on the type of BBT
For functional or Regression – QTP
Non functional – Load Runner






BBT vs WBT
S.N. Black Box Testing White Box Testing
1 The Internal Workings of an application are not required to be known Tester has full knowledge of the Internal workings of the application
2 Also known as closed box testing, data driven testing and functional testing Also known as clear box testing, structural testing or code based testing
3 Performed by end users and also by testers and developers Normally done by testers and developers
4 Testing is based on external expectations - Internal behavior of the application is unknown Internal workings are fully known and the tester can design test data accordingly
5 This is the least time consuming and exhaustive The most exhaustive and time consuming type of testing
6 Not suited to algorithm testing Suited for algorithm testing
7 This can only be done by trial and error method Data domains and Internal boundaries can be better tested






















































Saturday, 5 July 2014

How to test RWD ?

In the previous blog we have scene how to design it and about the working of RWD.

Here I am going to share, how to test a web site under Responsive design Testing? RWD plays a vital role while testing a website. We need to ensure that the website is fit and comfortable with any devices whether it’s a smart phone or ipad or iphone or tablets etc.

Am going share three types we can check this RWD,

1. If you are using the Google Chrome browser

STEP 1: you can get the app from the Chrome store by searching Resposive web design testing

image

STEP 2: Click on it

image

 

STEP 3: Add it to your chrome

STEP 4: open the website you are going to test

STEP 5: now right click, you could see responsive wed design Tester

STEP 6: now you can choose the options to test your site.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. You can also test a website online

http://mattkersley.com/responsive/

image

You can choose the option width only or device sizes.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3. Manually you are going to test this RWD in various devices like mobile, ipad, tablets etc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You may have a question here this third type is going to a real time testing then why the last type. Since all may not have all these various devices with us immediately when we test so, at that moment the online testing is going to be really useful for the testers.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Responsive Web Design (RWD)

What is RWD?

It is a web design approach aimed at crafting sites to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices (from mobile phones to desktop computer monitors.

Resizing – Alter the size of the image either small or big

Panning – moves the location of the picture where some part is only visible

Scrolling – to move up or down to know the information

Literally, the rwd concept is used to make all the devices compatible and auto adjust according to the resolution of the device.

How it is possible or what is the method to deploy the RWD concept?

A site designed with RWD with adapts the layout using Fluid grid, Flexible images, Media Queries and Server-side.

Fluid Grid – It helps to size the page element using Percentage not by pixels or points

Flexible Images – also sized in relative units, to prevent them from displaying outside their containing element

Media Queries – allow page to use different CSS style based on the characteristics of the device – most commonly the width of the browser

Server-Side – helps to produce faster-loading sites for access over cellular networks and also deliver rich functionality or Usability

How to add it to the CSS?

@media screen and (max-width :590px) {

\\code

img

{

width: 100%

}

}

What happens?

The image will automatically adjust the screen resolution and resizable image. This will automatically happens in all the resolution or devices.

image

The min-width property sets a minimum browser or screen width that a certain set of styles (or separate style sheet) would apply to. If anything is below this limit, the style sheet link or styles will be ignored.

The max-width property does just the opposite. Anything above the maximum browser or screen width specified would not apply to the respective media query.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A very simple example for RWD concept with the CSS- Media Queries as follows,

1. HTML

<html>
<head>
<link type="text/css" rel="stylesheet" media="all" href="style.css">
<body>
<div id="content">
    <img src="filename.jpg" width=500 height=500>
</div>

<div id="sidebar-left">
    <h2>A Left Sidebar</h2>

</div>

<div id="sidebar-right">
    <h2>A Right Sidebar</h2>
</div>
</body>
</html>

2. CSS

@media screen and (max-width:590px){
#content{
    width: 100%;
    }

#sidebar-left{
    width: 70%;
    float: left;
    margin-right: 3%;
    background: blue;
}

#sidebar-right{
    width: 30%;
    float: left;

    background: green;

}
img {
width: 100%;
}
}

 

 

Wednesday, 25 June 2014

Structured Query language


What is SQL?
  • A data manipulation language
  • It is useful in communicating with the data base
  • Mostly it will be in the table format
  • Not a case sensitive
  • ; is a not mandatory
Its is classified into three types, DDL, DML AND DQL.
1. DDL(Data Definition Language)
Create, Drop and Alter
CREATE
Syntax: create table table_name(
integer_variable int  // employee_id int;
String Varchar(n) // Employee_name varchar(30);
);
How to see the table after creating?
select * form table_name
DROP
Syntax: Drop table table_name
ALTER
alter table table_name add Employee_city varchar(30);
alter table table_name drop column Emp_city
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2. DML(Data Manipulation Language)
Insert, Delete and Update
INSERT
Syntax: insert into table_name values(5,’Aneesh’,22000); // String should be always should be within the single quotes
(or)
insert into table_name (ename,esal) values (Panda,9000)
(or)
insert into table_name values(null,’hell boy’,25000)
UPDATE
Syntax: update table_name set eid=96 where ename=Aneesh
DELETE
Syntax: delete from table_name where eid=25
delete from table_name // it will delete all the contents in the table
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3. DQL(Data Query Language)
Relational Operators (<,>,<=,>=,=,<>) \\ <> not equal to
example: select * form table_name where Esal>25000
Logical Operators
A    B              AND     OR 
0    0               0           0     
0    1               0           1
1    0               0           1
1    1               1           1
A   NOT
0     1
1     0
Syntax:
select * form table_name where Eid=5 AND Ename=Panda
Note: If both are correct value it will display else nothing.
select * form table_name where Eid=5 OR Ename=Panda
Note: both the different rows are executed.

BETWEEN AND
Syntax: select * from table_name where Esal between 20000 and 60000
IN
Syntax: select * from table_name where Ejob in (‘System Admin’,’Test Lead’)
select * from table_name where Esal in (10000,20000,30000)
NOT
Syntax: select * form table_name where Esal not in (5000)
select * from table_name where Ename not like (‘%a’) // it will not show the name ends with a
Like – %a – string ends with a and a% – string starts with a
IS NULL
select * form table_name where Eid is null // if we left blank or when we specify null those can be identified
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONSTRAINTS
UNIQUE KEY – Where we don’t need the repeat in the values example Employee id should not repeat where we can use this unique key
int EID unique
NOT NULL – Where do not need the value to be null. We can use in the name field
Employee_name varchar(30) not null
DEFAULT – When we assign default value, when we left blank or null it will auto assign
Ecity varchar(30) default ‘chennai’ // note if we specifly assign NULL it will not take the default value.
CHECK - Ensures that the value in a column meets a specific condition
eid int unique, check (eid>100)
PRIMARY KEY – Combination of unique and not null key but can be used only once for a column in a table
Eid int primary key
FOREIGN KEY - Ensure the referential integrity of the data in one table to match values in another table
eid int foreign key refrerences emp1(eid)
Note: Eid values of both the tables should be same
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JOINS

SQL join is a technique to join two or more tables on a specific condition(where clause) and retrieve desired result.
The different types are:
  • INNER JOIN: Returns all rows when there is at least one match in BOTH tables
  • LEFT JOIN: Return all rows from the left table, and the matched rows from the right table
  • RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table
  • FULL JOIN: Return all rows when there is a match in ONE of the tables
  • SELF JOIN: A table can be joined to same table. Mostly used when a table has parent-child relationship in the same table
INNER JOIN
Select column_name(s) from table_name1 INNER JOIN table_name2
on table_name1.column_name = table_name2.column_name
LEFT JOIN
Select column_name(s) from table_name1 LEFT JOIN table_name2
on table_name1.column_name = table_name2.column_name
RIGHT JOIN
Select column_name(s) from table_name1 RIGHT JOIN table_name2
on table_name1.column_name = table_name2.column_name
FULL JOIN
Select column_name(s) from table_name1 FULL JOIN table_name2
on table_name1.column_name = table_name2.column_name
ORDER BY
If needed we can also sort the columns,
Select column_name(s) from table_name1 FULL JOIN table_name2
on table_name1.column_name = table_name2.column_name
ORDER BY Column_name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IN BUILT FUNCTIONS
1. AVG() – to find the average of a column
select avg(Column_name) from Table_name
2. Count() – to count the number of column count
3. Sum() – to sum of all the values in the column
4. Max() and Min() – to find the maximum and minimum values in the column
5.Group by - is used in collaboration with the SELECT statement to arrange identical data into groups.
6. Having - enables you to specify conditions that filter which group results appear in the final results.
The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause.
Select Employee_job, sum(Emp_salary) from Table_name GROUP BY Employee_job having sum(Employee_salary)>200000
7. UPPER() – to display in Upper case
8. LOWER() – to display in lower case
9. Get Date() – Returns the current system date and time
10. Len() – Returns the length of the text field
11. Round() – rounds the value
select round (column_name, decimal) from table_name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TRANSACTION CONTROL LANGUAGE (TCL)
COMMIT, ROLL BACK & SAVE
Commit - What ever we type on the sql server it automatically commits that is saves the statements or lines but not permanently
ROLL BACK
We need to begin the transaction as
BEGIN TRANSACTION TRANSACTION_NAME
insert some values or do any operations
when we say
ROLLBACK TRANSACTION TRANSACTION_NAME
what ever the operation after the begin transaction is deleted.
SAVE
Begin the transaction
insert some values or do any operations
now, save the transaction
SAVE TRANSACTION TRANSACTION_NAME
Once Saved the transaction cannot be rolledback.
 
 
 












































Tuesday, 10 June 2014

Getting Started with SELENIUM IDE

·         Selenium is one of the most well known testing frameworks in the world that is in use which is introduced by Jason Huggins in 2004.
·         It is an open source project that allows testers and developers alike to develop functional tests to drive the browser.
·         It can be used to record the workflows and used to prevent the future regressions of code.
·         It supports Java Scripts and has been built with the same

The components of Selenium are :
1.      IDE
2.      RC
3.      Web Driver &
4.      Grid


SELENIUM IDE

The selenium IDE is a Firefox Add-on developed by Shinya Kasatani. It has been developed using Java Scripts so that it can interact with DOM (Document Object Model) using native JavaScript calls.
You can install the Firefox first and also install the selenium IDE from the link,
www.seleniumhq.org  à Downloadà Download latest released version 2.5.0


Install fire pathàhttps://addons.mozilla.org/en-US/firefox/addon/firepath/

Open you Firefox browser where toolsà Selenium IDE



The items in the IDE,
Base URL: All open command will be relative to the base URL (full path). This is the URL that the test will start at.

Speed Slider: This slider is used to fast or slow mode during the play back.

(Triangle with 3 lines): Run all the tests in the id

(Triangle with 1 line): Run only single test

(||): Pause a test that is currently running

(bended down arrow): Step through the test once it has paused

Red button- This is the Record button. By default when we open the selenium IDE it will be enabled.

Command -     It is a select box has a list of all the commands that are needed to create the test. It is an auto complete functionality or use the drop down.

Target - the location of the element

Value - where you place the value that needs to be change.

Table view – Will keep track all the commands, targets and values.

Source View – You will be able to see the HTML that will store the test.

Log – will show what is happening during the test run.

Reference – Documentation on the command highlighted.

For all examples we are going to test the following link: http://theautomatedtester.co.uk/ 

Record your first Test with the Selenium IDE

         1.      First need to start the Mozilla Firefox and need to start the Selenium IDE. It will be automatically in the  record mode.
         2.      Now in browser navigate to http://theautomatedtester.co.uk/chapter1
         3.      Do some action on the web application like click on the links radio buttons etc
         4.      Once the actions are done come back to IDE and stop recording.
         5.      Your test has been recorded
         6.      Now you can play the test and see the result.
         7.      If any failures it will display the number of failures and errors can be viewed in the log

VERIFY AND ASSERT

Verify – is going to verify the element present on the page. If not it will throw the error and carry on executing.

Assert- Is very similar to verify but the difference is, this allows the test to check if the element is on the page. If not the test will stop on the step that failed.

How to use Verify or Assert?

          1.      Open Selenium IDE and start recording
          2.      Right on the text which you would like to verify
          3.      Show all available commands and select verify text
          4.      Do few more action and stop recording
          5.      Now run the test

When it verifies that particular step will be highlighted in dark green color. If it does not match or verify it will throw error and carry on executing remaining commands.

Same procedures for Assert:

Right click on the text you need to verify and select assert text.

Here if it matches or verifies same procedure like verify, but when it does not verifies it will fail and stop executing the remaining steps.

How we have verified the text, in the same procedure we can verify the element present like buttons, checkbox, text area etc in the chapter 1. You can try yourself. The result will be like the following,





 How to Comment?

1.      Click on any step that you want to comment.
2.      Right click and click on Insert New Comment
3.      A new line will appear
4.      Type your comments in the command.
5.      You can see a pink color line ie. Comment

How to use multiple windows?

In this section we will have a look at creating a test that can move between windows.

1.      Open the IDE
3.      Click on Chapter 1
4.      Click on the element “Click this to launch another window”
5.      A small window will appear where you can even verify the text.

How to store an information from the page in the test?

1.      Open the IDE and launch the site : chapter 1
2.      Right click on any text that you need to store in the text box available in the page
3.      Select store Text
4.      A dialog box will appear and ask you to enter the name of the variable
5.      Enter a variable name eg: abc
6.      Now stop recording
7.      Click on the next blank step where the steps are recording
8.      Type: Type in the command
9.      Type: storeinput in the target
10.  Type: ${abc} in the value
11.  Now run the test
12.  You can view the selected text in the text box.

Note: in the target I asked you to type storeinput which is nothing but the id of the text box.

How to find the ID?
In the Mozilla Firefox you should have installed the firebug and fire path. Go to the chapter 1 page press F12. Where using the Locator you can get the id or name or link or css or class which are nothing but the xpath.

What is X path?
The x path is nothing but the Location of the element. Each element in the page has its unique id. Example: Like our address. The address of the element is called as the ID.

For detailed ppt for Selenium IDE, kindly visit:
http://www.slideshare.net/Aneshare/selenium-over