{"id":57750,"date":"2017-07-04T16:42:44","date_gmt":"2017-07-04T11:12:44","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?p=57750"},"modified":"2024-04-12T14:20:36","modified_gmt":"2024-04-12T08:50:36","slug":"jmeter-properties-and-variables","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/","title":{"rendered":"Properties and Variables"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a ref=\"magnificPopup\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"400\" src=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\" alt=\"Properties and Variables\" class=\"wp-image-96108\" srcset=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png 750w, https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1-300x160.png 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/a><\/figure><\/div>\n\n\n<p><strong>Properties and Variables-<\/strong> <span lang=\"EN-US\">JMeter properties are defined in JMeter.properties (see Getting Started &#8211; Configuring JMeter for more details). <\/span><span lang=\"EN-US\">Properties are global to JMeter and are mostly used to define some of the defaults JMeter uses. For example, the property remote_hosts defines the servers that JMeter will try to run remotely. Properties can be referenced in test plans &#8211; see functions &#8211; read a property &#8211; but cannot be used for thread-specific values.<\/span><\/p>\n<p class=\"VSKILLbodytext\"><span lang=\"EN-US\">JMeter variables are local to each thread. The values may be the same for each thread, or they may be different. <\/span><\/p>\n<p class=\"VSKILLbodytext\"><span lang=\"EN-US\">If a variable is updated by a thread, only the thread copy of the variable is changed. For example the Regular Expression Extractor Post-Processor will set its variables according to the sample that its thread has read, and these can be used later by the same thread. For details of how to reference variables and functions, see Functions and Variables<\/span><\/p>\n<p class=\"VSKILLbodytext\"><span lang=\"EN-US\">Note that the values defined by the Test Plan and the User Defined Variablesconfiguration element are made available to the whole test plan at startup. If the same variable is defined by multiple UDV elements, then the last one takes effect. Once a thread has started, the initial set of variables is copied to each thread. Other elements such as the User Parameters Pre-Processor or Regular Expression Extractor Post-Processor may be used to redefine the same variables (or create new ones). These redefinitions only apply to the current thread.<\/span><\/p>\n<p class=\"VSKILLbodytext\"><span lang=\"EN-US\">The setProperty function can be used to define a JMeter property. These are global to the test plan, so can be used to pass information between threads &#8211; should that be needed. <\/span><span lang=\"EN-US\">Both variables and properties are case-sensitive.\u00a0<\/span><\/p>\n<h5><strong>Using Variables to parameterize tests<\/strong><\/h5>\n<p>Variables don&#8217;t have to vary &#8211; they can be defined once, and if left alone, will not change value. So you can use them as short-hand for expressions that appear frequently in a test plan. Or for items that are constant during a run, but which may vary between runs. For example, the name of a host, or the number of threads in a thread group.<\/p>\n<p>When deciding how to structure a Test Plan, make a note of which items are constant for the run, but which may change between runs. Decide on some variable names for these &#8211; perhaps use a naming convention such as prefixing them with C_ or K_ or using uppercase only to distinguish them from variables that need to change during the test. Also consider which items need to be local to a thread &#8211; for example, counters or values extracted with the Regular Expression Post-Processor. You may wish to use a different naming convention for these.<\/p>\n<p>For example, you might define the following on the Test Plan:<\/p>\n<p>HOST\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 www.example.com<\/p>\n<p>THREADS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10<\/p>\n<p>LOOPS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 20<\/p>\n<p>You can refer to these in the test plan as ${HOST} ${THREADS} etc. If you later want to change the host, just change the value of the HOST variable. This works fine for small numbers of tests, but becomes tedious when testing lots of different combinations. One solution is to use a property to define the value of the variables, for example:<\/p>\n<p>HOST\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ${__P(host,www.example.com)}<\/p>\n<p>THREADS\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ${__P(threads,10)}<\/p>\n<p>LOOPS\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0${__P(loops,20)}<\/p>\n<p>You can then change some or all of the values on the command-line as follows:<\/p>\n<p>jmeter &#8230; -Jhost=www3.example.org -Jloops=13<\/p>\n<p><strong>Test Your Software Testing Skills By Taking Our JMeter Practice Tests On This <a href=\"https:\/\/www.vskills.in\/practice\/quiz\/Jmeter\">Link<\/a><\/strong><\/p>\n<p><em><strong>Become Vskills Certified JMeter Tester. Gain some knowledge on the module &#8220;Properties and Variables&#8221;. Try the free practice test!<\/strong><\/em><\/p>\n<p><strong>Apply For <a href=\"https:\/\/www.vskills.in\/certification\/testing\/jmeter-tester-certification\">JMeter Certification<\/a><\/strong><\/p>\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.vskills.in\/practice\/jmeter\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"150\" src=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-4A0-102_-Nokia-Border-Gateway-Protocol-14-1.png\" alt=\"\" class=\"wp-image-95995\" srcset=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-4A0-102_-Nokia-Border-Gateway-Protocol-14-1.png 961w, https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-4A0-102_-Nokia-Border-Gateway-Protocol-14-1-300x47.png 300w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/a><\/figure><\/div>\n\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-tester-certification\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to Tutorial<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Properties and Variables- JMeter properties are defined in JMeter.properties (see Getting Started &#8211; Configuring JMeter for more details). Properties are global to JMeter and are mostly used to define some of the defaults JMeter uses. For example, the property remote_hosts defines the servers that JMeter will try to run remotely. Properties can be referenced in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[126],"tags":[7163],"class_list":["post-57750","page","type-page","status-publish","hentry","category-software-testing","tag-jmeter"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JMeter Tutorial | Properties and Variables<\/title>\n<meta name=\"description\" content=\"Become Vskills Certified JMeter Tester. Gain some knowledge on the module &quot;Properties and Variables&quot;. Try the free practice test! Click Here!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JMeter Tutorial | Properties and Variables\" \/>\n<meta property=\"og:description\" content=\"Become Vskills Certified JMeter Tester. Gain some knowledge on the module &quot;Properties and Variables&quot;. Try the free practice test! Click Here!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:50:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/\",\"name\":\"JMeter Tutorial | Properties and Variables\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\",\"datePublished\":\"2017-07-04T11:12:44+00:00\",\"dateModified\":\"2024-04-12T08:50:36+00:00\",\"description\":\"Become Vskills Certified JMeter Tester. Gain some knowledge on the module \\\"Properties and Variables\\\". Try the free practice test! Click Here!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png\",\"width\":750,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Properties and Variables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JMeter Tutorial | Properties and Variables","description":"Become Vskills Certified JMeter Tester. Gain some knowledge on the module \"Properties and Variables\". Try the free practice test! Click Here!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/","og_locale":"en_US","og_type":"article","og_title":"JMeter Tutorial | Properties and Variables","og_description":"Become Vskills Certified JMeter Tester. Gain some knowledge on the module \"Properties and Variables\". Try the free practice test! Click Here!","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:50:36+00:00","og_image":[{"url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/","name":"JMeter Tutorial | Properties and Variables","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png","datePublished":"2017-07-04T11:12:44+00:00","dateModified":"2024-04-12T08:50:36+00:00","description":"Become Vskills Certified JMeter Tester. Gain some knowledge on the module \"Properties and Variables\". Try the free practice test! Click Here!","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#primaryimage","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2020\/12\/Exam-MB-210_-Microsoft-Dynamics-365-Sales-7-1.png","width":750,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/jmeter-properties-and-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Properties and Variables"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/57750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=57750"}],"version-history":[{"count":5,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/57750\/revisions"}],"predecessor-version":[{"id":96112,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/57750\/revisions\/96112"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=57750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=57750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=57750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}