i m doing selenium testing against an gwt wizard application, as a wizard, there are multiple steps, once user finish one step and click next, it transfer to next step, as gwt application, all steps are refreshed in the same page.
now i need to use selenium RC (java client) to write test against that gwt wizard and have 2 questions:
1. each time i start the wizard it require user login first, how can i avoid that login step to test the wizard directly?
2. since all steps are hold on the same page, how can i separate the test, say one test method for each step, without put the test in one big method?
Thanks.
I would suggest using Selenium2/Webdriver. Selenium 2 has the concept of page objects which allow you to create test objects which map to different pages within your app. I assume that you are enabling ensureDebugId in your gwt app (which allows you to access elements based on a predictable dom id). The combination of debugIds and selenium2 will allow you to quickly create a clean test representation of your pages and then allow your unit tests to simply drive the pages to where you need. The last bit of advice I would give for selenium2 and gwt is make sure that your page objects are created via AjaxElementLocatorFactory.
Related
I have a suite of cypress tests for an online application. Some of my tests only tests what is on the final page of the application or decision pages and hence do not want to always fill the initial pages each time I run these tests. I am hence trying to see if I can load state and which auto populates all the initial pages and loads the page I have the tests or require to test
I tried using cy.session like in the login scenario but not making headway with this.
Please does anyone know how this can be done.
I'm using Cucumber and Watir in my web automation project (written in Ruby).
I've a set of feature files with scenarios that I am constantly running.
I've received a task to add an additional global check that makes sure that a set of strings does not show up on any of the DOM of any of the pages in any of the scenarios that I run.
For example, I've a scenario called 'Login to environment'. While running through that scenario and the normal flow for logging into the environment, I need something that also checks that some string bla doesn't show up in any of the HTML DOM. Also, I need this to happen for every other scenario that I have.
What is the correct way to implement such functionality in Cucumber/Watir/Ruby?
I have a Ruby program that uses a webdriver (Watir) to walk a page and perform tests alongside a BDD suite called RSpec.
I'm trying to optimize it for a slow server by improving its ability to navigate efficiently. Thus far It has been creating a new browser session for each test package, then closing it afterwards. This is very inefficient because it hits the login page again for every instance.
Of course, I don't want to hard-code navigation instructions into the tests because adding new spec files may change the order they are executed in, and not every page of the webapp has the main navigation bar, so navigation may need to change based on the page the last spec left the browser on.
I need some kind of master library or module that will take what page the program is at and what page it wants to go to, then bring the browser to that page so it can begin testing. What is the best way to do this?
I'm not fantastically experienced so I'd love input from more seasoned developers. Should I have each page be a class? Should I just stick with closing browsers after each test packet? Should I manually code brute-force methods (gotoPage1FromPage2)?
Okay, that last one was a joke. Seriously though, what is the best way to do this?
You are exactly correct about the difficulties of maintaining state in your tests. Shutting down a browser between each session is the best way to make sure that you always know the state of the browser at all times for a test. Saucelabs goes so far as to spin up a new virtual machine for each of the tests they run. Ideally you decrease test time by running multiple tests in parallel.
I'm not certain I know what you mean by "test package" or how many times that means you are starting a new browser and logging in, but... another thing to consider investigating is whether you can set a cookie or use oauth to log in without having to use the navigation. I've worked at places that allowed admin logins for their staging environments by passing a parameter in an url.
Your tests should be clear in their intention, which typically means your Page Object implementation does not know about what comes before or after the actions you are taking. You should be able to look at the RSpec code and reproduce exactly what it is testing. Abstracting methods for taking you from one place to another magically in the background is not a good idea.
Best practice used to be having methods from one Page Object return new Page Objects. So users could write methods like this in their tests: LoginPage.new.login.view_account.edit_address. Many of us have been bitten by this approach. Plus it isn't as easy to read as doing something like this:
LoginPage.new.login
HomePage.new.view_account
AccountPage.new.edit_address
This doesn't prevent you from using #visit methods as needed to navigate between Page Objects.
The tutorials and example I've seen are all single page application.
Can anyone give an idea or point to a resource showing how a multiple page app can be developed with CanJS?
You should be able to create a new page in whatever app framework you are using or even just static pages, and then hookup your new control and view to any element on that new page.
You want to have a separate control for each module, so you might have separate controls even on a single page if you have, for example, a filterable dropdown list, a todo list, and a login. So, in your canjs directory for your app you will have separate sub-directories for each module which will contain your control, view/s, model/s, and observe/s and unit tests. This makes them re-usable, easier to test, and since they are modular if one part of your app breaks it won't take down all functionality. Once you get the hang of that incorporate AMD style loading of your assets with stealJS which is made by Bitovi - the CanJS creators.
https://github.com/bitovi/steal
If you want to manipulate the location.hash without actually changing pages or manaage browser history and client state you should check out can.route:
http://canjs.com/docs/can.route.html
I am going to work on Adobe CMS (CQ05) & Adobe SiteCatalyst based eCommerce website.
Can you advise-
Where can we automate the tests?
[As for any other CMS based solution, pages tend to be very dynamic & UI based automated record-playback execution can fail because of changes in screen]
Please suggest- where do you see opportunity to automate?
What tools one can used?
I will have access to CMS framework but no access to the code, testing code is out of scope.
Many Thanks in advance.
You can script your UI tests with Selenium instead of recording/play mode. Usually you record your scenario to build a test skeleton, then you edit the generated test to rely on elements you are sure to be present during the test (element id, etc.)