Contents of JMeter GUI

What is mean by Test Plan & WorkBench in JMeter. We are covering how to add and remove JMeter Elements, How to Load and Save JMeter Elements. Alongwith that we are covering how we configure Jmeter Elements. Finally we will see How to save a JMeter Test Plan, Running & stopping Test in JMeter.

After opening JMeter. Firstly, our eyes go to these two Elements,

  • Test Plan
  • Workbench


Test Plan

A test plan shows a series of Elements are useful in application tasting process. These Elements are: Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.



WorkBench
The WorkBench is simply a place which creates space to temporarily store test elements at the time of constructing test. In other word, it is a sandbox or portion of a test on which you are working on. That’s why, if the designed test in the WorkBench is ready to proceed, copy that and move it into Test Plan. Jmeter only save the contents of Test Plan not WorkBench.

WorkBench keeps non-test Elements too: Http Mirror Server and Http Mirror Server, these elements are not available in the Thread Group and Test Plan.



Add and Remove JMeter Elements
Adding Elements in Test Plan is very important step to execute your Test Plan. Without going through this, JMeter is unable to execute your Test Plan. A Test Plan is capable to include many Elements such as Listener, Controller, and Timer. To add Element in the Test Plan, right click on Test Plan which opens context-menu of Test Plan, then choose new elements from “Add” list. Alternatively, elements can be loaded from file and added by choosing the “merge” or “open” option.

Before adding any Element in the Test Pane, it is necessary to add first a Thread Group element. The Thread Group says JMeter the number of users you need to simulate, how frequently the users should send requests, and how many requests they should send.

So, first let us know how to add the Thread Group element, right click on Test Plan which opens context-menu of Test Plan and then select Add –>Thread Group.

After adding the Thread Group, the Thread Group should display under Test Plan. If it is not visible, then “expand” the Test Plan tree by clicking on the Test Plan element.

After defining Users, define the task on which they will work. Let us take an example of HTTP Request Defaults Element, add this element by right clicking on Users and then choose Add –>Config Element –> HTTP Request Defaults.



As like adding, you can also remove the Element which is not required. Let us take an example of “HTTP Request Defaults” Element. To remove this Element, right click on “HTTP Request Defaults” and from context-menu choose “Remove” option. It will display the dialog box with message “Are you sure you want to remove the selected Element”, if yes, then click on “Yes” button, or if no, then click on “No” button

Click Yes to confirm delete this element on message box.



Load and Save JMeter Elements
a) Load Elements
To load the element from existing file, choose the element from existing tree on which you want to load the other element, then right click on the selected element and click on “Merge” option. Choose the file from the existing saved Element. JMeter will merge the elements into the tree.



b) Save Elements
To save tree elements, choose the element from the tree, right click on an element and from the context menu option choose the “Save Selection As…”option. JMeter will save the selected element, plus all child elements beneath it. Created file cannot be saved in jmeter by default; you have to explicitly save the element.

When you save the element, it will save with the default name of the element, you can save with the same name or you can change it. For example, The figure below shows the save dialog box with default name “HTTP Request Defaults.jmx”. Either you can give the same name or can change it before clicking on “Save” button.



JMeter Test Elements and Test plan are stored in *.JMX format. JMX is standing forJava Management Extensions.

Configure Jmeter Elements
To configure any Element, first select the element of the Tree from Left Pane and do the configuration settings of the same element in the Right Pane.



You can configure any element of the Test Plan, using the element frame present in the right side of the JMeter window. These frames facilitate to configure the nature of the specific test element.

Saving the Test Plan
First save the Test Plan, before running a test. This saving helps to avoid surprising error comes at the time of running the test plan. To save the Test plan, first go to the File ->Save Test Plan. It displays the save Dialog box,give the file name of Test Plan and click on “Save”.


Running a Test Plan
To run the Test Plan, from top of the menu item click on Run à Start or from the keyboard press “Control+R”. Also, JMeter shows a small green button at the right hand side just under the menu bar – this is an alternative tool to Run Test Plan.



Stopping a Test

There are two ways to stop running test,

First Way: Click on “Stop”, or from keyboard press Control + ‘.’. This is an immediately process to stops the threads, if possible.

Second Way: Shutdown,or press –> Control + ‘,’. This appeals the threads to stop at the end of any present work.


If you enjoy reading article then you can subscribe our updates for FREE, just add your email id below. If you need any specific point to be cover around JMeter GUI in detailed then let me know in comments below. I will keep on updating the article for latest testing information.

How to connect the PC Host with PC11 if fire wall is the bottleneck?

How to connect the PC Host with PC11 if fir wall is the bottleneck?








What is Junit Test Framework?

JUnit is a Regression Testing Framework used by developers to implement unit testing in Java and accelerate programming speed and increase the quality of code. JUnit Framework can be easily integrated with either of the followings:

1.Eclipse
2.Ant
3.Maven

Features:JUnit test framework provides following important features
  1. Fixtures
  2. Test suites
  3. Test runners
  4. JUnit classes
  5. Fixtures
Fixtures is a fixed state of a set of objects used as a baseline for running tests. The purpose of a test fixture is to ensure that there is a well known and fixed environment in which tests are run so that results are repeatable. It includes

setUp() method which runs before every test invocation.

tearDown() method which runs after every test method.

Let's check one example:import junit.framework.*; public class JavaTest extends TestCase { protected int value1, value2; // assigning the values protected void setUp(){ value1=3; value2=3; } // test method to add two values public void testAdd(){ double result= value1 + value2; assertTrue(result == 6); } }

Test suite:

Test suite means bundle a few unit test cases and run it together. In JUnit, both @RunWith and @Suite annotation are used to run the suite test. Here is an example which uses TestJunit1 & TestJunit2 test classes.import org.junit.runner.RunWith; import org.junit.runners.Suite; //JUnit Suite Test @RunWith(Suite.class) @Suite.SuiteClasses({ TestJunit1.class ,TestJunit2.class }) public class JunitTestSuite { }
import org.junit.Test; import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class TestJunit1 { String message = "Robert"; MessageUtil messageUtil = new MessageUtil(message); @Test public void testPrintMessage() { System.out.println("Inside testPrintMessage()"); assertEquals(message, messageUtil.printMessage()); } }
import org.junit.Test; import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class TestJunit2 { String message = "Robert"; MessageUtil messageUtil = new MessageUtil(message); @Test public void testSalutationMessage() { System.out.println("Inside testSalutationMessage()"); message = "Hi!" + "Robert"; assertEquals(message,messageUtil.salutationMessage()); } }

Test runner:

Test runner is used for executing the test cases. Here is an example which assumes TestJunit test class already exists.import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; public class TestRunner { public static void main(String[] args) { Result result = JUnitCore.runClasses(TestJunit.class); for (Failure failure : result.getFailures()) { System.out.println(failure.toString()); } System.out.println(result.wasSuccessful()); } }

JUnit classes:

JUnit classes are important classes which is used in writing and testing JUnits. Some of the important classes are

Assert which contain a set of assert methods.

TestCase which contain a test case defines the fixture to run multiple tests.

TestResult which contain methods to collect the results of executing a test case

Run Vugen from command prompt in load runner

Run Vugen from command prompt

Here is the command to run vugen from the command prompt

1. Go to where the Vugen is installed and navigate to the 'bin' folder

C:\Program Files\HP\Virtual User Generator\bin

2. Run the following command there
mmdrv.exe -usr [Full path of the script name.usr]

lr_param_sprintf security issue when run over a firewall(Error: CCI security error: You are running under secure mode and the function lr_param_sprintf is not allowed in this mode. )

The function lr_param_sprintf sometimes causes a security issue in the script when run from Performance Center. 

Error Message 
Error: CCI security error: You are running under secure mode and the function lr_param_sprintf is not allowed in this mode.

This function causes an issue in Performance Center due to the way the function works and the way the Load Generators have been setup in the environment as this function does not work over a firewall.
Solution:This is an example of how function could be to generate a timestamp value – 

lr_param_sprintf( "timeStamp" , "%ld", time(&t) ); 
An easier and workable way of which is

char strTime[10]; //timestamp variable
/*
-- -- -- -- -- -- -- --
Other code goes here
-- -- -- -- -- -- -- --
*/
lr_save_string( (char*)itoa( time(&t), strTime, 10 ), "timeStamp" );

Invoke Vugen from a .net app

1. Add System as a Reference to the project
2. Here is actual code to run the script -
Shell("[Vugen Installation Folder]\bin\mmdrv.exe -usr [Full path of the script] -vugen_win 0", AppWinStyle.NormalFocus)

Example :


Shell("C:\Program Files\HP\Virtual User Generator\bin\mmdrv.exe -usr C:\FlightsTool\FlightCal.usr -vugen_win 0", AppWinStyle.NormalFocus)
Note: Neither Vugen now the Run Time window will be visible as the script runs in the background, however the results, log files, etc will be still be saved in the usual location.

Sample date conversion program using vugen scripting in Load runner

//Main Function
Action()
{
char *ConvDate;

//Call date conversion function
dateConv("10/JUL/2009", ConvDate);
lr_output_message("date is %s",ConvDate);
return 0;
}

//Date conversion function
dateConv(char *MyDate, char *ReqDate)
{
lr_save_var(MyDate,2,0,"Date");
lr_save_var(MyDate+3,3,0,"pMonth");

lr_output_message("Month is %s",lr_eval_string("{pMonth}"));

if(strcmp(lr_eval_string("{pMonth}"),"JAN")==0)
lr_save_string("01","Month");
/*  Similar rest of the code goes here....*/
else if(strcmp(lr_eval_string("{pMonth}"),"DEC")==0)
lr_save_string("12","Month");

lr_save_var(MyDate+7,4,0,"Year");

ReqDate = lr_eval_string("{Month}/{Date}/{Year}");
lr_output_message("date is %s",ReqDate);

return 0;
}

Bugzilla interview questions?

What is Bugzilla?Bugzilla is a bug tracking system developed at mozilla.org.

How do enter a bug in Bugzilla?To enter a bug, through "Enter a new bug" link from the main Bugzilla page. This will take you to a product selection screen.

What happens once enter a bug?After you enter a bug, mail is sent both to you and the QA department. A member of the QA department will verify that they can reproduce your bug.

How do search a bug?To search a bug, through "Query" link from the main Bugzilla page.

How do submit a patch?The new Bugzilla system supports the attachment of patches, test cases, and various other forms of file types directly from the bug report screen. Just click on "Create an attachment"

Are cookies required in Bugzilla?Yes.

How can you view your assigned bugs?We can view the assigned bugs though “My Bugs” link.

How can you generate bug report?We can generate bug report through “Report” link.

When Bugzilla was released?Bugzilla was released in 1998.

Which language was written Bugzilla first time?Bugzilla was originally written in "TCL".

Who developed the Bugzilla?Terry Weissman

Which language Bugzilla written?"Perl"

What are the Bugzilla fields?Bugzilla have 11 fields like-
(1)Product
(2)Component
(3)Version
(4)Platform
(5)OS
(6)Priority
(7)Severity
(8)Assigned To
(9)URL
(10)Summary
(11)Description
How can you edit your account in Bugzilla?We can use "User Preferences" link.

How can you add new Product in Bugzilla?We can use "Product" link for adding new product.

How can you add Components of product in Bugzilla?We can use "Components" link for adding components in Bugzilla.

How can edit version of any product in Bugzilla?We can use "Edit Versions" link

"Memory violation error "in Load Runner

Reasons for this:
  1. C pointer errors,C programming invalid declarations
  2. Memory full
  3. Not enough Memory for what you need to place in a defined space
  4. Memory not yet allocated before attempting to use it
  5. Memory allocated but not deallocated
  6. Trying to copy a non pointer version of a datatype to a pointer defined version of a datatype, such as copying a character array to a pointer to a character array
  7. Generally unless you have a hardware issue this is a developer error

How to verify the Vusers or Monitors that are currently licensed in load runner

How to verify license related information like Expiration dates, monitors purchased, and the number and type of Vusers.

For LoadRunner7.0 – 7.8 Feature Pack1:
a. Bring up the Controller and go to Help - About LoadRunner
b. Click on ‘License Info…’ and you will see the License Information.


For LoadRunner8.0:
a. Go to Start - Programs - LoadRunner - LoadRunner
b. Click on the ‘License’ menu and you will see the ‘Host ID’ on the screen.