Here's the problem:
We have a healthy infrastructure of projects that contain selenium page objects and methods for each part of our site. However, each selenium project is written using the language its parent component is developed in. So for example, team A creates component A using node.js and thus their selenium objects are written in js, while team B creates component B in .NET, and their selenium page objects in C#.
How can we write complete end-to-end selenium tests of our site with different parts using different languages for their selenium bindings? We of course want to maintain a separation of concerns, so team A doesn't need to concern themselves with the selenium details of team B. Should we be approaching this differently?
Why not to agree on usage of one common language for test automation? It will solve consistency problem. All utils/libraries can be shared across the different teams, prevent from reinventing the same wheel.
Related
For web application automation Selenium can be used with Robot framework. But both are frameworks.What is the relation between these two?
You have selenium to automate all the web related work e.g login,click,button and many more thing. But then you have to use it with some languages , e.g. Java ,Ruby, Python.
Suppose you get a project to automate a webbrowser by using any other languages , where your task would be
1)login to browser
2)Fill user details
3)Click on submit
Now to have a good framework , you need to break down these tasks into smaller component
1) you need to define test cases
2) You need to have a separate file to store variables
3) You need to have a good reporting tool , which will show how many test cases passed or failed and further drill down.
i am a python user,so lets talk the problem with python,selenium
1) you can write the test cases with unittest module - But then generating a good test reports would be hedache , you have to spend a lot of time to create good test reports
this is one of the major disadvantage with python
Now coming to RobotFramework
if you integrate selenium library in robotframe work, you would be able to do almost similar thing which can be done by any other languages with lot of ease and control.
Taking example of your assignment in hand
1) You can define Test cases
2) You can Create a seprate variable file and then pass it with main file during run time (check pybot -V)
3)You dont need to be worry about reporting part , all the reports would be generated and with betterdrill down options
additional advantage
1) There are lots of inbuilt libraries, which will help you to do your task easily
2) You can create your own custom library and import in Robotframework
3) You would be able to drill down till last variable where the problem is with help of RobotFramework Reports, which will save lots of time
In Nutshell i can say Robotframework provide a building block to your framework where you just need to worry about the functional aspect of your program
Your original assertion is incorrect. They are not both frameworks. Or at least not the same type of framework.
robot framework is a set of programs and libraries for creating test cases. With it you can create test suites built upon reusable keywords written either from other keywords or written in other programming languages. The framework provides a test runner, and generates test reports.
selenium is a library interface to a driver that controls a browser. You cannot write tests using only selenium -- you need something else such as a programming language (python, ruby, etc) or testing framework (robot, cucumber, etc). Selenium itself provides no way to run tests, and no way to generate reports.
I have a group that has some non-technical people creating tests and test suites using the Selenium IDE. I'd like for that group to be able to work independently, yet after the fact be able to run a series of those suites with minimal button clicks. There are a lot of reasons why I'm not just writing tests using some 'native' language (groovy or java) and making this easy to use for the team will help adoption of testing.
So, I would like to be able to just instruct the members of the team to open a single 'suite' (or equivalent) and run it and it would then run each of the suites that I have designated as part of the 'master suite' (if you follow me).
I know that I could just maintain a list of the suites that are part of our automated tests, but it would be easier for me to sell if it was possible to just open up a single file and click 'go' and then walk away and see the results after coming back from getting a cup of coffee or something.
If your reason for not going with a native language is because of your non-technical people, then your automation strategy will fail.
Sorry for being blunt, but there is a reason why there is the IDE, and there is the native language support. They both serve very different purpose, and if you don't approach automation with the respect that it's a programming exercise, then your automation strategy will fail.
Selenium IDE is extremely limited. You are unable to string multiple test suites together. You only have the option of creating one huge a** list of test cases in one suite, or loading your suites in one at a time.
Go WebDriver - everything that you want to do, is extremely limited, if even possible using the IDE.
Yes, I wrote a framework that does that. You can record as many "Selenium Builder" scripts as you like and they will be ran by my framework in a multi-threaded fashion as a group. Just fork your own copy of my framework and then modify it to your uses.
I am new to selenium web testing. Could you tell me how to learn it step by step, and what the technologies are that I need to study?
I suggest you download Selenium IDE or Se Builder, which are user interfaces for recording Selenium tests in-browser. Both let you record and then export tests to a bunch of different languages.
One important thing to note is that there's two Seleniums: original Selenium 1, where tests are comprised of a list of steps to execute in order, and Selenium 2 / Webdriver, which is an API for programming tests.
(Full disclosure: I'm the main developer on Se Builder, so I'm totally biased towards it. I do think it's probably less intimidating for a newcomer, but Selenium IDE is as of time of writing the more established and standard IDE. :) )
UPDATED: Additional resources listed below
The record and playback tools Zarkonnen called out are good starts. You also need to understand the fundamentals of Selenium itself. There's good information on writing tests in code on Selenium HQ's documentation pages.
Three things I think important to get correct from the start:
Learn about locators on pages, learn how to store them in one location (read up on the Page Object Pattern and be careful about record/playback tools which may not help you in that approach)
Learn how to deal with dynamic content (AJAX) with implicit and explicit waits
Learn about modular tests. Write small, reusable components.
If you're working in Ruby then I'd really recommend having a look at Cheezy's page_object gem.
Also, have a look at the various intro pages on the Google WebDriver project page.
Update: You should also consider having a look at Dave Haeffner's Elemental Selenium and his Selenium Guidebook. Both are great resources for real-world stuff people struggle with, not facile, shallow examples.
Hi I want differences between architectures of selenium RC and webDriver.
I read lot of functional differences but did not find anything for architecture differences.
If anyone can send/post links of differences that will really appriciate.
Thanks in advance
The difference is quite substantial.
Selenium RC works only using JavaScript for its every command. That means that everything you write is eventually translated into Javascript and run in the browser. This approach has several pros and cons - it should work the same way in every browser, but is limited to "same origin policy" and to JavaScript limitations.
http://seleniumhq.org/docs/05_selenium_rc.html#how-selenium-rc-works
WebDriver actually uses each browser's own and native API's to work with them. That means that it sometimes needs direct help from browser development team, sometimes fails on a new browser version release, sometimes behaves slightly differently on different browsers (but hey, on IE, js was also not the most reliable thing), but is a much stronger tool overall. It should be faster, it should allow for much more complex work without any js limitations.
http://seleniumhq.org/docs/03_webdriver.html#how-does-webdriver-drive-the-browser-compared-to-selenium-rc
Note that while Selenium RC has been oficially deprecated, the WebDriver is now being developed rapidly and it still suffers from several child-illnesses and is not in its full strength. That said, using WebDriver, you can do anything Selenium RC can do. And sometimes more. With an occasional minor bug.
here you can Selenium Webdriver Architecture
http://qeworks.com/selenium-webdriver-architecture/
you can also find diff. between RC and webdriver below
http://qeworks.com/difference-between-selenium-rc-and-selenium-webdriver/
Though there are many advantages of Page Project Model, some of them worth mentioning are :
Simple and clear page classes with sensible method names.
You can actually give the customize names to you methods. Like above so that you need not to keep anything in mind.
Just looking into the method name gives you all idea about the capabilities of the method.
Makes tests more readable. In comparison to above commands of selenium , where in you need to add all the commands in the tests scripts . in page object model you need to put method names. The methods which you have created according to your understanding of application so these methods name are more readable and easy to understand.
Stay [DRY]
Page object model believes in the principle of Do not repeat yourself.
Good support of tests, because everything is stored in one place.
Easy creation of new tests. In fact, tests can be created by a person not knowing the features of automation tools.
As I have actually implemented it in my project so definitely there are some flaws:
All locators should be kept in page class file.
And this abstraction leads to some chaos with in the Page Class file.
So you need to implement something like key word driven on top of Page Object Model so as to fully take the advantages.
All the documents I have read so far on various testing frameworks (Selenium, Tellurium, Canoo etc) encourage (or at least concentrate) on functional testing an application through UI. I have seen very less on the below which I believe are most important ones
localization testing
usability testing
cross browser compatibility testing
testing against multiple versions of the same browser
xss/sql injection
validation
Is the UI/presentation layer calling the correct service layer API (service layer being tested thoroughly through component based testing)
So here are my questions
1) What are you specifically automating in UI test automation?
2) Which UI testing framework can meet all the above items?
I have used Selenium in the past and it works great for all of the 1-7 except maybe localization since I did not have to test that. As 2, the applications I have tested were mostly just "write something in textbox and see if it works", so it was quite easy. And, for 4, I had multiple virtual machines with only specific browsers installed. It was hackjob, but, worked, sort of.
Automation projects till now is not that mature to incorporate all the points you mentioned. Majority cases automation is used to test functionality through UI. Also backed up with unit testing to have more coverage on Functional part.
Framework, there will not be any ready to use framework available. But there are tools which has these capabilities, like eggPlant (TestPlant). Generally industry follows is hybrid kind of automation. Like use jmeter to fire number of REST calls and check response. Which will cover client-server calls. And use selenium kind of tool, to check Client UI.
For Cross browser, cross platforms Selenium Grid with junit framework can be formed easily.