Tag Archives: Tool

List of ebooks about selenium you should read

5 Jun

1. Selenium 1.0 Testing Tools: Beginners Guide

The Selenium Testing Tools Beginner’s guide shows developers and testers how to create automated tests using a browser. You’ll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as css, xpath, DOM to find elements on the page.

Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.

A beginner’s guide to writing Selenium tests using different aspects of the Framework to give you confidence in your web application

Test your web applications with multiple browsers using the Selenium Framework to ensure the quality of web applications

2.  The 2nd edition of “Selenium Simplified

“Selenium Simplified” takes you through the process of installing and learning to use all the basic tools needed to write automated tests using Java as the programming language. Written in a tutorial style, this book helps you learn to code even if you haven’t programmed before. No time is wasted on the theory of automation or padding about the tools. This book focuses on the practical knowledge needed to automate tests for production systems.After reading this book you will be able to: -Write tests in Java – even if you haven’t coded before reading this book-Install and maintain all the free development and testing tools covered within: Eclipse, JUnit, Selenium, Hudson, Subversion, Xpather, Selenium-IDE-Write automated tests scripts using Java and Selenium-RC-Create abstraction layers to make your automated tests maintainable and readable-Run your automated tests under continuous integration-Use multiple browsers to execute your tests-Understand the most utilised commands in the Selenium API-Test Ajax based web applications-Use Xpath and CSS Selectors in your tests-Understand how to optimise and refactor your tests-Use JUnit for data driven testing.

3. Java Power Tools

All true craftsmen need the best tools to do their finest work, and programmers are no different. Java Power Tools delivers 30 open source tools designed to improve the development practices of Java developers in any size team or organization. Each chapter includes a series of short articles about one particular tool — whether it’s for build systems, version control, or other aspects of the development process — giving you the equivalent of 30 short reference books in one package. No matter which development method your team chooses, whether it’s Agile, RUP, XP, SCRUM, or one of many others available, Java Power Tools provides practical techniques and tools to help you optimize the process. The book discusses key Java development problem areas and best practices, and focuses on open source tools that can help increase productivity in each area of the development cycle, including: Build tools including Ant and Maven 2 Version control tools such as CVS and Subversion, the two most prominent open source tools Quality metrics tools that measure different aspects of code quality, including CheckStyle, PMD, FindBugs and Jupiter Technical documentation tools that can help you generate good technical documentation without spending too much effort writing and maintaining it Unit Testing tools including JUnit 4, TestNG, and the open source coverage tool Cobertura Integration, Load and Performance Testing to integrate performance tests into unit tests, load-test your application, and automatically test web services, Swing interfaces and web interfaces Issue management tools including Bugzilla and Trac Continuous Integration tools such as Continuum, Cruise Control, LuntBuild and Hudson If you area Java developer, these tools can help improve your development practices, and make your life easier in the process. Lead developers, software architects and people interested in the wider picture will be able to gather from these pages some useful ideas about improving your project infrastructure and best practices.

 

 

 

How to setup and run Java Test tool (junit, emma) for beginners

5 Jun

Searching on Internet and find a useful slide for beginners with Java Test Tool

JUnit is a testing harness for unit test

Emma is a code coverage tool

You can find how to setup and run these test tool in this slide.

It is simple and easy to apply. Enjoy it by yourself

You can download in link

[Ebook] Selenium 1.0 Testing Tools Beginner’s Guide

2 Jun

The Selenium 1.0 Testing Tools Beginner’s guide shows developers and testers how to create automated tests using a browser. You’ll be able to create tests using Selenium IDE, Selenium Remote Control and Selenium 2 as well. A chapter is completely dedicated to Selenium 2. We will then see how our tests use element locators such as CSS, XPath, and DOM to find elements on the page.

Once all the tests have been created we will have a look at how we can speed up the execution of our tests using Selenium Grid.

Download in link


[Test tool] [Selenium] Selenium Regression Testing Part II – Tips and Tricks

29 May

In my last post, I talked about how you can use Selenium to do real regressions tests for web applications. It’s a great way to automate testing the real user experience, and not just the backend stuff.

(see Luke’s last post here: Web Application Functional Regression Testing Using Selenium)

That said, Selenium is a relatively new technology, and it’s not without its issues. When building your first test you might find a lot of times where it’s a trial and error process. There are so many different ways to do the same test, it can be overwhelming. Often times, one or more of the ways you try won’t work. I’m going to try to list some of the common problems I ran into and tips I found below.
Selenium Commands
waitForElementPresent
this is will block your test proceeding until it finds the identified element. It checks once a second for 30 seconds.
this was the most common way I dealt with ‘ajax’ type interactions where it takes an unknown period of time for something to show up
I also use it generally instead of verifyElementPresent – it does basically the same thing with a little wiggle room
mouseDown/mouseUp/mousePressed/click
mostly equivalent, but sometimes you need to match the desired event to a javascript handler
try click first. If it doesn’t work the way you want, move on to mouseDown and so on.
waitForFrameToLoad/selectFrame
important if you use iFrames (modal dialog, etc.)
the selenium selectors only hit the current frame, otherwise you have to select the correct frame
an easy way to get back to the root window is to do selectFrame null
type vs. typeKeys
type fills out an input in code – if it works, use this. You can use this,and then fire a single typeKeys for the last character if you need an event to be triggered.
typeKeys fires the key events on the element
has some idiosyncracies – certain letters (I’m looking at you,‘y’) are reserved to do other special keypresses
necessary if you are using a wysiwyg ‘designmode’ type box instead of a standard input
verifyX vs. assertX
if verify fails, the test continues (and is marked as errored). If assert fails, the test aborts.
Usually verify is better, unless one task blocks a future one from functioning correctly
runScript vs. Eval vs. Expression
runScript inserts the javascript you provide into the current frame/window. Useful for those things selenium doesn’t support – like moving a cursor around and selecting text in a wysiwyg
Eval runs javascript in the context of selenium. Handy for complex checks – use waitForEval (for instance, checking the css background image property of a particular element)
Use this.browserbot.findeElement(“selenium selector”) to find elements the way selenium would
Use window.X To access the current frame/window context objects
Expression is similar to Eval, but uses Selenium’s custom expression format instead of javascript (but you can combine with javascript by using javascript{}
storedVars[‘key’] allows you to get to a variable you created with a Selenium ‘store’ expression
selectPopUp
useful for checking stuff in a popup that was initiated
Easiest to get by the html title of the popup, but do a ‘pause’ first to let it load
Selenium Selectors and XPath
In general, be as abstract as possible.
Don’t select individual server generated ids (hand crafted html ids are ok if you don’t expect them to change)
Don’t select on complicated relationships ( /div[0]/div[2]/a[4] ) – your html structure will change and you’ll have to maintain it
Select links by the simple link=text when possible – easy to read/maintain, unlikely to change
Use //that (any decendant) instead of /this/that where possible
. references ‘this’ element. Helps to select something with a particular text: //div[@id=’publish-private-shares’]//p[.=’This is pretty cool.’]
Contains() is useful if you don’t know the exact text (for instance, when an element has multiple css classes): //div[@id=’pageContent’ and contains(@class,’contenteditable’) and h2=’Goals’]/p[1]
Selenium RC
While you can use Selenium IDE to create a c# version of your tests – if you do so, you have two tests to maintain. You can run your ‘selenese’ tests directly with RC, too.
JAVAPATHjava.exe –jar SELENIUMPATHselenium-server.jar –htmlSuite “*BROWSER” “BASESITEURL” “SUITEFILEPATH” “RESULTSFILEPATH”
I’ve written a simple csharp console project that automatically finds the correct javapath and fires up the test when you run it. If people ask in the comments, I’ll post it.
Last I checked, Chrome and Safari-Windows don’t work. Chrome is supposed to be fixed in Selenium RC 1.0.4
Sauce RC
This is a great UI to help test multiple browsers, but there are a couple of issues
Firefox works, but only in dual window mode
IE works, but only in single window mode.
The ‘timeout’ setting implies a default timeout per action in your test, but it is actually the timeout for your entire test run. Since it defaults to 30 seconds, you’ll probably want to change it, or else your tests will suddenly die for no reason with no explanation/log.

I’m sure there is probably more I’ve forgotten, so leave a comment if you get stuck and I’ll try to help out if I can.

For some helper classes for Selenium 2 with ASP.NET Forms, see the following post: Simplifying C# Selenium 2 Tests for ASP.NET WebForms

http://www.foliotek.com/devblog/selenium-tips-and-tricks/