Thursday, September 23, 2010

How to get text from FlexElement using RiaTest

Find below the solution to get text from any element from Flex window:

Suppose you have an element to get text from. First find it’s parent element and locate your targeted element by any element property (id, class, location ).
e.g.

var confirmationText = FlexCanvas("Home Page")->new Locator({id:"messages"})=>text;

to check value returned:
trace(confirmationText)


Cheers!

Wednesday, September 15, 2010

Automatic mail generation with attachment irrespective of development language

Hi

I came across a very old and very interesting tool called 'BLAT' which facilitate to send an email with attachment. Using BLAT you need not to worry about the development language.
BLAT provides blat.lib, blat.exe and blat.dll so we can use whatever we want.

I use EXE file and can use this either from ANT or command line. following is an example to use it via ANT:




cheers!
Vaibhav

Friday, August 27, 2010

Marathon Setup

I Got an opportunity to explore Marathon tool for automated testing. I found Marathon is good tool to automate Java application (Only Jar files) with little dependency :)

Marathon works like IDE so we only need to install is Java to run our application. So just download Marathon setup from http://www.MarathonTesting.com and unzip it to your willing location. Once you run marathon.bat file it will allow you to create new project. Fill up the required field with your Jar file path and start automating your application. Marathon allows you to use either Ruby or Python to script.


What I told so far is described on Marathon official site so what this blog post is about? Ok then check below the real time scenario.

Now I found a problem to setup individual machine for number of Automation resources and let them work at the same time on same codebase. Solution of this problem is to break down marathon setup so that I can set it up on server and check into the subversion. By doing this we can checkout code from Repository and start writing automation script.


So I create new directory structure as per my need. Find below very basic structure to make Marathon work:

- Marathon
1. build – build files
2. lib – copy Jar and jython from extracted Marathon source
• vldocking_2.1.5C.jar
• rmi-lite.jar
• sampleapp.jar
• marathon-runtime.jar
• marathon-ruby.jar
• marathon-python.jar
• marathon.jar
• looks-2.2.0.jar
• junit.jar
• jline-0.9.93.jar
• jedit-textArea.jar
• jaccess-examples.jar
• jaccess.jar
• forms-1.2.1.jar
• copy Jython directory version is 2.2 in my case
3. TestCases – regression test scripts
4. RegressionReport – regression report location (You can pass this location as an argument.)
5. Copy Marathon.bat

Double click on Marathon.bat to run Marathon ide. You will get an expected error because we have changed Jar’s location. Let’s change configuration of marathon.
Open Marathon.bat into notepad and change the “CLASSPATH” as per expected location.

%DIST% - is the location where you Marathon file resides.

So change all Jar file location to the right path (lib/). Now Marathon.bat



Cheers!
Vaibhav

Thursday, July 1, 2010

Time to move ON!!!

I leave BR Office by mid of July, Which would be equally sad as it is exciting. So much has happened here over the last two and half years and I have been really honored to be a part of that. Indeed, I am leaving BR– sort of.

Most of the people here couldn’t fail to notice that I am running very late in the office to achieve something. Well somehow I have achieved this from last two projects in Brickred. I am working alone on standalone application in publishing domain and its really interesting and exciting. I have learnt much but found not the right technology to work on. Now, I have made decision to move out.

I would love to keep working, if possible, with some people in near future. I learn best when working with great people (Sayantam, Daisy, Rob Styles, Glemser US Team) on their own projects, and don’t want to stop that diversity and opportunity, so hope will get a call if some interesting stuff comes up!

From August I will be working full time on Automation, let’s see what happens when it is not just a hobby business.

Friday, February 5, 2010

Dealing with SSL certificates while running selenium tests with Firefox-3.x

Selenium works without any problem if application does not use HTTPS; but as soon as application goes to the HTTPS URI on the same host everything goes unexpected. As Selenium effectively runs Firefox with a new profile every time, you potentially lose every certificate exceptions you might accept.

One technique is to create a custom profile; run Firefox using that profile; browse to the HTTPS URL and accept the exception into that profile; then close the profile. So accepted expectation would not be asked to accept again if we use same profile.

Following are steps to setup profile and some more hack to make accepted certificate available:

1. Start Firefox with the profile manager: firefox -ProfileManager
2. Create a new profile. You'll be prompted to choose a directory for the profile.
3. Select the profile and run Firefox using it.
4. Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
5. Accept the self-signed certificate when prompted. This creates an exception for it in the profile and Close the browser.
6. Go to the Firefox profile directory and delete everything in the directory except for the cert_override.txt and cert8.db files.
7. When you run your Selenium server, pass a -firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile with certificate exceptions.


In this way selenium would not ask you to accept any certificate once you accept against this profile. Do not forget to use same profile while run selenium. Have a look at beautiful code calling your profile:


The Ant task above, with this option, looks like this:


Outside of Ant, the command might look something like:

java -jar path_to/selenium-server.jar -firefoxProfileTemplate /path/to/profile \
-htmlSuite '*chrome firefox-bin' http://host.com testSuite.html seleniumResults.html



Cheers!!!

Tuesday, February 2, 2010

Logical (condition and loop) opertaion within ANT file

Wondered over how to make logical operation in ANT code. As ant code is not object oriented so one can not directly perform logical operation within this code. So I have added a jar file "ant-contrib".


Now I can write some magical code to handle selenium Regression test execution. The syntax of writing ANT is slightly different. check out another image:


That code did whatever is expected to be done. Magically done :)

Cheers!!!
Vaibhav