Thursday Mar 20, 2008

Create MySQL jdbc Connection Pool from Glassfish Admin GUI

To create a mySQL dbc connection pool from Glassfish V2 Admin GUI console, please follow 2 steps below
    1. Create a new mysql test account
    2. Create jdbc connection pool

1. Create a new mysql user account
    a. Start database from a command prompt
        $../<GlassFish-Installed>/mysql/bin/mysqld-nt.exe --defaults-file=../<GlassFish-Installed>/mysql/mysql.ini
         (For Solaris machine replace mysqld-nt.exe by mysqld_safe)
    b. Login as database admin to create a testUser account
        $../<GlassFish-Installed>/mysql/bin/mysql -u root
         mysql> grant all privileges on \*.\* to 'testUser'@'localhost' identified by 'testPassword';
2. Create jdbc connection pool and test the connection
     a. Start domain1
        ../<GlassFish-Installed>bin/asadmin start-domain
     b. Create jdbc connection pool for mySQL
          -From Admin GUI Console > expand Resources node > JDBC > Connection Pools > click New button and enter information below:
                Name: testMYSQL
                Resources Type: javax.sql.DataSource
                Database Vendor: MySQL
            Click Next to proceed to the next panel
            Go to Additional Properties and enter:
                databaseName: test
                User: testUser
                Password: testPassword
                ServerName: localhost
           Click Finish button
           Click testMYSQL > select ping to test the connection

Monday Feb 11, 2008

Glassfish GUI Automation with Selenium (Java)

Want to try Glassfish Admin GUI with Selenium and experience the differences between SilkTest and Selenium tools

1. Run Selenium from the build 
If you build admin-gui module you can find the README.SeleniumRC file under the ../glassfish/admin-gui/tests directory. Just follow the instruction from the file, you should be able to setup and run Selenium JBI tests with Glassfish Admin GUI. If you encounter a failure from your browser, open selenium test case files under java directory and replace statement
selenium.waitForCondition("Selenium.browserbot.isNewPageLoaded()", TIMEOUT_PERIOD) by
selenium.waitForPageToLoad( TIMEOUT_PERIOD)

2. Run Selenium with Glassfish V2 binary bit
    1. You must setup the environment by installing Selenium IDE on your Firefox browser
    2. Having ant 1.6.5 and jdk1.5.0_11 or latest version installed on your system
    3. Create a AdminGUITest directory on your system and copy the following 4 files to the ../AdminGUITest/lib directory
selenium-server.jar , selenium-java-client.jar, selenium-java-client-driver-tests.jar and testng-5.5-jdk15.jar  and junit.jar
     4. Copy the simple test harness (AdminGUITest.jar file) to your AdminGUI directory and unjar the file
     5. Update file  with your setup environment
     6. Start the selenium remote server (assume you're using a window system)
cd  %AdminGUITest.home%
             java -jar selenium-server.jar
     7. Start glassfish domain1
     8. Run the first AdminGUI test case
             cd  %AdminGUITest.home%
      ant run-test
3. Differences between SilkTest and Selenium

Features Selenium SilkTest
HTLM Web Object Support Yes Yes
Easy Creation Object Scripts (Record and Playback) Yes
Scripting in variety languages (Java, Perl, C#, PHP, ..) Yes No (Only 4test language)
Ability to run test with build scripts (maven, ant,..) Yes No
Support Different Browsers Yes Yes
Reusability of Scripts Yes Yes
Commercial Support Yes Yes
Test Debugging Yes Yes
Result Reporting Fair Yes
Exception Handling Fair Yes
Java Objects (beyond the browsers) No Yes
Https protocol support Yes (some configuration required)
Capable of record exactly same as end-user desire Fair Yes
Organize tests according to the manual Test Plan No Yes
Data Driven Test Framework No Yes
Mechanism to create test independently (one test should not depend on other) No
Support Multiple OS Yes Yes
Comprehesive Test (run for > 8 hrs)
Weak Yes

Thursday Dec 20, 2007

Glassfish GUI Automation Tools (SilkTest)

Why SilkTest / Selenium 

If you want to automate your applications with Glassfish Admin GUI. There are few software tools that you can use such as: SilkTest, Selenium, Httpunit, WinRunner,  Among those tools I found SilkTest and Selenium work best to automate Glassfish Admin GUI test cases. This blog shows you the steps to setup and configure SilkTest for Glassfish Admin GUI. For selenium, please click this link

SilkTest 2006 R2 and SilkTest 7.6 are the two versions we are currently using for Glassfish V2. Since SilkTest is mainly installed and executed on a Window machine, you should write your test to run with IE browser. It doesn't matter if Glassfish installed on a Solaris, a Linux or a MacOS machine; you will not find any problem to run SilkTest on a client window machine.

The browser we've been testing is IE 6/7, but Silktest can also run with FireFox or Mozilla browsers. If you have Glassfish installed on a machine which is different than SilkTest automation suites
installed, please do the extra step (1 or 2) below:

1. For Solaris
  -Login the Solaris machine as root
  -Edit /etc/hosts.equiv file > add + + line in the file.
  -Go to root directory > edit file .rhosts > add a line + + in the file.
On the window where SilkTest installed, put rsh.exe name in the machine PATH. rsh.exe file should be located under c:\\windows\\system32 directory

2. For Linux:
  -Login the Linux machine as root.
  -Edit /etc/pam.d/rsh file >  change all “required” to “sufficient”
  -Edit /etc/securetty file > add “rsh” at the bottom
  -To check if rsh working, on window, type: rsh <LinixHostname> -l root ls. You should see all files under Linux root machine listed.

Config SilkTest:
    -From window, click Start menu->Programs->SilkTest->Extension Enabler.
    -Select to enable extension by selecting
“IE DOM” from Primary Extension of the correct IE version. Remeber to disable all extensions for all other browsers and java application. > click “OK” button when done. (Please see the
picture below)

    -Again click Start menu->Programs->SilkTest->SilkTest to bring up SilkTest > click Options menu > Extensions > enable only IE version to test and disable all other extensions > click “OK” button when done.
    -Click Options menu > Agent > click Timing tab > give 60 in the “Window timeout” field >
Uncheck all check boxes in verification click “OK” button when done.  (Please, see the figure below)

    -Click Options menu > Runtime and remove all content in Use Path field > make sure only “extend\\” appears in the “Use Files” field and the correct IE browser version in the “Default browser” field.  (click here for the runtime option picture)

That is much you need to do.




« April 2014