Using Selenium RC I am planing for creating an automation testing framework for our Java web-application.... please share some way like how to create framework ...which things is important in framework.....
Thanks in advance
-Ravi
There are a few key factors that would greatly increase the maintainability, speed, and general usability of your tests but none are more important than abstracting your element locators out of your tests and into a central repository. I've heard of many ways of doing that but the best option I've seen is using the Page Object pattern. Essentially, each page becomes a java class, with properties representing the elements you want to use. Because you only define this page once in your PageObject and not in your many tests, if you ever need to change an element locator, there's only one place to do it.
Selenium 2 has a wonderful PageObject Factory built in but you can't use that because you want to use Selenium RC. Fortunately The Automated Tester, David Burns, has an excellent article on using Page Objects in C#, it should be close enough to get you started. http://www.theautomatedtester.co.uk/tutorials/selenium/page-object-pattern.htm For more on the Selenium 2 / WebDriver page object implementation see teh Selenium Google Code Wiki http://code.google.com/p/selenium/wiki/PageObjects
Some other really important factors to consider
Use an external framework for Data Driven tests one of the most common questions on the Selenium Google Group is how to test run data driven tests. The answer is almost always to use the data driven features that came with your unit testing tool. TestNG has become really popular with Selemium users because of it's excellent support for Data Driven tests. There's even guidance on the TestNG site for Selenium
Parallelize your tests Because most tests drive a live browser (unless you're using HTMLUnit) tests will take some time. The more you can parallelize your tests across multiple machines the faster they will run. Sauce Labs has an excellent blog series on this
Screenshot on errors less common but also a good idea. Sometimes you need to look at your webpage when there's a problem
Related
I am attempting to optimize my current automation framework for faster execution. My current framework is designed by keeping separate xml files for locator strings, page objects for each page of my web app which fetch their locator info from these xml files.
But after googling a bit, some automation developers say that keeping those strings inside the page object classes would be more efficient. I need more in-depth details regarding this.
Thanks.
IMHO you're not looking it from the most appropriate angle. If your current automation process needs considering Data driven approach Vs Page objects when it comes to
optimize my current automation framework for faster execution.
you're not doing it right. In my experience I've had both implemented and running pretty much independently. First one for functional tests (that don't care so much what the rest of the page is displaying) and for the rendering tests (don't really care about the functionality, if the page layout is as expected). This is the reason why I also ran the UI tests with both headless ghostDriver and Chrome- Firefox-, IE- Driver.
Let's assume that your data-driven test logic uses something like CSharp's Class
Dictionary<TKey, TValue>
You only need to load it once and then the search is flat, an O(1) constant time complexity. Bottom line - such performance shouldn't be an issue unless you have unreasonable large amount of UI tests. Which violates the Test pyramid:
If we're going to talk about automation framework optimization for faster execution - parallel execution of your xUnit runner is a good fit.
Disclaimer: I'm assuming you are talking UI automation because of the tags you put for this question (selenium and ui-automation).
Does anyone know a good book/blog/resource explaining design patterns for cross browser testing projects?
The MSDN link below explains how to set everything up.
http://blogs.msdn.com/b/visualstudioalm/archive/2012/10/30/introducing-cross-browser-testing-with-coded-ui-tests.aspx
This is all set up however we currently have a CUITs project with over 100 tests all setup and running on IE. And there were a lot of problems and required a lot of re-factoring of the UI Map, Playback settings, Test steps(as control aren't recognized) etc. to have even few tests run smoothly. Plus since our clients always use the latest version of Chrome and Firefox the framework isn't up-to-date to support the newest versions. Hence, continuing the way we're doing right now it looks like we'll end up with bulky test code which will soon be nightmare to maintain as we add more tests to the project.
It would be good to know what are the best practices in terms of managing/isolating tests so it involves less re-factoring and smooth integration between tests for various browser.
The Selenium solution sounds like a perfect fit for your case. You can find
best practices in terms of managing/isolating tests so it involves less re-factoring and smooth integration between tests for various browser
in these test design considerations. Take a closer look at the parts about Page object model and Page factory for better understanding of
design patterns for cross browser testing projects
If you eant to make a step forward with it, take a look at selenium grid. It allows you to run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, Selenium-Grid support distributed test execution. It also supports running your tests in a distributed test execution environment.
We are using Selenium for functional testing our AJAX application. Although Selenium has been a great help for us, it still suffers the same problem functional testing always suffered: tests maintenance overhead. We have quite a lot of Java code that isn't easy to maintain when software changes. I know that other testing tools (like BadBoy an others) aren't very different in this respect. My question is: has there been any break-through in the functional testing industry recently? Or maybe there's an on-going promising research in this area?
One thing I know is that using page object pattern can reduce the level of maintenance for selenium tests.
keyword based test automation (Robot Framework)
Currently Selenium is one of the best tool available to Automate functional testing. But one must need to identify the potential use of any tool need to implement on any specific type of application. For AJAX based application if we use Selenium using Javascript language it would be better. Or we can use Selenoid (A replacement for Selenium as, it is easy to maintain) for AJAX based projects.
I've got analysis paralysis looking at all the different functional testing options for a new grails (v1.3.4) application. I've looked at
WebDriver/Selenium (which I've used before)
WebTest/Canoo
Geb
Tellurium
Grails Functional Test
and there must be others. I think some of the criteria that I would use to make a decision include (in no particular order):
Likely longevity, active development
Can do ajax/javascript
Support for PageObject or similar patterns
Maturity
Headless (eg htmlunit) is ok, especially if it makes things go faster
Good reporting
Support for NTLM credential provider or similar
Compact, robust test scripts
Takes advantage of groovy language
I would be particularly interested to hear from people who have tried more than one framework. Thanks!
I maintain the plugin for WebTest but I'd recommend giving Geb a try. I haven't used it personally on a project yet but I think it will tick off most of your criteria.
It is the most actively developed (IMO) but is quite new. It is built on WebDriver/Selenium so should also be a good fit with your past experience.
WebTest doesn't see a lot of development these days and does not have built in support for page objects. But it does give you great reports. It's downside is it's historical foundation of Ant. It makes it hard to test in a dynamic fashion as your test steps are built up when the test case is executed and then the actual test is run as a second pass.
I have used GFunc as well but the lack of reporting is a real pain and it does not get as much development as Geb. It is far more "groovy" than WebTest though and is a thin wrapper over HtmlUnit allowing you to "roll your own" testing functionality quite easily.
cheers
Lee
Grails Functional Test is HtmlUnit only. I wouldn't suggest coding directly to HtmlUnit these days with the other frameworks that are available that give you page object and better abstraction out of the box.
I've used the webdriver plugin which seems to work pretty well and has page object built in - but the page object support is coupled to the JUnit hierarchy, which makes it hard for me to use because I want to also use Cucumber.
I'm very excited about Geb and am hearing a lot of success stories with it but haven't gotten to finish setting it up myself.
Can anybody suggest a good tool to test GWT UI. What is the opinion about using Selenium & Webdriver ?
Any pointers and suggestions are welcome.
Thanks,
SD
Google themselves have an excellent article describing when and how to apply different testing strategies to GWT apps. The basic idea is to use unit-testing whenever you are testing business logic, but to use Selenium for specific end-to-end tests where you want to simulate user interaction.
The most important thing is limit how much GWT-specific testing you need to do since GWTTestCase and Selenium are so slow. The MVP pattern referenced in the Testing Methodologies helps enormously with this. Always ask yourself "Can I make this view any dumber?" Push logic for dynamically changing the UI into presenters that manipulate views so that you can test the logic in JUnit.
Then I'd suggest doing most of the UI testing in Selenium/Webdriver. Those tests should be fairly simple though: "Does X show up when I click Y?" kinds of things. GWTTestCase ends up being the most useful for me for code that needs to run under Java and GWT.
Or, as an alternative to the MVP pattern, you may use the gwt-test-utils framework to write simple tests in java, which runs faster then GWTTestCase tests :-)
You can do bog standard unit testing for your GWT components, if you want to do some layout checking things which can't be done through unit tests (can't give you examples since I don't know GWT nearly at all) then you may use Selenium, however Selenium does have some issues in specific cases, namely selecting elements and very rich content which may prove to be hard to handle since GWT is all about rich content.