Monday, June 16, 2014

QAUTOMATE SETUP GUIDE




Table of Content
1.      Oracle Database
1.1        Install Oracle Database
1.2        Uninstall Oracle Database
2.      Prepare database for qAutomate
2.1        Create database account for creating qautomate database
2.2        Generate qautomate database
3.      Deploy qAutomate webservice
4.      Configure qAutomate
5.      Export and import database from one machine to other
5.1        Export database
5.2        Import database
. 22

1.                  Oracle Database

1.1              Install Oracle Database


Download Oracle 11g R2 to get Oracle resource files (win64_11gR2_database_1of2.zip and win64_11gR2_database_2of2.zip)
 Extract these files on our computer then go to extracted folder and click Setup.exe, Installer window is opened as below:

At “Configure Security Update” step, do not need to enter email and password, click “Next >” button

On “Email address not specified” dialog, click “Yes” button.
At “Select installation option” step, select “Create and configure a database” then click “Next >” button.

At “System Class” step, select “Server Class” then click “Next >” button.
At “Grid installation Options” step, select “Single instance database installation” then click “Next >” button.

At “Select install type” step, select “Typical install” then click “Next >” button.

At “Typical install configuration” step, enter Oracle database paths, Global database name and password (this password is used to connect to Oracle database as SYSTEM role), click “Next >” button.

Wait for “Prerequisite Checks” step completes, at “Summary” step, click “Finish” button. 

Wait for “Install product” step completes, click “Close” button at “Finish” step.
After we install Oracle database completely, we can jump to Section 2 to prepare database for qAutomation. Section 1.2 is just used to uninstall Oracle database when we need.

1.2              Uninstall Oracle Database

-          Firstly, open Oracle Universal Installer (OUI) following the path Windows > All Programs > Oracle - OraDb11g_home1 > Oracle Installation Products > Universal Installer.


On OUI window, click “Deinstall Products…” button. Check “Oracle Database 11g 11.2.0.1.0” checkbox, click “Remove…” button.

Then click “Yes” button on Confirmation dialog. Wait for process is completed, then click “Close” button to close OUI window.
-          Secondly, Run regedit.exe, delete HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE key (This contains registry entires for all Oracle products.).


-          Thirdly, delete all HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Oracle.* key (all keys that start with Oracle).


-          If your machine is 64-bits Windows, delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE key (if any)
-          After that we have to reboot our machines.
-          Delete “D:\app” directory. (This is the place store Oracle Base that we install Oracle in Section 1.1).
-          Delete “C:\Program Files\Oracle” directory.
-          Empty all contents in “C:\TEMP” directory.
-          Empty all contents in “C:\Users\<username>\AppData\Local\Temp”
-          Delete Oracle - OraDb11g_home1 in start menu (following path Windows > All Programs).
-          Empty recycle bin.
Then Oracle database is removed successfully from our machine.

2.            Prepare database for qAutomate

2.1              Create database account for creating qautomate database

Connect to Oracle Database:
-          Run cmd, enter command sqlplus
-          Enter user-name: system
-          Enter password: password that we use when installing Oracle database.


On SQL console, enter commands:
-          connect sys AS SYSDBA
-          Enter password: password that we use when installing Oracle database.
-          create user <our user> identified by <our password>;
-          grant SYSDBA to <our user>;
Then we see result in below picture 

2.2              Generate qautomate database

Get database_generate.zip from the path D:\Project Name\Automation folder. Extract then go to the extract folder, we edit the file wipeout.bat 

We change <password> by password of Oracle database system, <our user> by user and <our password> by password that we enter into SQL console. For example:

After that we save this file and double-click on this file to generate database. Then database is successfully generated

3.                  Deploy qAutomate webservice

This part is for those who want to set up their own web server and deploy completely new qAutomate web service.
Precondition:
-          Get Tomcat server, qautomate.xml” file and  qAutomate build
-          Make sure Java has been installed and system variable JAVA_HOME has been set up.



Open “Explorer”, navigate to “Control Panel\All Control Panel Items\System”, click “Advanced system settings” link. On “System Properties” panel, “Advanced” page, click “Environment variables…” button. On “System variables” grid, create a variable name “CATALINA_HOME” with value being Tomcat location 

Also on “System variables” grid, find “Path” variable, add “%CATALINA_HOME%\bin”.

Copy file “qautomate.webservice.war” from qAutomate build folder and put it into “…\apache-tomcat-7.0.50\webapps” folder. 


Paste file “qautomate.xml” into “…\apache-tomcat-7.0.50\conf” folder.

Open file “qautomate.xml” and configure below lines to point web service to your database:
<property name="hibernate.connection.password">[your password]</property>
<property name="hibernate.connection.url">[your database connection]</property>
<property name="hibernate.connection.username">[your username]</property>
For example: 


Save and close this file. Then we go to “…\apache-tomcat-7.0.50\bin” folder, double-click “startup.bat” to start Tomcat server

4.                  Configure qAutomate

-          Inside qAutomate build folder, double click “launcher.bat” file to start qAutomate.

-          Application will ask for webservice, click “Yes” button.

-          Use URL Connection: http://<your computer IP>:8080/qautomate.webservice/ and click “Save & Close” button

Finally, qAutomate Homepage will be displayed.

5.                  Export and import database from one machine to other

Precondition: Stop Tomcat server and qAutomate on both machines.

5.1         Export database

On our machine, export the database by command line:
expdp system/<database_password> dumpfile=<dumpfile_name>.dmp schemas=<database_name> query=’<database_name>.job_instance:"WHERE job_instance_id=-1"'
The dabase dumpfile will appears in the Oracle base directory (e.g. D:\app\<our_name>\admin\orcl\dpdump)

5.2          Import database

On the other machine, we copy the dumpfile from our machine and pasted it to the Oracle base directory this machine (e.g. D:\app\<other_name>\admin\orcl\dpdump). Then we run the command line:
impdp system/<database_password> dumpfile=<dumpfile_name>.dmp
After database is imported successfully, we can run Tomcat server and start qAutomation as usual. 

                                                                                                                   Automation Team