Saturday, March 2, 2013

More about Extreme Testing or Test Driven Methodology

Extreme Programming

In Extreme Programming, rather than designing whole of the system at the start of the project, the preliminary design work is reduced to solving the simple tasks that have already been identified.
The developers communicate directly with customers and other developers to understand the initial requirements. They start with a very simple task and then get feedback by testing their software as soon as it is developed. The system is delivered to the customers as soon as possible, and the requirements are refined or added based on customer feedback. In this way, requirements evolve over a period of time, and developers are able to respond quickly to changes.
The real design effort occurs when the developers write the code to fulfill the specific engineering task. The engineering task is a part of a greater user story (which is similar to a use case). The user story concerns itself with how the overall system solves a particular problem. It represents a part of the functionality of the overall system. A group of user stories is capable of describing the system as a whole. The developers refactor the previous code iteration to establish the design needed to implement the functionality.
During the Extreme Programming development life cycle, developers usually work in pairs. One developer writes the code for a particular feature, and the second developer reviews the code to ensure that it uses simple solutions and adheres to best design principles and coding practices.
Discussion of the core practices of Extreme Programming is beyond the scope of this chapter. For more information, see the links referred to in "More Information" later in this section.
Test-driven development, which is one of the core practices in Extreme Programming, is discussed in greater detail later in this chapter.

When to Use Extreme Programming

Extreme Programming is useful in the following situations:
  • When the customer does not have a clear understanding of the details of the new system. The developers interact continuously with the customer, delivering small pieces of the application to the customer for feedback, and taking corrective action as necessary.
  • When the technology used to develop the system is new compared to other technologies. Frequent test cycles in Extreme Programming mitigate the risk of incompatibility with other existing systems.
  • When you can afford to create automated unit and functional tests. In some situations, you may need to change the system design so that each module can be tested in isolation using automated unit tests.
  • When the team size is not very large (usually 2 to 12 people). Extreme Programming is successful in part because it requires close team interaction and working in pairs. A large team would have difficulty in communicating efficiently at a fast pace. However, large teams have used Extreme Programming successfully.

More Information

For more information about the core practices in Extreme Programming, see the following resources:

Friday, March 1, 2013

Selenium IDE - Find & Replace text in url

Selenium IDE - Find & Replace text in url


Steps:

1. First store current url in to any variable.


<tr>
<td>storeLocation</td>
<td>url1</td>
<td></td>
</tr>


2. Next using replace function, replace the word - pdfreader with epub reader in the url & again store in different variable.


<tr>
<td>storeEval</td>
<td>&quot;${url1}&quot;.replace(&quot;pdfreader&quot;,&quot;epubreader&quot;)</td>
<td>url2</td>
</tr>

Tuesday, January 15, 2013

Selenium Automation Frameworks






1
Selenium + Ant + Test NG
2
Selenium RC + PHPUnit + Ant
3


4


5


6


7


8


9


10








Selenium RC, Eclipse, Java - Hrmes framework
 

 
The HRMES is a test framework built for ALL testers of web based applications.
Supports Selenium RC, IDE, Grid etc.,  -   >> More


 
Selenium RC,TestNG, Eclipse

>> Video Clip 1

>> Video Clip 2

 
How to setup Selenium RC in Eclipse   - >> Video Clip
 
Setup Eclipse for Maven, TestNG, SVN, and Selenium  - >> Video Clip
 
One Good framework from Open2 site - >> More

Selenium Integration Testing For All Framework - >> Video Clip

Testing Testlink via Selenium RC - >> Video Clip

ROBOT Framework - Selenium RC & Java - >> Download from here      >> One more          >> another one
                                                     

                        

 Selenium & PHPUnit

Best Article ( step-by-step) to know the setup Selenium RC + PHPUnit - 
click here
 Best to learn & automate using Selenium with PHPUnit - click here  & 


                                                                                               - to download - www.phpunit.de

Integrating & Testing PHPUnit with Selenium - sebastian-bergmann.de

How to use Selenium - PHPUnit for automating functional tests - drupal

Selenium RC integration for PHPUnit - sebastian's github

Testing PHP/Web Applications with PHPUnit and Selenium - sebastian bergmann Video Clip

Pear site to download all the packages - click here 

Selenium Framework for PHPUnit - Mediawiki

Article on how to run phpunit with selenium RC - Devzone Article

Drunit - PHPUnit and Selenium RC integration for Drupal - Drunit

Exlusive Video clip for phpUnit y Selenium RC - >> Video clip

Article to how to install - PHPUnit, Testing_Selenium in Windows Vista - Click here ...

Blog from saucelab to integrate PHPUnit with Selenium - click here 

Yii framework - click here

Useful article with screenshots - click here   


Selenium RC & PHPUnit & Ant

How to integrate with ant script -- click here


Selenium & JUnit



A standard framework - Click here ...

Selenium RC with JUnit: -  
Click here ...




Selenium with JUnit & JMeter





Selenium Grid with PHPUnit

Integration of Selenium Grid with PHPUnit - video clip


Google code based frameworks







SAT - Selenium Ant TestNG Framework


Architecture


This framework is created using ANTTestNG and Selenium.
Through this framework, a user is able to create an automated test case which can be run later by executing a single command. The uses of different frameworks are as follows:
Selenium: This framework is needed for recording a testcase, exporting it into Java, and executing it on a browser
TestNG: This framework is used to organize different tests, and to report results.
ANT: provides the glue to hold everything together, and execute basic commands.

Pre-requisites:


Basic knowledge of Selenium IDE, Selenium RC, TestNG and ANT.

Setup:


1. Install Selenium IDE on your Firefox browser.
2. Make sure you have ANT installed.
3. Grab the testws.zip file from here. Unzip it into a directory of your choice.
About the sample 
There are 2 bundled samples:
1. AdminLoginTest.java: This test logs into the glassfish admin console using the username/password: admin/administrator. It then clicks on the 'Enterprise Applications' link, and tests to see if there are no applications deployed. Else, test will fail.
2. SimpleTest.java: This test accesses http://localhost:8080/ page, and tests whether the term "Glassfish Project" appears or not.
The config directory contains testng.xml file, and is a place holder for configuration files.
The lib directory contains required jar files, and is a place holder for other library jars/zips.
The test directory contains test java files and is a place holder for other test files.
Once the tests are run, build and test-output directories will be created.
The build directory contains compiled classes, and is a volatile directory that is deleted by the target clean in build.xml file.
The test-output directory contains result files, and is generated by TestNG.
Notes:
To run the bundled sample, follow the steps for "Execute your test through ANT" (see below).
Currently, I face some issues running this on IE. I have successfully been able to run tests using Firefox.

How To:


Write a test case
The basic structure that one has to follow to create a test case is:
1. Record a testcase using Selenium IDE (Firefox browser only), Export the test case into Java
2. Edit the test case – java file, and add TestNG annotations
3. Execute the test case using ANT
1. Record test using selenium IDE and export it into Java:
i. Open the website you’d like to test in Firefox browser
ii. Start the selenium IDE from your Firefox browser
iii. Ensure that the Base URL in Firefox is the same as the website you want to test
iv. Start clicking on the website. Selenium will record your actions.
v. When finished, do: File -> Export Test As... -> Java – Selenium RC and save the java file.
seleniumIDE-export.JPG
After exporting, your java test case should look like this:
selenium-java-test.JPG
2. Add TestNG to your test case:
i. Open the java test file you just created in an editor
ii. Add the following:
(a) to the import statements:
import org.testng.annotations.*; 
(b) To variable declarations:

private DefaultSelenium selenium;
private static String TIMEOUT_PERIOD ="10000";

(c) To The class:

@BeforeSuite(alwaysRun = true)
public void setUp(String browser) {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8080");
selenium.start();
selenium.open("http://localhost:8080");
}
@AfterSuite(alwaysRun = true)
private void stopTest() {
selenium.stop();
}

(d) After each statement in the test that will take time for a page to load:

selenium.waitForCondition("selenium.browserbot.isNewPageLoaded()", TIMEOUT_PERIOD);

(e) On top of the test method:

@Test(groups = { "<your test group name>" })
e.g. @Test(groups = { "roller" })

(f) Edit page to be opened. Make sure arg to ‘open’ method of selenium points to the right context root e.g. Ifhttp://localhost:8080/<context_root> is the correct URL to test, then since we already have tried to open localhost:8080 in setUp, we only need to open the context root page.
e.g. 
selenium.open("<context_root>");
iii. Save the test file
(a). (Optional) Update testng.xml file. TestNG uses this file to read which groups to execute and also to pass parameters to the test. This file is only required if build.xml file uses testng.xml file to run the test.
Note: in sample test included, testng.xml is used, and will need to be updated.
iv. Ensure that the test file you created is mentioned in the build.xml compile target.
3. Execute your test through ANT
i. Start domain required by your webpage. e.g. asadmin start-domain
ii. Start database if needed (Not needed for bundled sample test)
iii. Start selenium server e.g. cd testws/lib, java -jar selenium-server.jar
iv. Execute the command: “ant run” from ‘testws’. You should see a new firefox browser window open up, and run through your test.
v. Check reports generated by TestNG under ‘testws/test-output’ directory. Open the index.html to see different output from the test.
SAT-html-output.JPG
Console output:

SAT-cmd-output.JPG