foreach controller printing only default value in jmeter - foreach

I am new to jmeter. I want to do performance testing. My problem is when I mpassing value from one http req to another http request which is in foreach in controller that request running for default value only it's not picking regex values.I m using jmeter 2.13
here is my regular expression extractor
ref name=names
regex=(dentist|ortho|cardio)
template=$1$
match no=-1
default=none
**first http req**
IP-localhost port=8080
path=JmeterJson/speciality
**second req**
IP-localhost port=8080
path=JmeterJson/names?speciality={names}
FOREACH CONTROLLER
I/P name=names
o/p name=name

You should have the following variables in order to make ForEach Controller work:
names_1=dentist
names_2=ortho
names_3=cardio
Use Debug Sampler and View Results Tree listener combination to check it.
Evidence:
Example Test Plan:
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1455215406000</longProp>
<longProp name="ThreadGroup.end_time">1455215406000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true">
<stringProp name="BeanShellSampler.query">return "dentist ortho cardio"</stringProp>
<stringProp name="BeanShellSampler.filename"></stringProp>
<stringProp name="BeanShellSampler.parameters"></stringProp>
<boolProp name="BeanShellSampler.resetInterpreter">false</boolProp>
</BeanShellSampler>
<hashTree>
<RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="Regular Expression Extractor" enabled="true">
<stringProp name="RegexExtractor.useHeaders">false</stringProp>
<stringProp name="RegexExtractor.refname">names</stringProp>
<stringProp name="RegexExtractor.regex">(dentist|ortho|cardio)</stringProp>
<stringProp name="RegexExtractor.template">$1$</stringProp>
<stringProp name="RegexExtractor.default"></stringProp>
<stringProp name="RegexExtractor.match_number">-1</stringProp>
</RegexExtractor>
<hashTree/>
</hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
<ForeachController guiclass="ForeachControlPanel" testclass="ForeachController" testname="ForEach Controller" enabled="true">
<stringProp name="ForeachController.inputVal">names</stringProp>
<stringProp name="ForeachController.returnVal">name</stringProp>
<boolProp name="ForeachController.useSeparator">true</boolProp>
</ForeachController>
<hashTree>
<BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="${name}" enabled="true">
<stringProp name="BeanShellSampler.query"></stringProp>
<stringProp name="BeanShellSampler.filename"></stringProp>
<stringProp name="BeanShellSampler.parameters"></stringProp>
<boolProp name="BeanShellSampler.resetInterpreter">false</boolProp>
</BeanShellSampler>
<hashTree/>
</hashTree>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<threadCounts>true</threadCounts>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
Reference material: How to debug your Apache JMeter script

Related

HTTP Error 500.52 - URL Rewrite Module Error on Docker

I'm trying to rewrite all my URL's to HTTPS but getting this error, not sure what am I doing wrong:
Config Error
This configuration section cannot be used at this path. This happens
when the section is locked at a parent level. Locking is either by
default (overrideModeDefault="Deny"), or set explicitly by a location
tag with overrideMode="Deny" or the legacy allowOverride="false".
web.config:
<rewrite>
<allowedServerVariables>
<add name="HTTPS" />
<add name="X-FORWARDED-PROTO" />
</allowedServerVariables>
<rules>
<rule name="HTTPS_AlwaysOn" patternSyntax="Wildcard">
<match url="*" />
<serverVariables>
<set name="HTTPS" value="on" />
</serverVariables>
<action type="None" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" />
</conditions>
</rule>
</rules>
</rewrite>
I have also installed Rewrite module and ARR on Docker container
# Install Url Rewrite
ADD https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi /install/rewrite_amd64_en-US.msi
RUN msiexec.exe /i c:\install\rewrite_amd64_en-US.msi /passive
ADD https://download.microsoft.com/download/A/D/C/ADC4BAF8-A094-47B5-A6F6-CE4C5ED18BF8/ARRv3_setup_amd64_en-us.EXE /install/ARRv3_setup_amd64_en-us.exe
RUN c:\install\ARRv3_setup_amd64_en-us.exe /Q
Build a normal IIS 10 machine for testing first and you should notice the same error, as that allowedServerVariables cannot be in web.config.
Reference
To enable SSL Rewrite simply add this inside:
<rules>
<rule name="SSL Redirect" enabled="true" stopProcessing="true">
<match url="(.*)"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off"/>
<add input="{HTTP_HOST}" pattern="localhost" negate="true"/>
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>
</rule>
</rules>

Can I prevent remote access to Umbraco back office?

We are running Umbraco 7.4. Due to a corporate security requirement, we need to prevent people from reaching oursite.com/umbraco from anywhere except the server itself as localhost/umbraco. I have tried an IIS rewrite for /umbraco#/ to no avail. I tried an IIS deny rule for /umbraco, but that actually broke some other stuff around our site. Is there some other awesome way to prevent remote access to the Umbraco back office?
I have done a similar thing with IIS rewrite rules where you can only access the back office from a specific set of domains (hence the wildcard matching). You could use this to only allow access from localhost. NOTE, place the rule in the umbraco folder, not the main site web.config. the full web.config contents to place in the umbraco folder is:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Umbraco only from localhost" enabled="true" patternSyntax="Wildcard"
stopProcessing="false">
<match url="*" negate="false" />
<action type="Rewrite" url="/UmbrSubDir404" appendQueryString="false"
logRewrittenUrl="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
<add input="{URL}" pattern="*RestServices/ScheduledPublish*"
negate="true" />
<add input="{URL}" pattern="*umbraco/Api/*" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Can't load Rails application on IIS

I have spent the past few hours trying to deploy my Ruby on Rails app to my Windows Server 2008 R2 vps running IIS 7.5.
I thought it was going well up till the point I got this error when trying to access the site via my browser.
Error Helicon Zoo module has caught up an error.
Please see the details below.
Windows error The system cannot find the path specified. (ERROR CODE: 3)
Internal module error message:
Can't CreateDirectory '' file type: ZooException file: Common\WinApi.cpp
line: 253 version: 3.1.98.538
The log file it's self is even less helpfull:
[13.02.2016 02:47:48.751921] [v 3.1.98.538] [tid 0x000100d4] [sev 2] # 26373856 Application has been started
[13.02.2016 02:47:48.831925] [v 3.1.98.538] [tid 0x000100d4] [sev 2] # 26373856 Application has been terminated
The path of the CreateDirectory bit seems strange to me but can't figure out where it's coming from.
The site runs fine on my local machine, but my local machine is on Fedora so doesn't use web.config files. Unfortunately I'm stuck with my Windows server for the time being so Linux hosting isn't an option at the moment.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<clear />
<application name="ruby.project">
<environmentVariables>
<add name="RAILS_RELATIVE_URL_ROOT" value="%APPL_VIRTUAL_PATH%" />
<add name="DEPLOY_FILE" value="deploy.rb" />
<add name="RACK_ENV" value="development" />
<add name="CONSOLE_URL" value="console" />
</environmentVariables>
</application>
</heliconZoo>
<handlers>
<remove name="ruby.project#x86" />
<remove name="ruby.project#x64" />
<add name="ruby.project#x64" path="*" verb="*" modules="HeliconZoo_x64" scriptProcessor="ruby.2.0.rack" resourceType="Unspecified" requireAccess="Script" preCondition="bitness64" />
<add name="ruby.project#x86" path="*" verb="*" modules="HeliconZoo_x86" scriptProcessor="ruby.2.0.rack" resourceType="Unspecified" requireAccess="Script" preCondition="bitness32" />
</handlers>
<!-- URL Rewrite rules to pass static files, limit console access, etc. -->
<rewrite>
<rules>
<!-- This rule rewrites '/' requests to /public/index.html -->
<rule name="index" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\index.html" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="public/index.html" />
</rule>
<rule name="Static Files" stopProcessing="true">
<match url="^(?!public)(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="public/{R:1}" />
</rule>
<rule name="Rails 3.1 assets" stopProcessing="true">
<match url="^assets/(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}app\assets\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="app/assets/{R:1}" />
</rule>
<!-- This rule shows welcome page when no Rack application exist. -->
<rule name="Rewrite to Zoo index if that's an empty application" stopProcessing="true">
<match url="^/?$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}config.ru" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="public/zoo-index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
Up to this point
Reset website (Multiple times)
Ran deploy.rb (Multiple times)
Played with folder permissions. Even at one point allowing special access to everyone, don't worry I've retracted that now.
Refreshed App pool.
I've search through Google but can't seem to find anything. Does anyone here have any suggestions?
The error can actually be seen here at the moment. https://bonniechef.com/
Hopefully not for much longer...
Sorry Doug, I can no longer provide support for this Web Platform Installer-based version of Zoo as I am working on a new standalone version and these versions have completely different configuration and processing logic. This new version is almost finished and I am finalizing installations and deployment of the whole system, however, I work on this project alone now and support for older products and other issues eats up most of my time. Still considering making it open source, but arranging a good open source project will require even more time and commitment. I expect to make a release within a month. This new version will be supported and actually will be much easier to maintain and more transparent as we will control most aspects of the product.
Sorry for the inconvenience.

Deployment silex: white page

I want to put my first silex project online on a webhost.
Currently the only thing I can see is a white page, and it takes a while before my browser actually finds the page.
My webhost: www.mijnhostingpartner.nl
My current structure:
/root/data
/root/logs
/root/wwwroot
/root/wwwroot/app
/root/wwwroot/src
/root/wwwroot/vendor
/root/wwwroot/web
My web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="Silex Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<clear />
<add value="Default.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="Default.aspx" />
<add value="index.html" />
<add value="index.php" />
<add value="index.asp" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
My index.php:
I found out that the "Require_once" did not work.
Only until echo('test1') works.
"test2" is not shown on the screen.
<?php
// PHP 5.4's built in server can now server static files
// #see http://silex.sensiolabs.org/doc/web_servers.html#php-5-4
$filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
return false;
}
echo('test1');
// Require the app and run it
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'app.php';
echo('test2');
$app->run();
If you get a blank page, check your webserver's error logs. Then enable error_reporting in php.ini if possible. And for silex, make sure you are calling $app->run() in the front controller.
(the latter does not seem to be the issue in your case)

Rewriting server variable in IIS 7.5

I have a rewrite rule, which changes a server variable with the value of a subdomain.
This works on subdomain.mydomain.nl/somethinghere but not on subdomain.mydomain.nl
<rule name="Change code" enabled="true" patternSyntax="ECMAScript" stopProcessing="false">
<match url=".*" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{SERVER_NAME}" pattern="(www\.)?(\w+)\.mydomain\.nl" />
<add input="{SERVER_NAME}" pattern="^www.mydomain.nl.*" negate="true" />
<add input="{SERVER_NAME}" pattern="^mydomain.nl.*" negate="true" />
</conditions>
<serverVariables>
<set name="MYVARIABLE" value="{C:2}" />
</serverVariables>
<action type="None" />
</rule>
I have tested 2 urls:
1: subdomain.mydomain.nl/somethinghere
2: subdomain.mydomain.nl
I retrieve the variable in PHP with the following code:
echo $_SERVER['MYVARIABLE'];
In case of URL 1, the output of this is "subdomain".
In case of URL 2, the output of this is "".
The output of URL 1 is correct, but the output of URL 2 should be "subdomain" too.
I have run a trace of both requests, and they both show that the rule is being matched and executed.
Can anyone help me?
When you set a custom server variable, you should start it with HTTP_. When you add your own header, it should start with HTTP_X_ to add a host header starting with an X.
To be honest, I can't really explain why it works without HTTP_ in some scenarios, but with HTTP_ it works in all scenarios and that's also how it's documented.
<rules>
<rule name="Change code" enabled="true" patternSyntax="ECMAScript" stopProcessing="false">
<match url=".*" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{SERVER_NAME}" pattern="(www\.)?(\w+)\.testsite\.nl" />
<add input="{SERVER_NAME}" pattern="^www\.testsite\.nl$" negate="true" />
<add input="{SERVER_NAME}" pattern="^testsite\.nl$" negate="true" />
</conditions>
<serverVariables>
<set name="HTTP_X_MYVARIABLE" value="{C:2}" />
</serverVariables>
<action type="None" />
</rule>
</rules>
You can now get the subdomain name with echo $_SERVER["HTTP_X_MYVARIABLE"];.
I've also cleaned up your conditional regular expressions to escape the .s and also added a $ to make it truly match the exact domain names.

Resources