Use all rows from the table returned by JDBC request - loops

I use JDBC request for selecting users who log in to the application. The results return correctly but I noticed that HTTP Sampler uses only the first result from the table.
I use also ForEach Controller to avoid getting the column name as a result but don't think that it is related to the issue.
The table contains a few results and I want to use them all one by one for each new log-in.

Have you defined "Variable Names" under JDBC Request sampler? It should be done like this:
This way you will get the following JMeter Variables:
businessId_#=number of rows
businessId_1=value from 1st row
businessId_2=value frmo 2nd row
and this way you will be able to iterate them using ForEach Controller
More information:
JDBC Request sampler documentation
Debugging JDBC Sampler Results in JMeter

Related

How to transform a column into an array using ADF

I need to read a column on a db on ADF and use all it´s values as parameters in a foreach.
I tried reading the column using a dataflow and a cache sink to then in a pipeline use Set Variable and then the foreach...but instead of an array of values I get an array with one value that contains all the others I want (but i cant iterate over)
I am using:
#array(activity('myDataflow').output.runStatus.output.columName
Any help is appreciated, seems simple enough (column to array) but I am stuck
Use a lookup activity to get the data from SQL server, and run for each loop on the output of the lookup.
Example:
Create a new pipeline
Add a lookup activity
Choose your source dataset (in this example, an Azure SQL database)
Remove the checkbox from “First row only”
Choose a table, stored procedure or type in a query
SELECT 1 AS result UNION ALL
SELECT 2 AS result UNION ALL
SELECT 3 AS result UNION ALL
SELECT 4 AS result
Add a foreach activity
In the foreach activity, under settings tab: “Items” -
#activity('Lookup SQL query').output.value – where 'Lookup SQL
query' is the name of the lookup activity
Inside the foreach loop, add a wait activity
In the settings tab, “Wait time in seconds” : #item().result .
item() is the current loop, and result is the name of the SQL column
debug the pipeline. You can see that the foreach activity iterates 4 times, for every row returned from the sql query.
You can use append variable activity also, inside ForEach after lookup.
First create an array variable in the pipeline.
Then use append variable activity inside ForEach and give
#item.<your_column_name>
Result variable stored in a sample variable:
Result:
I tried reading the column using a dataflow and a cache sink to then in a pipeline use Set Variable and then the foreach
If you want to do it with dataflows instead of lookup, use the same above procedure and give the below dynamic content in the ForEach.
#activity('Data flow1').output.runStatus.output.sink1.value

SoapUI how to generate dynamically request password?

I need to generate the password of the request dynamically, because I need to concatenate it with a timestamp and encode the result with SHA-256 to get the actual password.
Is there a way to generate that password to every request?
Where should the script be created to generate the password, and how can it be added to the request or to a variable that is read in the request?
You have full access to the Groovy language in SoapUI. You can do any sort of coding in a Groovy script test step. Then you can store the resulting value in a property:
testRunner.testCase.setPropertyValue("passwordVar", passwdResult)
And in the request XML you parameterize the value to be read from the property:
<passwordNode>${#TestCase#passwordVar}</passwordNode>
The only catch is that you will have to execute the Groovy step before the SOAP request step, but that can be done at test case level, or in a loop in Groovy, depending on your project structure. I usually have a Groovy script that:
does calculations or SQL to get input values
sets properties
calls the SOAP steps
extract required response values from resp XML
in a loop.

How to change the order of the compose connector in logic apps(azure). By default it is asc order

I get the data in a json format, in which i have table details (it has n number of rows and columns ). I want to send a mail and include the row details in the mail body. Right now i am able to send the mail and include the row details. I am using a compose connector to define the required rows. But the output is always in ascending order.(I want to display Message column first and then the Count column, but i always get Count column first and then Message column) I want to customize the output.
I tried using initialize connector but since i am using the for-each loop i can not use Initialize connector. (Initialize connector have to be initialized at top.
Before triggering the logic app
After triggering the logic app
Current output i am getting:
I want to customize the output i.e Message column first and then the count column
This is an expected behaviour that shouldn't have side effects if you stick to the JSON format. It's because JavaScript JSON libraries default to alphabetical ordering of properties.
However if you insist on custom order, you could refer to my answer before create new json object using compose connector. You need create a string with the input you want the compose it or parse it to json.

Microsoft word Database quick part - How to use a mergefield as a filter for the database query

I am using mail merge to input data from an excel sheet. Everthing works great and I can access my variables using «MyMergefield»
Now I need for each letter generated to look into another excel file and do a query that will take the «MyMergefield» as a query filter SELECT FROM x WHERE field1 = «MyMergefield»
The way I am proceeding is "inserting a quick part" => "Field" in my word document.
In the quickpart dialog, I choose "DataBase", then I choose my excel file.
once the data source is chosen, There an option to change the request parameters, I click on it and I get the filter configuration popup where I can choose the field (from the excel sheet), the operator ("equals" in this case). Then there's the compare with field. In my case its not as simple as comparing to as string. Its comparing to a mail merge field.
I tried the following syntax:
«Myfield»
MERGEFIELD Myfield
MERGEFIELD "Myfield"
{MergeField Myfield}
{ MERGEFIELD Myfield}
None worked, it complained that it did not find any match so it did not insert the database (Of course it will not find any match to the syntax if I don't run mail merge)
I did look directly in the openxml file of an existing example (because I can't edit existing quickpart - Correct me if Im wrong) and the database query looked like:
FROM `Candidates$` WHERE ((`column` = '</w:instrText>
...
<w:instrText xml:space="preserve"> MERGEFIELD Myfield</w:instrText>
</w:r>
Any ideas? Thank you!

How to read database (JDBC Request) result into variables in Jmeter

I want to read Database result into variables so I can use it for later requests.
How can i do it?
What if i want to return from database multiple
columns, or even rows? can loop the returned table same way i can
with "CSV Data Set Config"?
--edit--
Ok, i found this solution that uses regular expression to parse the response, but this solution and other like it doesn't work for me, because they require me to change SQL queries so Jmeter could parse them more "easily". I'm using Jmeter to do testing (load testing), and the last thing I want is to maintain 2 different codes, one for "testing" and other for "runtime".
Is there a "specific" JDBC Request solution that enable me to read result into variables using the concept of result-sets and columns?
Using The Regular Expression shouldn't affect what your SQL statement looks like. If you need to modify which part of the response you store in variable, use a Beanshell sampler with java code to parse out the response and store into a variable.
You can loop through the returned table, by using a FOREACH controller, referencing the variable name in the reg ex. Make sure in your reg ex, you set the match value to -1 to capture every possible match.

Resources