Pros and Cons of Deploying ColdFusion Apps as EAR Files?

ColdFusion 4 Comments »

I asked this question on CF-Talk, but didn't get any responses, so I'm trying again here...

At work we are beginning the transition from ColdFusion 7 to ColdFusion 9.  As part of the transition, we want to set up a ColdFusion 9 server cluster (using CF 9 Enterprise) to host those ColdFusion applications that need to have a high level of redundancy.  In order to reach this goal, the server admins want any apps hosted in this cluster to be deployed as EAR files.

From what I've read on the subject of EAR deployment, this is a sensible approach for a clustered environment, but it's unfamiliar territory for us.  We're used to having direct access to the application files so we can make minor adjustments rather quickly and I'm worried that adding a packaging and deployment step (even with the use of automation tools like Ant) is really going to slow down our ability to push out changes.  I'm also concerned about the fact that some of the apps in question are not self-contained:  they are integrated into websites that our clients have the ability to edit.  Based on what I've read, it's sounds like that wouldn't be an issue as long as the files and folders within the EAR were deployed in the right place for the client files to access them, but in practice…

So basically, I'm looking for some advice and input from anyone who deploys their apps as EAR files (especially from folks who've made the transition from deploying via file upload to deploying via EAR), anything from how we should plan for this, best practices, things to look out for, etc.

Anyone?

Taking Screenshots with CFSelenium

CFSelenium , Selenium 1 Comment »

In addition to doing browser behavior testing, there are four functions in CFSelenium that you can use to capture screenshots.  The first two are:

captureScreenshotToString(): captures a shot of your current monitor display in .png format and returns the image data as a base-64 encoded string. **

captureScreenshot(string filename): captures a shot of your current monitor display in .png format and writes the image data to the filename passed in as the argument.  The filename parameter must be a full path ending in a filename, like "C:\Data\Screenshots\screenshot1.png." **

 

**These two functions work for all supported browsers, but because they take an image of the entire monitor screen, the browser window launched by *CFSelenium may be obscured by other windows on your monitor, and sometimes CFSelenium (or more specifically the Selenium Server) places the browser window in the lower half of the monitor, cutting off the view of the lower half of the window.

The other two screenshot functions capture only an image of the web page in the browser launched by CFSelenium, and they capture that page in its entirety: even if the page is long enough to scroll for several screens, all of that content will be captured.  While that can make for some very elongated images, it does capture all parts of the page.  But unlike the first two functions, these can only be used with certain browsers:

Read more...

Using CFSelenium With The Most Common Browsers

CFSelenium , Selenium No Comments »

When using CFSelenium to send Selenium commands to the Selenium Server, you start off by instantiating CFSelenium as an object.  If you're using the ColdFusion 9 version, you would instantiate it with a statement like this:

browserUrl= "http://www.cnn.com";
selenium = new CFSelenium.selenium(browserUrl);

 

If you're using the ColdFusion 7 or 8 version, you might instantiate it like so:

<cfset var browserUrl= "http://www.cnn.com" />
<cfset variables.selenium= CreateObject("component","CFSelenium.selenium_tags").init(browserUrl) />

 

In both cases, you're calling the init() function of the respective CFSelenium .cfc file. The init() function can take 4 arguments:

  • browserURL: (required) the URL of the website (just the address to the webroot, not to any subfolders) you want to run the Selenium commands against.

  • host: (optional) the IP address or hostname of the machine running the Selenium Server instance CFSelenium will be communicating with. The default value is "localhost"

  • port: (optional) the port number used to communicate with the Selenium Server instance. The default is 4444.

  • browserStartCommand: (optional) a string that tells Selenium which web browser on the machine running the Selenium Server instance to use. The default value is "*firefox"

By default, CFSelenium uses Firefox to conduct the browser tests (which makes sense because most of the time you'll use the Selenium IDE Firefox plugin to create your tests). In order to have CFSelenium run a test case through a different browser, you'll have to pass a different browserStartCommand string into the init() function.  You can see a list of the different browserStartCommand strings in this post on StackOveflow:  http://stackoverflow.com/questions/2569977/list-of-selenium-rc-browser-launchers.

Sometimes it's just that simple, but sometimes it's not...and when it's not, it can be a real pain to figure out.  WIth some trial and error, I was able to get Selenium Server/CFSelenium to interact with all of the browsers I had installed on my Windows and Macintosh laptops.  Here's what I had to do it each case:

Read more...

Brief Guide to Testing Browser Behavior with Selenium IDE and CFSelenium

CFSelenium , Selenium No Comments »

The Selenium IDE Firefox plugin makes it easy to record the actions you perform on a web pages or series of web pages as a set of commands.  You simply open the Selenium IDE tool from the "Tools" menu in Firefox, make sure the Record button (the red circle in the upper right) is active, and then click and type away.  Once you've stopped recording, you can re-run the the recorded steps any number of times and even save the steps as a test case file to run again later.

Simply recording your actions as described above can be useful when you're troubleshooting a browser behavior (usually a Javascript function) that only executes after you've changed certain form fields or performed particular actions:  it saves you the time of constantly reloading the page and manually going through the actions again.  But you don't end up with an actual verifiable test:  you're verifying whether or not the page is behaving correctly by visually observing the outcome each time.  In order to use Selenium (and especially CFSelenium within the context of MXUnit) as a true testing tool, you need to add verification and assertion statements into your Selenium recordings.

Read more...

Quick Guide for Installing and Running CFSelenium

CFSelenium , Selenium 1 Comment »

I've been playing around with CFSelenium this week in order to come up with an implementation that will let me easily replicate and run tests I've created with the Firefox Selenium IDE plugin on multiple browsers.  I've learned a few things along the way that are worth blogging about, but I thought I should start with a blog post on how to get CFSelenium up and running quickly.

Read more...