Which Testing framework will suit for Adobe CQ5 Project? - testing

Which testing framework will suit for a Adobe CQ5 Project which is having some part of code in Java and some part of code in JSP for the CQ5 components?

There are some details of testing of apache sling components on the Sling Testing page, which will suit components within a CQ5 project
There are remote tests that can be deployed to a running CQ5 server and executed remotely (using curl for example)
There are also integration tests that create a sling launchpad instance and test against sling in-process.
Also, Testing Sling Based Applications discusses approaches to testing the various types of components such as OSGI and provides the links to mocks for common Sling classes (e.g. MockNode, MockProperty, MockResourceResolver).
Finally, if your components are just POJOs then you can just use plain old JUnit tests. For testing the interaction with the web interface of your site/application you could use something like Selenium

Related

Where does the functionality of selenium to control the browser lies in?

Where does the functionality of the Selenium lie?
I've read somewhere that the language binding or API provides glue code to use Selenium in java.
Glue code or Binding code: The code that connects incompatible software components.
Jason Huggings wrote JavaScriptTestRunner to control the browser. The functionality to control the browser lie in the JavaScriptTestRunner.
It suffers from Same-origin policy. Paul Hammant created HTTP Proxy to bypass the Same-origin policy. This opened the doors to write tests in multiple languages. We are provided with an API to write tests.
Then WebDriver is created. WebDriver and RC are merged to form Selenium 2.
Where does the functionality to control the browser gone to?
Within the API?
Within the browser driver?
Why does the API is called as glue code or binding code? What does it bind?
Selenium in the general usage of the term is a library - a collection of code organized in modules and packages. In this form it's a WebDriver client - it can communicate with that kind of server, following the WebDriver protocol; thus enabling a programmer to control a browser.
Where does the functionality to control the browser gone to?
In the WebDriver protocol, and the server that translates the WebDriver commands to browser instructions, and back.
Selenium being a client gives you the ability to use this functionality, in your chosen language - conveniently, without you having to learn or directly run WebDriver requests and parse their response.
Why does the API is called as glue code or binding code? What does it bind?
In programming binding is the uniform / or well-defined API of a library, that connects lower-level code (other programs, or the OS) or protocols - WebDriver in this case, to higher-level concepts - your code. Wikipedia to the rescue, with more details.
Glue Code
Glue Code is the executable code most often the source code that serves the purpose of adapting different parts of code that would otherwise be incompatible. Glue code does not contribute any functionality towards meeting any program requirements as such. Instead, it often appears in code that lets the existing libraries or programs to interoperate among themselves, as in language bindings or foreign function interfaces. Glue code may be written in the same language as the code it is gluing together, or in a separate glue language. Glue code is very efficient in rapid prototyping environments where several components are quickly put together into a single language or framework.
JavaScriptTestRunner
Jason Huggins while testing an internal application at ThoughtWorks reduced the time which was required to manually step through the same tests with every change he made developing a Javascript library that could drive the interactions with the webpage which allowed him to automatically rerun tests against multiple browsers. He named this program as the JavaScriptTestRunner. Later, he made JavaScriptTestRunner open source. This library eventually became Selenium Core which underlies all the functionality of Selenium Remote Control (RC) and Selenium IDE.
Unfortunately, to work within the Same Origin Policy, Selenium Core must be placed in the same origin as the Application Under Test (AUT). So another ThoughtWork engineer, Paul Hammant, created a server that would act as an HTTP proxy masking the AUT under a fictional URL, embedding Selenium Core and the set of tests and delivering them as if they were coming from the same origin. This system became known as the Selenium Remote Control (Selenium RC), or Selenium 1.
Why to use HTTP proxy
Again, when web frameworks were becoming more complex and powerful, the restrictions of Web Browsers’ sandboxed Javascript environment were increasingly limiting the effectiveness of Selenium Core. Simon wanted a testing tool that spoke directly to the browser using the "native" method for the browser and operating system, thus avoiding the restrictions of a sandboxed Javascript environment. That was when WebDriver and Selenium RC were merged to form Selenium 2. All implementations of WebDriver that communicate with web browsers started using a common wire protocol. This wire protocol defined the RESTful web service using JSON over HTTP.
Conclusion
In short, the functionality to control the browser was always within the Javascript library that driven the interactions with the webpage which was part of the JavaScriptTestRunner and later Selenium Core.
As per the diagram below with respect to the different classes/interfaces the functionality to control the browser is with the selenium-api

How can I decide automation feasibility for web application?

Guys I need to decide feasibility of automation testing in web application. Application is developed in c#.net. Can any one guide me about factor which I need to consider for automation testing. I have some basic knowledge of Selenium WebDriver using Java, can I test web application using it? This application is leasing application it contains many calculations to calculate plan. Application also contains many reports as well as graphs to analyse enquiries as well as results.
I suggest some basic links to start with
http://www.softwaretestinghelp.com/choosing-automation-tool-for-your-organization/
http://searchsoftwarequality.techtarget.com/answer/How-to-choose-the-best-software-test-automation-tool-for-your-team
http://www.xoriant.com/blog/software-testing-and-qa/selecting-right-test-automation-tool.html
Your approach is definitely good. You can develop a ASP.NET MVC web application in C#, setup some core business logic by classic unit test and make integration test using selenium driver.
I suggest following that you first create a lightweight skeleton of the project containing:
git repository
ASP.NET web application
continual integration with build machine (use TeamCity or similar software)
unit test testing your core business logic
integration test written in selenium driver using C# running for all common browsers with good selenium support.
Check that with every commit following happen:
build is triggered
deployment package is created
unit test are triggers
integration test using selenium driver are triggers
all reports are collected
test results are stable (same results for same build number for repeated testrun)

Test Automation of CMS based web application

We are using BrightSpot as CMS in one the projects. I am proposing a test automation approach (as below) and would like to know what anyone else is doing along similar lines.
Use Capybara/Selenium-Webdriver to automate the actual publishing of pages or drive the content editing interface of BrightSpot with Capybara DSL.
Once pages are published:
- Do structural tests on the publish page.
- Check the entered content is visible or not visible based on content model defined.
Example,
<div id="asdfg" class="asdfg">
<h1 class="header">Entered Content</h1>
</div>
Expect the published page to have a h1 tag under div#asdfg and the content is "Entered Content".
But prior to automation we will do a manual testing to check cross-browser rendering (compatibility) and responsiveness testing.
There's a host of new tools that can help with web app/page test automation, like PhantomJS, a headless version of WebKit in Node.js and CasperJS, an API and test framework layer on top of PhantomJS. There's a swell webcast presentation that talks about both of these - video here.
The fellow that's presenting in the webcast built a SaaS based version for easily created automated UI tests called Ghost Inspector. The tests can run automatically from the cloud, or you can integrate tests to be run from your build/deploy/CI flow.
With Ghost Inspector, you can build that test in no time, either by using the CSS path or by using a Chrome plug-in that will record your session and construct a test for you (with all of the steps individually laid out) based on your interaction with the CMS web app. You can also run the tests with WebKit (Chrome) or Firefox engines.

Jakarta Cactus alternate?

Greetings, we have a project with loads of beans, JSP and etc. There is a desperate need for performing automated tests in our environment (we use Maven). Now, we can easily write tests for database project layer, for various security utilities we implemented. But the JSP pages remain untested.
I searched for utilities for server-side testing and Cactus seems the best option. However, according to their changelist, their last release is 1.8 and it was released more than two years ago!
So the question is - what happened to Cactus, is it still developing or what? And what are the recent alternates for Jakarta Cactus (if any exists)?
I've used a combination of Spring, JUnit and HttpClient with some success in recent projects.
Apache HttpClient provides a powerful and flexible API for constructing and sending http requests into your application. It cannot replicate a web browser, say by running client side scripts, however if there is sufficient content within the resulting http responses (headers, URI, body), then you can use this information to traverse pages within the application and validate the behavior. You can post forms, follow re-directs, process cookies and supply the inputs into your application.
JUnit (junit.org) drives the tests, invoking a series of pages with HttpClient and can be deployed alongside the application, run standalone with ant/maven, or run separately inside your IDE.
Spring (springsource.org) is, of course, optional as you may not be using it for your project. I've found it useful to stub/mock out parts of the application, such that I can isolate specific areas, such as front-end controllers, through to the business logic, by substituting the DAOs to return specific data values. It provides an excellent Test Context Framework and specialized TestRunners that hook in well to testing frameworks like JUnit (or TestNG if you prefer).
Cactus served as a good server-side testing framework in the ejb2 ages and but it's not supported anymore.
You can use combination of both Mock testing (fine-grained) and In-Container testing (coarse-grained) strategy to test your application completely.
Mock Testing Frameworks : Mockito, Jmockit, EasyMock etc..
Integration Testing Frameworks (Java EE) : Arquillian, Embeddable API, etc..
I prefer Mockito and Arquillian for server-side testing.
How about Arquillian? I haven't used it and it doesn't even have a stable version yet, but at least it's in active development.
You might want to try selenium. That with jBehave is a good combination I'm finding. And the more support for both those projects, the more they will not go defunct (like cactus).

Advantages of Powershell for web-ui testing?

I am working on a commercial project which is a web-based app which will be bundled with an app/web server (JBoss), which is deployed, with the web app files, at runtime.
I've seen links about how Powershell can do UI testing. Is there any advantage in Powershell for web-testing as opposed to Selenium or VS2010's coded UI tests? (Selenium has poor documentation, which is in Powershell's favour, but I am interested in more functional reasons).
Thanks
Powershell will give you advantage if you need to manipulate something else than a browser/webpage/webapp. With Powershell you can do something with OS, applications, things outside the browser.
If you don't need to do that, if you want to automate only web based app, than I would suggest using web specific tool. Selenium is nice, tests in MSVS2010 are great. If you prefer coding try WatiN for .net, and WatiJ for java. All of them will run smoothly not only inside IDE, but also on CI server.