Selenium Interview Question 3

9 : Selenium WebDriver Is Paid Or Open Source Tool? Why you prefer to use It? 
Answer : All versions of selenium software testing tool are open source. You can use any version of selenium In free of charge.

I choose to use It because
  • Open Source.
  • It has multi-browser support.
  • Multi-OS support.
  • Multi types of locators support. So If one not works, We can use another type.
  • Web as well mobile application testing support.
  • Many testers are using selenium WebDriver to automate their testing process. So getting solution of any complex Issue very easily on Internet.
  • It Is extendable and flexible.
  • Continues support from WebDriver's development team to Improve the API and resolve current Issues.
10 : Which OpenSource Framework Is Supported In WebDriver With Java?
Answer : Bellow given 2 java frameworks are supported by selenium WebDriver.

  • JUnit
  • TestNG
·        
11 :
 Can you tell me the syntax to open/launch Firefox browser In WebDriver software testing tool?
·         Answer : We can open new Mozilla Firefox browser Instance using bellow given syntax In WebDriver software testing tool.


·         WebDriver driver = new FirefoxDriver();



12 : What Is XPath and what Is use of It In WebDriver?
·         Answer : In Selenium WebDriver software testing tool, XPath is used to locate the elements. Using XPath, We can navigate through elements and attributes In an XML document to locate software webpage elements like buttons, text box, links, Images etc..
·         13 : Which tool you are using to find the XPath of any element?
·         Answer : I am using Mozilla Firefox AddOns FireBug and FirePath to find the XPath of software web elements. 
·         14 : What is the difference between absolute XPath and relative XPath?
·         Answer :

Absolute XPath : Absolute XPath Is the full path starting from root node and ends with desired descendant element's node. It will start using single forward slash(/) as bellow.
·         Example Of Absolute XPath 

·         /html/body/div[3]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div/div[1]/div/div/div/div[1]/div[2]/form/table/tbody/tr[1]/td/input
·          

·          
·         Relative XPath : Instead of starting from root node, Relative XPath starts from any In between node or current element's node(last node of element). It will start using double forward slash(//) as bellow.
Example Of Relative XPath 

·         //input[@id='Resultbox']

·        


Selenium Interview question 2

5 : Which Different Element Locators Supported By Selenium WebDriver?
Answer : Selenium WebDriver supports bellow given element locators.

  • XPath Locator -
  • CSSSelector Locator 
  • ClassName Locator
  • Name Locator 
  • LinkText Locator 
  • PartialLinkText Locator 
  • TagName Locator 
6 : What are the benefits of automation testing.
Answer : We can get bellow given benefits If automate our software testing process.
  • Fast Test Execution : Manual software testing process Is time consuming. Automation tests are faster and takes less time to execute tests compared to manual test execution.
  • Re-usability Of Test Cases : You need to prepare automation test cases only one time. Then you can use same test cases for all upcoming version release of software application. However you need to modify your test cases If there Is any flow change of business logic changes In software. But It Is less time consuming.
  • Testing Cost Reduction : You have to put human efforts only one time to automate your software test process. Latter on automation tool will work for you at place of human resource.
  • Better Test Coverage In Each Version Release: You have to Implement test scenarios only once In your automation test cases. Latter on you can execute same test cases In all upcoming release. So each scenarios will be tested In every version release.
  • Easy For Compatibility Testing : It Is easy to run same tests In combination of different OS and browser environments using automation tools.
7 : Does Selenium WebDriver Support Record And Playback Facility?
Answer : No. WebDriver do not have any record and playback facility. But you can record your tests In one of the selenium version called Selenium IDE and then you can export your recorded tests In webdriver compatible format as per your preferred language.




8 : Which Operating systems support Selenium WebDriver?
Answer : At present, Mainly bellow given operating systems support Selenium WebDriver.


  • Windows - Windows XP, Windows 7, Windows 8 and Windows 8.1
  • Apple OS X
  • Linux - Ubuntu. Other versions of linux should support too.

Selenium Interview Question 1

1 : What Is Selenium WebDriver/Selenium 2?
Answer :
  • Selenium WebDriver software testing tool Is well designed object oriented API which Is developed to automate web and mobile applications testing process. WebDriver API Is bigger than Selenium RC but It's Architecture Is simple and easy to understand compared Selenium RC API. 
  • We can automate our web application's software testing process using selenium webdriver.
  • We can say it is advanced version of selenium RC software testing tool because some limitations of selenium RC has been overcome In selenium WebDriver software testing tool. 
  • WebDriver Is designed to provide better support for dynamic changing pages. Example : Web page elements of software web application is changing without reloading the page. In this case WebDriver works better.
  • Selenium Webdriver software testing tool Is more faster that Selenium RC software testing tool as It Is directly Interacting with web browsers and mimic the behavior of a real user. Example : User clicks on button of web page or moving mouse on main menu to get the sub menu list. WebDriver works Same.
  • All popular browser vendors are active participants In selenium WebDriver's development and all of them have their own engineers team to Improve this framework. 
You can Include answers of Question 2, Question 3, Question 4 and Question 5 In answer of this question If Interviewer need more detail on selenium webdriver.

2 : Tell Me WebDriver Supported Browsers?
Answer : Selenium WebDriver API has a many different drivers to test your web application In different browsers. List of Webdriver browser drivers are as bellow.
  • Firefox Driver - For Mozilla Firefox browser
  • Internet Explorer Driver - For Internet Explorer browser
  • Chrome Driver - For Google Chrome browser
  • HtmlUnit Driver - GUI-Less(Headless) browser for Java programs
  • Opera Driver - For Opera browser
3 : Tell Me WebDriver Supported Mobile Testing Drivers?
Answer : We can get support of mobile software application testing using Selenium webdriver. Selenium WebDriver supports bellow given drivers to test mobile application.
  • AndroidDriver
  • OperaMobileDriver
  • IPhoneDriver
4 : Which Programming Languages Supported By Selenium WebDriver To Write Test Cases?
Answer : Selenium WebDriver Is very wast API and It support many different languages to write test cases for your software web application. List of WebDriver supported languages are as bellow.

  • Java 
  • C#
  • Python
  • Ruby
  • Perl
  • PHP

Database Testing

                Database Testing 

Computer applications are more complex these days with technologies like android and also with lots of smart phone apps. The more complex the front ends, the back ends are even more intricate.  So, it is all the more important to learn about DB testing and be able to validate the databases effectively to ensure secure and quality databases.
In this article you will learn all about Database Testing. Why to test- How to test- What to test : These are some of the aspects we will cover.

Why do we test a database?

Below, we will briefly see why the following aspects of a DB should be validated:
1) Data Mapping: In the software systems, data often travels back and forth from the UI (user interface) to the backend DB and vice versa. So following are the aspects to look for:
  • To check whether the fields in the UI/Front end forms and mapped consistently with the corresponding DB table (and also the fields within).  Typically this mapping information is defined in the requirements documents.
  • Whenever a certain action is performed in the front end of an application, a corresponding CRUD (Create, Retrieve, Update and delete) action gets invoked at the back end. A tester will have to check if the right action is invoked and the invoked action in itself is successful or not.
2) ACID properties validation:  atomicity, consistency, isolation and durability. Every transaction a DB performs has to adhere to these four properties. (image credit)

  • Atomicity means that a transaction either fails or passes. This means that even if a single part of transaction fails- it means that the entire transaction has failed. Usually this is called the “all-or nothing” rule.
  • Consistency: A transaction will always result in a valid state of the DB
  • Isolation: If there are multiple transactions and they are executed all at once, the result/state of the DB should be the same as if they were executed one after the other.
  • Durability: Once a transaction is done and committed, no external factors like power loss or crash should be able to change it
3) Data integrity:
This means that following any of the CRUD operations, the updated and most recent values/Status of shared data should appear on all the forms and screens. A value should not be updated on one screen and display an older value on another one. So devise your DB test cases in a way to include checking the data in all the places it appears to see if it is consistently the same.

4) Business rule conformity:  More complex databases means more complicated components like relational constraints, triggers, stored procedures, etc. So testers will have to come up with appropriate SQL queries in order to validate these complex objects.

How to test – Database Testing Process

The general test process for DB testing is not very different from any other application. The following are the steps:
Step #1) Prepare the environment
Step #2) Run a test
Step #3) Check test result
Step #4) Validate according to the expected results
Step #5) Report the findings to the respective stakeholders
Database Testing Process
Usually SQL queries are used to develop the tests. The most commonly used command is the “Select”.
Select * from <tablename> where <condition>
Apart from select, SQL has 3 important types of commands:
  1. DDL : Data definition language
  2. DML: Data manipulation language
  3. DCL: data control language
Let us see the syntax for the most commonly used statements.
Data Definition languageUses CREATE, ALTER, RENAME, DROP and TRUNCATE to handle tables (and indexes).
  • Create table: Create table<tablename> (field1 datatype(field size) ,……………..fieldn datatype(field size))
  • Delete entire table: Drop table <tablename>. – this command cannot be rolled back
Data Manipulation languageIncludes statements to add, update and delete records.
  • To insert a row into a DB: INSERT INTO <table name> (field1, field2, field3)  VALUES  (‘val1’, ‘val2’…’valn’);
  • Delete specific row/rows from a table: DELETE FROM TABLENAME WHERE <required condition>.
  • Update rows: UPDATE <tablename> SET field1 = ‘updated value’ WHERE field2 = ‘N’;
Data control language: Deals with giving the authorization to users for manipulation and access to the data. Grant and Revoke are the two statements used.
Grant syntax:
Grant select/update
On <table name>
To <user id1, user id2…useridn>;
Revoke syntax:
Revokeselect/update
on <table name>
from<user id1, user id2…useridn>;

What to test – different components

1) Transactions:
When testing transactions it is important to make sure that they satisfy the ACID properties.
The following are the statements commonly used:
  • BEGIN TRANSACTION TRANSACTION#
  • END TRANSACTION TRANSACTION#
Rollback statement ensures that the database lies in a consistent state.
  • ROLLBACK TRANSACTION#
After these statements are executed, use a select to make sure if the changes have been reflected.
  • SELECT * FROM TABLENAME <tables which involve the transactions>
2) Database schema:
Database schema is nothing but a formal definition of the how the data is going to be organized into a DB. To test it:
Identify the requirements based on which the database operates. Sample requirements:
  • Primary keys to be created before any other fields are created.
    • Foreign keys should be completely indexed for easy retrieval and searching.
    • Field names starting or ending with certain characters.
    • Fields with a constraint that certain values can or cannot be inserted.
  • Use one of the following ways according to the relevance:
    • SQL Query DESC<table name> to validate the schema.
    • Regular expressions for validating the names of the individual fields and their values
    • Tools like SchemaCrawler
3) Trigger:
When a certain event takes places on a certain table, a piece of code (a trigger) can be auto-instructed to be executed.
For example, a new student joined a school. The student is taking 2 classes; math and science. The student is added to the “student table”.  A trigger could be adding the student to the corresponding subject tables once he is added to the student table.
The common method to test is to execute SQL query embedded in the trigger independently first and record the result. Follow this up with executing the trigger as a whole. Compare the results.
These are tested during both the black box and white box testing phases.
  • White box testing:  Stubs and drivers are to insert or update or delete data that would result in the trigger being invoked. The basic idea is to just test the DB alone even before the integration with the front end (UI) is made.
  • Black box testing:
a) Since the UI and DB integration is now available; we can insert/delete/update data from the front end in a way that the trigger gets invoked. Following that select statements can be used to retrieve the DB data to see if the trigger was successful in performing the intended operation.
b) Second way to test this is to directly load the data that would invoke the trigger and see if it works as intended.
4) Stored Procedures:
Stored procedures are more or less similar to user defined functions. These can be invoked by a call procedure/execute procedure statements and the output is usually in the form of result sets.
These are stored in the RDBMS and are available for applications.
These are also tested during:
  • White box testing: Stubs are used to invoke the stored procedures and then the results are validated against the expected values.
  • Black box testing: Perform an operation from the frontend(UI) of the application and check for the execution of the stored procedure and its results.
5. Field constraints – Default value, unique value and foreign key:
  • Perform a front end operation which overruns the database object condition
  • Validate the results with a SQL Query.
Checking the default value for a certain field is quite simple. It is a part of business rule validation. You can do it manually or you can use tools like QTP to do so. Manually, you can perform an action that will add a value other than the default value into the field from the front end and see if it results in an error.

For the foreign key constraint validation use data loads that directly input data that violates the constraint and see if the application restricts the same or not. Along with the back end data load, perform the front end UI operations too in a way that are going to violate the constraints and see if the relevant error is displayed.

What is Security Testing?

What is Security Testing?
Security Testing is a type of software testing that intends to uncover vulnerabilities of the system and determine that its data and resources are protected from possible intruders.
FOCUS AREAS
There are four main focus areas to be considered in security testing (Especially for web sites/applications):
  • Network security: This involves looking for vulnerabilities in the network infrastructure (resources and policies).
  • System software security: This involves assessing weaknesses in the various software (operating system, database system, and other software) the application depends on.
  • Client-side application security: This deals with ensuring that the client (browser or any such tool) cannot be manipulated.
  • Server-side application security: This involves making sure that the server code and its technologies are robust enough to fend off any intrusion.
EXAMPLE OF A BASIC SECURITY TEST
This is an example of a very basic security test which anyone can perform on a web site/application:
  • Log into the web application.
  • Log out of the web application.
  • Click the BACK button of the browser (Check if you are asked to log in again or if you are provided the logged-in application.)
Most types of security testing involve complex steps and out-of-the-box thinking but, sometimes, it is simple tests like the one above that help expose the most severe security risks.
OWASP
The Open Web Application Security Project (OWASP) is a great resource for software security professionals. Be sure to check out the Testing Guide:https://www.owasp.org/index.php/Category:OWASP_Testing_Project
OWASP Top 10 security threats for 2013 are:
  • Injection
  • Broken Authentication and Session Management
  • Cross-Site Scripting (XSS)
  • Insecure Direct Object References
  • Security Misconfiguration
  • Sensitive Data Exposure
  • Missing Function Level Access Control
  • Cross-Site Request Forgery (CSRF)
  • Using Known Vulnerable Components
  • Unvalidated Redirects and Forwards
BUILDING TRUST
There is an infinite number of ways to break an application. And, security testing, by itself, is not the only (or the best) measure of how secure an application is. But, it is highly recommended that security testing is included as part of the standard software development process. After all, the world is teeming with hackers/pranksters and everyone wishes to be able to trust the system/software one produces or uses.

Handling Dynamic Elements in Selenium WebDriver

                       Handling Dynamic Elements in Selenium WebDriver Dynamic elements are those elements which have identifiers that a...