Monday, November 24, 2014

How to record test script in JMeter and run through command line?

Below are the steps to record test scripts using JMeter

1. First launch your JMeter app, right click on the "Test Plan" node, select "Add" -> "Threads (Users)" -> "Thread Group"


2. Select "Thread Group" node and right click. Select "Add" -> "Config Element" -> "Http Request Default"


3. In "HTTP Request Defaults" page, enter the value in "Server Name or IP" field. For example, "jmeter.apache.org".

Note: If your portal are using SSL, please enter "443" to the port. The "Path" field can leave it as an empty field.


4. Select "Thread Group" node and right click. Select "Add" -> Logic Controller -> "Recording Controller".



5. Select "Workbench" node and right click. Select "Add" -> "Non-Test Elements" -> "HTTP(S) Test Script Recorder".

6. In "URL Patterns to Include" section, add the value ".*\.html".



Note: Make sure "Target Controller" is selected. Should select the the "Recording Controller" that have created in "Test Plan".

7. Select "HTTP(S) Test Script Recorder" and right click. Select "Add" -> "Listener" -> "View Results Tree"


8. Click on the "HTTP(S) Test Script Recorder", click on "Start" button. "Root CA certificate: ApacheJMeterTemporaryRootCA created in JMeter bin directory" message is displayed.

Configure browser to use JMeter proxy

1. Open the "Chrome", click on the "Setting" menu. Click on "Change Proxy Settings" button in the "Network" section.

2. Click on "LAN settings" button, set the value as Address: localhost Port: 8080


3. Open the Chrome browser and type in the command as "http://jmeter.apache.org/", the activity request will be captured at jmeter tools.


4. Make sure the "Recording Controller" consists of the intercept request. Click on "File" -> "Save Test Plan as" to save the test plan in jmx extension.



5. Run the jmeter test script through the command line as described below. Assume the test plan file name is "jmeter.jmx"
jmeter -n -t jmeter.jmx
Install SSL certificate browser to intercept the request

1. When the JMeter tool is started, a temporary SSL certificate "ApacheJMeterTemporaryRootCA.crt" will be generated. It always located at [JMETER_HOME]\bin.

2. Import the certificate "ApacheJMeterTemporaryRootCA.crt" into browser.



Tuesday, October 21, 2014

How to solve pod stop working once upgraded to "OS X Yosemite"?

Once I upgraded my Mac machine to "OS X Yosemite", I execute the command "pod install" to update the library, I encounter the error as showed below

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in '
 from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3:in `'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30:in `'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2:in `'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `'
 from /usr/bin/pod:23:in `load'
 from /usr/bin/pod:23:in `
To resolve the error as described above, uninstall cocoapod, reinstall xcodeproj and cocoapods.

    $ sudo gem uninstall cocoapod 
    $ sudo gem install xcodeproj 
    $ sudo gem install cocoapods

Saturday, October 18, 2014

How to solve WAMP server unable to start due to conflict of port 80?

Stop HTTP.sys server by using the command as described below

- Run command window using administrator rights (Right click "Command Window" icon and click on "Run as administrator" menu)

net stop http /y
sc config http start= disabled

Sunday, July 6, 2014

How to setup Ubuntu on Virtual Box?

Wish to explore Ubuntu but lack of machine to deploy and try. This is really frustrated especially for poor programmer like me who always struggling to upgrade my technical knowledge but not well equipped with neither hardware nor software. Out of disappointment, manage to discover virtual box as other option in setup Ubuntu on top of my Window 7 machine for exploration.

Note: 
1. Assume VirtualBox 4.3.12 has been installed on Window 7. Refer to http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html?ssSourceSiteId=otnjp

2. Assume Ubuntu version 14.04 installer CD is ready.

Create New Virtual Machine


- Click on "New" button, enter the details as described below

Name: Ubuntu
Type: Linux
Version: Ubuntu (32 bit)


- Click on "Next" button, allocate memory size as "1024" MB


- Click on "Next" button, hard drive allocation screen is displayed. Use the default allocation size as 8GB.


- Click on "Create" button, "Hard drive file type" screen will be displayed. Use the default "VDI (VirtualBox Disk Image" file type.


- Click on "Next" button, "Storage on physical hard drive" page is displayed. Select "Dynamically allocated" radio button.


- Click on "Next" button, "File location and size" screen is displayed. Default the name of virtual harddrive as "Ubuntu" and allocate the size limit of the file data on the hard drive as "40GB"


- Click on "Create" button, a new virtual machine is created and is as shown in the screenshot below 


Install Ubuntu

- Click on "Start" button, "Select start-up disk" page is displayed.   


- Make sure the Ubuntu start-up disk is inserted into the "Hard Drive D:". Click on "Start" button. Ubuntu installation screen is displayed.


- After few minutes of loading, the Ubuntu installation screen is displayed.


- Click on "Install Ubuntu" button to kick start the installation."Preparing to install Ubuntu" page is displayed.


- Checked the options below during the installation

1. Download updates while installing
2. Install this third party software

- Click on "Continue" button. "Installation Type" screen is displayed. Use the default setting as shown below. Click on "Install Now" button, the installation kick started. 


- Current location page as shown below is displayed. Select your current location. Click on "Continue" button.


- "Keyboard Layout" page as shown in the screenshot below is displayed. Follow the instruction as prompted in the screen. Once "Continue" button is enabled, click on "Continue" button.


- "Who are you" page as shown in the screenshot below is displayed. Enter all the necessary information. Click on  "Continue" button.


- The installation complete screen as shown in the screenshot below is displayed when the installation completed.


Voila, you will have Ubuntu run on your Window machine once you have restarted your virtualbox.

Friday, June 13, 2014

How to enable your Postgres database accessible by PgAdmin client from other machine remotely?

It is really inconvenience when I found out that I can't connect to my Postgres database (sit in Linux server) remotely through PgAdmin client tools to conduct my troubleshooting works. Even though from security perspective, should turn off the remote access. But, if my PgAdmin client is sitting within the same private network (behind the firewall), I think it is no harm to enable it. The reality is PgAdmin client on Window  is much more user friendly then I use command line tool on Linux.

Step 1 - Edit the Postgres database configuration file to enable remote machine to connect

vi /var/lib/pgsql/data/pg_hba.conf
Add the line as described below:-

host    all         all         [REMOTE MACHINE IP ADDRESS]/24       trust
Step 2 - Enable Postgres database to listen to all the IP address

vi /var/lib/pgsql/data/postgresql.conf
Edit the setting as described below

listen_addresses = '*'
Step 3 - Restart your postgresql database

service postgresql restart
Note: iptables on my Linux box has been turned off. You might want to edit the iptables setting (/etc/sysconfig/iptables) to enable port 5432 for your Linux server

iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d [REMOTE MACHINE IP ADDRESS]  --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s [REMOTE MACHINE IP ADDRESS] --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Note: Just in case "/etc/sysconfig/iptables" doesn't exists, maybe due to the first configuration, please type in command "service iptables save". This will save the rules at "/etc/sysconfig/iptables".

Monday, June 9, 2014

How to resolve the issue when your laptop can't connect to iPhone personal hotspot?

In order to resolve my laptop unable to join my iPhone personal hotspot issue, below are the steps that I personally has gone through.

Change the name of my phone
- Tap on "Setting" in your iPhone
- Tap on "General" menu
- Tap on "About" menu
- Tap on "Name" menu
- Change the name of your phone

Note: Once the name of your phone has changed, use your laptop to connect to the personal hotspot network with new name, you should be prompted to enter the personal hotspot passcode. But, you still unable to connect to the network for now.

Reset the WiFi password
- Tap on "Setting" in your iPhone
- Tap on "Personal Hotspot" menu
- Tap on "Wi-Fi Password"menu
- Key in the password for your personal hotspot
- Tap on "Done" button

Note: Reconnect your laptop to the hotspot with newly entered password, you should be able to get your laptop connected to your personal hotspot this time.


Monday, June 2, 2014

How to fix "User is not in the sudoers file. This incident will be reported" error when sudo bash is executed?

Below are the steps to grant user to sudo rights when message "[USER] is not in the sudoers file. This incident will be reported" is prompted upon "sudo bash" command is entered

- Type in "visudo" command
- Navigate to the bottom of the file, edit the file with user name as "[USER] ALL=(ALL) ALL".
- Save the sudo file