Saturday, April 14, 2018

Selenium with Robot Framework Tool

Selenium with Robot Framework Tool:

Yes, you are reading right selenium can be integrated with the existing framework which is "Robot Framework". Its developed in python language and it can compatible with jython as well i.e. we can test Java developed applications as well and of course python developed application too.

Basically, Robot Framework works with Build-in(Internal) library and External library. On top of these library automation engineer develops code to test application in automation.

Here Selenium library is called as Selenium2Library :

Java - https://github.com/MarkusBernhardt/robotframework-selenium2library-java#readme

Python - https://github.com/robotframework/Selenium2Library

 this external library needs to be added as a plug-in in robot framework. Then we can access their APIs in the actual our testing framework.

Personally I feel with python it is very easy to consume existing API's when we extend the automation framework.

Use of Label & While Loop with Selenium IDE

To use the Labels & While Loop functionality with Selenium IDE we need to configure the following code as .js file.

Below are the Steps :-

1) Open Selenium IDE as Mozilla Firefox Add on.
2) Copy & Paste below given code, save file with extension as .js
3) Go to options , Browse the saved .js file from selenium core extensions field.
Like this :- C:\Documents and Settings\goto_sel_ide.js
4) Now you have to reopen Selenium IDE to use of Labels & while loop
5) You can add code as :-

Selenium Pattern view :-

echo Login done
gotolabel test
echo Gaurav is doing practice
label test
store 20 a

store 25 b

while storedVars['a'] <= storedVars['b']
getEval storedVars['a'] = ${a}+1;
endWhile
getEval alert("Finished");
echo $a

Java language View :-

// selenium.gotolabel("test");
System.out.println("Gaurav is doing practice");
// selenium.label("test");
String a = "20";
String b = "25";
// selenium.while("storedVars['a'] <= storedVars['b']");
// selenium.endWhile();
System.out.println("$a");


------------------------------------------------------------------------------------------------
Code of .js file
------------------------------------------------------------------------------------------------
var gotoLabels= {};
var whileLabels = {};

// overload the original Selenium reset function
Selenium.prototype.reset = function() {
// reset the labels
this.initialiseLabels();
// proceed with original reset code
this.defaultTimeout = Selenium.DEFAULT_TIMEOUT;
this.browserbot.selectWindow("null");
this.browserbot.resetPopups();
}

Selenium.prototype.initialiseLabels = function()
{
gotoLabels = {};
whileLabels = { ends: {}, whiles: {} };
var command_rows = [];
var numCommands = testCase.commands.length;
for (var i = 0; i <>
var x = testCase.commands[i];
command_rows.push(x);
}
var cycles = [];
for( var i = 0; i <>
if (command_rows[i].type == 'command')
switch( command_rows[i].command.toLowerCase() ) {
case "label":
gotoLabels[ command_rows[i].target ] = i;
break;
case "while":
case "endwhile":
cycles.push( [command_rows[i].command.toLowerCase(), i] )
break;
}
}
var i = 0;
while( cycles.length ) {
if( i >= cycles.length ) {
throw new Error( "non-matching while/endWhile found" );
}
switch( cycles[i][0] ) {
case "while":
if( ( i+1 <>
// pair found
whileLabels.ends[ cycles[i+1][1] ] = cycles[i][1];
whileLabels.whiles[ cycles[i][1] ] = cycles[i+1][1];
cycles.splice( i, 2 );
i = 0;
} else ++i;
break;
case "endwhile":
++i;
break;
}
}
}

Selenium.prototype.continueFromRow = function( row_num )
{
if(row_num == undefined || row_num == null || row_num <>
throw new Error( "Invalid row_num specified." );
}
testCase.debugContext.debugIndex = row_num;
}

// do nothing. simple label
Selenium.prototype.doLabel = function(){};

Selenium.prototype.doGotolabel = function( label )
{
if( undefined == gotoLabels[label] ) {
throw new Error( "Specified label '" + label + "' is not found." );
}
this.continueFromRow( gotoLabels[ label ] );
};

Selenium.prototype.doGoto = Selenium.prototype.doGotolabel;

Selenium.prototype.doGotoIf = function( condition, label )
{
if( eval(condition) ) this.doGotolabel( label );
}

Selenium.prototype.doWhile = function( condition )
{
if( !eval(condition) ) {
var last_row = testCase.debugContext.debugIndex;
var end_while_row = whileLabels.whiles[ last_row ];
if( undefined == end_while_row ) throw new Error( "Corresponding 'endWhile' is not found." );
this.continueFromRow( end_while_row );
}
}

Selenium.prototype.doEndWhile = function()
{
var last_row = testCase.debugContext.debugIndex;
var while_row = whileLabels.ends[ last_row ] - 1;
if( undefined == while_row ) throw new Error( "Corresponding 'While' is not found." );
this.continueFromRow( while_row );
}

Thursday, April 12, 2018

Why to go Robot Framework Tool for automation testing ...

Automation Testing with Robot Framework Tool:


  • Easy to learn, coding, scripts development style
  • Designed Fundamentals strong on Python lang
  • Fundamental of framework gets created so easy to design automation framework
  • Best reports of test suits
  • Helpful to customize the Automation Framework per project demand, COE designing for multiple projects in an organization
  • Quickly wrap- up the basic required functions
  • Ready Lib available and easily can extend as per project requirement
  • Comfortable with build-in and external lib support and gives scope to do innovation in framework
  • Support with Jenkins and Hudson for CI tool

Friday, August 7, 2009

Key Points to Test Web Application or Website

While doing Web Testing for websites or web applications following scenarios should be considered :-

* Functionality
* Performance
* Usability
* Server side interface
* Client side compatibility
* Security


Functionality: In testing the functionality of the web sites/application the following should be tested.

* Links

+ Internal links
+ External links
+ Mail links
+ Broken links

* Forms

+ Field validation
+ Functional chart
+ Error message for wrong input
+ Optional and mandatory fields

* Database

+ Testing will be done on the database integrity.

* Cookies

+ Testing will be done on the client system side, on the temporary internet files.

Performance:

Performance testing can be applied to understand the web sites/application scalability, or to benchmark the performance in the environment of third party products such as servers and middleware for potential purchase.

* Connection speed:

o Tested over various Networks like Dial up, ISDN etc

* Load

o What is the no. of users per time?
o Check for peak loads & how system behaves.
o Large amount of data accessed by user.

* Stress

o Continuous load with complex functionalities
o Performance of memory(Max/min), cpu, file handling etc.

Usability :

Usability testing is the process by which the human-computer interaction, characteristics of a system are measured, and weaknesses are identified for correction in application.
Usability can be defined as the degree to which a given piece of software assists the person sitting at the keyboard to accomplish a task, as opposed to becoming an additional impediment to such accomplishment. The broad goal of usable systems is often assessed using several criteria:

* Ease of learning
* Navigation
* Subjective user satisfaction
* General appearance

Server side interface:

In web testing the server side interface should be tested.

- Verify that communication is done properly.
- Compatibility of server with software, hardware, network and database should be tested.
- The client side compatibility is also tested in various platforms, using various browsers etc.

Security:

The primary reason for testing the security of an web is to identify potential vulnerabilities and subsequently repair them.

The following types of testing are described in this section:

* Network Scanning
* Vulnerability Scanning
* Password Cracking
* Log Review
* Integrity Checkers
* Virus Detection

I think by doing above specific type of testing on web application we can possible to find the respective defects & simultaneously will get the Quality for product.

Thanks,
Gaurav

Monday, July 13, 2009

Automation with Selenium CORE

Selenium Core configuration with Web Application :-

Pre-requisite:-

You should have configured your application server(Tomcat, Weblogic, Jboss) to run web application. It means your web application build should be configured with Web Application server, put the application build in Tomcat -Webapps folder .

Configure Selenium Core:

Following steps are required to configure Selenium core on your server machine:-

1. Download Selenium Core from selenium-core-1.0-beta-2.zip from http://seleniumhq.org/download .

& Extract the downloaded Zip folder.

2. Now create a folder named “Selenium”(can be change name as ur flexibility) in the directory - webapps directory of tomcat installation.

3. Extract the content of the – CORE folder which is from downloaded zip file into Selenium folder.

4. Start Tomcat Server

5. Locate url http://:8080/Selenium/core/TestRunner.html in your browser. The host IP address will be replaced by the IP Address of the server you are using.

6. This will open selenium Test Runner page.

So this way you can access the files those are relate with through the TestRunner.html file.

Integrate Test Suites:

Following steps are required to integrate the test suite:-

1. Create a folder for your test suite e.g. TestSuite1 folder in Selenium\tests\ directory.

2. Copy all test cases in TestSuite1 folder

3. Create Folder "ProjName" which is present under the \Selenium\tests directory. (If not present then create folder as project name)

4. Put all test suite files in ProjName folder

5. Ensure proper relative path for all test cases in your test suit file.

6. Open TestPrompt.html file present which is in \Selenium\core directory.

7. Add entry for the new test suite file in the test suites list see in ProjName folder

8. See all test suites in the dropdown list format by using the Test Runner.html page on browser.


Few Important Notes :-

1)Ensure proper naming convention for files - test suites and test cases files should be with .html extension and should not have empty space in the name

2) ProjName folder will contain all the test suites html files. Test cases related to this test suites will be put in a different folder (as mentioed above step 1)

3) Remove server name for the open command in all the selenium test cases. This is not required as Selenium core take local server as default server of execution. E.g. use “/MedspacePortal/” instead of “http://phi001web:8080/MedspacePortal/

4) You can modify TestPrompt.html as per your requirements.

--Thanks,

- Gaurav

Thursday, June 11, 2009

While Applying Automation Testing

Why do we need Software Automation testing ---

1) What are the main attributes of test automation?

Maintainability - the effort needed to update the test automation suites for each new release
Reliability - the accuracy and repeatability of the test automation
Flexibility - the ease of working with all the different kinds of automation test ware Efficiency - the total cost related to the effort needed for the automation
Portability - the ability of the automated test to run on different environments
Robustness - the effectiveness of automation on an unstable or rapidly changing system
Usability - the extent to which automation can be used by different types of users

2) What are main benefits of test automation?

1. Increases the speed of testing process

2. Facilitates creation of tests that check all aspects of application or website

3. Provides reusable tests that can be run each time the site or application changes


3) What are the common problems with automation process?

1. Maintenance of old script when there is a feature change or enhancement

2. The use of script when we migrate the application from old version to new version

3. The change in application technology can affect on created old scripts

4) Which testing activities we need to automate? How can we identify?

The test cases those are need to execute repeatedly to obtain time saving with the accuracy of test case expected result. All high priority test cases which would be execute as a part of regression testing.


Fundamental of Manual Testing

Walkthrough with Manual Testing concepts :-

1) How will you describe testing activities?
Test Planning; write Test cases/Script, Execution of Test case/Scripts, defect reporting & tracking, regression testing, Sign off.

2) What is test case and test script?
Test case: - A test case is unique identifier, requirement references from a design specification, preconditions, events, a series of steps (also known as actions) to follow, input, output, expected result, and actual result. We can define a test case is an input to do set of actions and an expect the  result for each performed action which is here as step.
Test Script:
- The test script is the combination of a test case, test procedure, and test data. Initially the term was relating with automated regression test tools. Today, test scripts can be manual, automated or a combination of both. Nowadays, many professionals are using this term for automation test case.



3) What is functionality testing?

Functionality testing employed to verify your product meets the intended specifications and functional requirements placed out into your development documentation.


4) What is regression testing?
Testing conducted for the purpose of evaluating whether or not a change to the system has introduced a new failure. Regression testing is often accomplished through the construction, execution and analysis of product and system tests. Usually it is later part in the software development life cycle.

5) What is Retesting?

Its type of testing in which an already tested functionality is once again tested on new build by using different input data, to make sure that the defect is the reproducible (if any defects) and to rule out environment issue. Testing the same application once again by prepared test cases or executes all test cases as a another cycle.

6) What is Agile testing?
Agile testing involves testing from the customer perspective as early as possible, or we can say at the end of agile SPRINT,  Sprint demo and often as code becomes available and stable enough from module/unit level testing.


7) What Smoke & sanity testing? What is difference?

Sanity Testing: - This has to perform before testing start. Verify whether application is stable or not, we want to write test cases for product whether development team released build is able to conduct complete testing or not.
Smoke Testing: - Testing the application whether it's performing its basic functionality properly or not, so that the test team can go ahead with the application.

8) What is the difference between Bug and Defect?
Bug: Deviation from the expected result.
Defect: Problem in algorithm leads to failure.
Error: A Mistake in code is called Error.Due to Error in coding, test engineers are getting mismatches in application is called defect.

9) What is Compatibility testing?
It’s used to determine if your software application has issues related to how it functions in concerts with operating system and different types of system Software and Hardware applications.

10) What is the verification & validation?
Verification: - Typically involves reviews and meetings to evaluate (estimate, calculate) documents, plans, code requirements and specifications. This can be done with check lists, issue lists, walk through & inspections meetings. Verification is static. No code is executed. Say, analysis of requirements etc.
Validation: Typically involves actual testing and takes place after verification are completed. Validation is dynamic. Code is executed with scenarios present in test cases.



Defect Life Cycle:-

11) How to decide the severity of the defect?
Severity Level Description Response time / Turn around time 
High - A defect occurred due to the inability of a key function to perform. This problem causes the system to hang or the user dropped out of the system.  
Medium - A defect occurred with severely restriction the system such as the inability to use a major function of the system. There is no acceptable work around but the problem does not inhibit the testing of other function.
Low - A defect is occurred which places minor restriction a function that is not critical. There is an acceptable work-around for the defect.

1) What is difference between the Severity & Priority?

DEFECT SEVERITY vs. DEFECT PRIORITY:

Severity: How much the defect is effecting with application.
Priority: Relative importance of the defect, how fast the developer has to take up the defect.

1. The general rule fortune fixing the defects will depend on the severity. All the high severity defects should be fixed first.
2. This may not be the same in all cases sometimes even though severity of the bug is high it may not be taken as the high priority. At the same time the low severity bug may be considered as high priority.

2) How to estimate the required time to design/execution of test cases?
It can be estimate by understanding the project requirements, flow, feature to be tested. It also varies as per experience of QA person.

3) What is Boundary Value Analysis & Equivalence Partition?
Boundary Value Analysis – This is the method divides input domain of programs into classes of data from which test cases can be derived. The purpose is to represents a set of valid and invalid states for input condition.
In BVA we check the boundary values i.e. exact boundary values less than boundary values and values which exceeds boundary.
Advantages:
a) Very good at exposing potential user interface/user input problems
b) Very clear guide lines on determining test cases
c) Very small set of test cases generated
Disadvantages:
a) Does not test all possible inputs
b) Does not test dependencies between combination of inputs

Equivalence partition: - It’s designed to minimize the number of test cases by dividing tests in such way that the system is expected to act the same way for all tests of each Equivalence portion. This technique relies on looking at the set of valid inputs specified for a module and dividing it up into classes of data that should, according to the specification, be treated identically. One set of test data is then devised to represent each equivalence class. The principle is that any representative will be as good as any other in finding faults in the handling of that class.
Advantages:
a) Equivalence partitions are designed so that every possible input belongs to one and only one equivalence partition.
Disadvantages:
a) Doesn’t test every input
b) No guide lines for choosing inputs

4) What is Performance Testing?
Goal of performance testing is to eliminate bottleneck response of application and establish baseline for future regression testing. Verify application under controlled process measurement and analysis so that application is to be run smoothly.

5) What is Load, Volume & Stress testing?

Load testing – It’s the process of exercising the system test by feeding the largest work it can operate. Verify the system capability to handle a constant moderate load for a long time. Expose bugs that do not surface in cursory testing, such as memory management bugs, memory leaks, buffer overflows, etc.
Volume Testing - Verify the system for large kind of operations load for short time.
Eg. 1. Testing word processor by editing very large document
2. Testing Printer by sending very large data
3. Testing Mail server by sending the thousands of users mailboxes
Stress Testing - Stress testing tries to break the system under test by overwhelming its resources or by taking resources away from it (in which case it is sometimes called negative testing). The main purpose behind this madness is to make sure that the system fails and recovers gracefully this quality is known as recover-ability.

OR


Evaluates extend to which a system keeps working when subjected to extreme workloads or when some of its hardware or software is compromised. Primary goal is to determine the maximum amount of work system can handle without breaking.