Test Javascript across multiple browsers - javascript

I am investigating frameworks to automate testing of javascript application different browsers: IE, Chrome, Firefox etc. I would like to include it as part of my Jenkins CI pipeline.
I have looked at:
How to use remote browsers for js-test-driver task on Jenkins?
https://code.google.com/p/js-test-driver/wiki/GettingStarted
http://www.browserstack.com/automated-browser-testing-api
(fair pricing)
http://docs.seleniumhq.org/
(seems a bit dated)
Am I missing some currently recommended tools to use for CI and automation of browser compatibility testing?

Here's a list that you can expand your search farther.
http://en.wikipedia.org/wiki/List_of_GUI_testing_tools
I've used Selenium, integrating it with Jenkins and it's worked well.

Related

Does Protractor JS works for native mobile apps

I kind of think that answer of this question would be No by going through Protractor issue 1798 and Protractor vs Webdriver-IO comparisions.
I want to write automated tests cases for a hybrid mobile app in JavaScript which will run on Appium.
Currently I have both Protractor and Appium configured in same project to run those End-to-End test cases, and they work.
Problems are that,
I have to write separate test cases for each of them.
Cases should also work on mobile devices(Android and iOS) and protractor doesn't support native apps tests.
Situation is, I am more comfortable with Protractor's settings in my current project than Webdriver-IO which Appium uses (just a personal preference).
Question-
Is there a way of using only Protractor while writing test cases which would work using Appium and work perfectly on Devices/Emulators?
I am also open for any suggestion(s).
If answer remains No, I will change my codes to only use WebdriverIO in order to keep my test cases reusable and only once.
The answer is still NO protractor currently does not have support for mobile native apps but you can use it for automating browsers in your mobile.
Better use WebdriverIO but it also has its own limitations, please do check its changelog and github issues before deciding it as your webdriver framework.

Ensuring IE-9 compatibility while end to end testing using phantomJS

I am using PhantomJS (headless end to end testing),selenium webdriver,grunt(task runner) for my application testing. My requirement is that the application should be compatible with IE-9. I have to do headless testing because I'm using jenkins for continuous integration.
How do i make sure that my application will run perfectly on IE-9
while testing on phantomJS ?
You can't use PhantomJS for testing compatibility with Internet Explorer, because it is a Webkit browser.
Since you're using Selenium, you should be able to use the IE WebDriver.
Some thoughts on why you can't even simulate IE in PhantomJS:
They are built on different base technologies. They use different rendering engines and both have different bugs when it comes to adhering to W3C specifications.
JavaScript bugs may be simulatable, but this requires you to go ahead and fix all bugs that PhantomJS has in comparison to your specific IE version by exchanging the implementation of some browser APIs. You would also need to introduce some bugs that are present in your IE version, but not in PhantomJS again by exchanging implementation.
CSS bugs can only be introduced if you change the WebKit implementation and compile it again. You would have to find them first.
Great, you have effectively reverse engineered IE.

Does Selenium integrate "independent" browsers (via webdrivers) or use existing browsers installed in the OS?

I am new the Cross Browser Testing and just starting to look at Selenium however I can't seem to find the answer to the followings on the official site. It would be much appreciated if someone can help clarify for me.
Does Selenium integrate "independent browsers" (via webdrivers) or uses/links existing browsers installed in the OS?
If Selenium uses "independent browsers", can it actually "open" for instance say IE7, IE8, IE9, IE10, Safari in OS (say windows) separately after which you can test the UI?
1) The browsers that you want to be tested should be installed in your machine. so the answer is it uses existing browsers.
2) No. You have misunderstood.It can automate only the browsers available in the OS. BTW, you can not have multiple version of same browsers in same machine... unless you run from a pen drive.
Using RemoteWebDriver and Selenium Grid, you can have different machines hosting different versions of browsers.
The tests will still execute on your machine but the browser will open on a machine which has the version you define in the test.
This is especially useful when running tests as part of a CI build when the CI server will often not have browsers installed.
Building and maintaining your own grid can be time consuming so companies such as Saucelabs provide a cloud solution in which you point your tests to open browsers on their grid. They have most combination of browsers, versions and os.

What is a good tool for unit testing javascript in a maven webapp / liftweb project?

I want to unit test the javascript I have embedded in the webapp portion of my liftweb project. Liftweb is a subset of the maven webapp archetype, so my question applies to that framework as well.
By 'good', I mean that the tests can be integrated into the maven automated testing.
I understand that different browsers support different versions of ecmascript, so I am okay with a testing solution that restricts itself to one specific version.
JSUnit might help with JavaScript testing.
I like QUnit for testing javascript. I have no idea how well it fits in with the maven test automation tools. I do know that you can extract the test results in a format that is more friendly to automated builds.
Typical solutions I've seen for including javascript with other forms of automated testing utilize a tool like Selenium or WATiR/WATiN to fire up a browser and execute the tests. Of course there is also TestSwarm if you want a way to test javascript against multiple browsers in an automated fashion, but again I am not sure what the capabilities are as far as integrating with other automated testing systems.
Some things that you may find helpful in testing your javascript applications:
QUnit http://docs.jquery.com/QUnit
Env.js http://github.com/thatcher/env-js

Web Automation Tool

I've realized I need a full-fledged browser automation tool for testing user interactions with our JavaScript widget library. I was using qunit, starting with unit testing and then I unwisely started incorporating more and more functional tests. That was a bad idea: trying to simulate a lot of user actions with JavaScript. The timing issues have gotten out of control and have made the suite too brittle. Now I spend more time fixing the tests, then I do developing.
Is it possible to find a browser automation tool that works in:
Windows XP: IE6,7,8, FF3
OSX: Safari, FF3
?
I've looked into SeleniumIDE and RC, but there seems to be some IE8 problems.
I've also seen some things about Google's WebDriver, which confusingly seems to work with Selenium.
Our organziation has licenses for IBM's Rational Functional Tester, but I don' think that will work on the MAC.
The idea is to try to run tests on all the browsers our organization supports. Doable? Are my requirements unrealistic? Any recommendations as far as software to try?
Thanks!
I would recommend using Selenium but I say that as a Selenium Committer.
Selenium works on any browser that supports JavaScript since the framework has been written in JavaScript. This means if your browser on any OS supports JavaScript it will run in Selenium. That documentation it out of date, you can see that since it is talking about IE8b1 and IE9 preview is out now.
Selenium and WebDriver (which isn't a Google thing since it started at ThoughtWorks) are currently being merged as they both have their strengths and weaknesses. The current merged work will be called Selenium 2 and you can start using the alpha release now at http://code.google.com/p/selenium/. It will still work on any OS as that is still the main driving force behind the work being done.
Selenium IDE only works on Firefox because it is a Firefox add on.
I personally would avoid Rational Functional Tester because it has a lot of weaknesses that its not even worth contemplating.
If you start with Selenium there are some tutorials on my site at http://www.theautomatedtester.co.uk
Try Sahi (http://sahi.co.in/) It works across browsers and operating systems. It has a powerful recorder, and great APIs for object identification. It supports HTTPS, proxy tunneling etc. and has drivers in sahi script, java and ruby. It also has parallel playback inbuilt. It is 5 yr old mature project hosted on SourceForge, with releases almost every month.
It automatically waits for AJAX and page loads, and does not use XPaths for object identification. It also handles sites with dynamic ids.
Selenium is probably your best bet out of the tools you mentioned. What are the issues it has with IE8? You might want to check out HttpUnit to see if that meets your needs, also.
Selenium RC is a great tool if you invest the time to use it. With significant modifications to the existing library I've gotten it to fulfill all of my front end testing needs.
The confusion you are having about Webdriver is understandable. Selenium 2 is in development and will be a merge of Webdriver and Selenium. Check out: http://www.youtube.com/watch?v=RQD4EzWI4qk to get more detail.
The only browser that I have found to be unusable with Selenium is IE6. IE7 and IE8 work fine as does Firefox (which I have modified to include firebug for debugging purposes).
I'm in the same boat. It is a difficult problem to solve. Windmill and Selenium are the 2 best I've found. Though they both have issues. Selenium can only record scripts in Firefox and I haven't managed to get the proxy chaining to work as advertised. Windmill you can record in any browser and you can supposedly tweak the proxy to put extra logic in there, but the js mechanism for recording across page loads has been in my experience very brittle at least on the app I have to test.
I don't think anyone can get it quite right as long as there is more than one browser that needs to be supported.
Maybe have a look at SIKULI. It's a different paradigm but, depending on what you want to test exactly, it may do the job and will work with any browser, on any platform.
Have a look at their official blog for some examples of interactions with web applications.
So I wrote some of my more problematic tests in Selenium RC, using the Python driver. It was a better experience than writing the same tests in pure JavaScript, but I still had some of the same issues.
Testing something like an ajax autocomplete widget, meant forking some of the code depending on IE, or Firefox, and I still can't get typeKeys or a combination of type with typeKeys to work in Safari.
So, I am not sure if having cross browser clean, extensive ui tests is a bit unrealistic.
Should I try webdriver/Selenium 2? Would that make things better, or is that product not ready for prime time yet? How's the Python binding for that? I don't know Java, but I would learn some if need be.

Categories