if possible ,please post sample logic. one condition should follow your logic ,that 2 condition should check some text.
example :-
${__groovy("${textcheck1}".indexOf("Message") == -1 && ("${textcheck2}".indexOf("Message1") == -1,))}
In Groovy String provides contains() function so it worth considering re-writing your code to use contains instead of indexOf, it will be more readable.
With regards to "posting sample logic" we don't know what you're trying to achieve with these conditions, see Logical Operators user manual chapter for more information.
You can also check The Groovy Templates Cheat Sheet for JMeter article for some useful Groovy hints related to JMeter
Related
What is the programming language in REDCap for data quality checks and branching logic.
So far it's a bit hard to find the correct operators by trial and error.
It would be nice to know where to look for.
yesterday I programmed a data quality check which reads
([variable1] <> "" && [variable2] = "1")
It says that variable 1 should not be empty and variable 2 is also marked.
The code works, but it is though to find out how if I don't know the underlying language and the valid operators
Information on the syntax and available operators and functions for data quality rule logic, branching logic, report filter logic, calculation expressions within REDCap is documented within REDCap itself on the "Help & FAQ" page. You can access that page either using the link towards the bottom of the left-hand menu column of a project page, or from the top nav bar of a non-project page (like My Projects).
In your check you should use and rather than &&:
[variable1]<>'' and [variable2]='1'
I am new to JavaScript testing. I want to know how to write test cases for scenarios like the name field should not contain any number or the one other example I asked above.
Are there any good practices to follow?
You can follow the link below to get some examples. I normally follow this link while writing the test scripts.
https://www.chaijs.com/guide/styles/#expect
I'm currently working with JMeter in order to stress test one of our systems before release. Through this, I need to simulate users clicking links on the webpage presented to them. I've decided to extract theese links with an XPath Post-Processor.
Here's my problem:
I have an a XPath expression that looks something like this:
//div[#data-attrib="foo"]//a//#href
However I need to extract a specific child for each thread (user). I want to do something like this:
//div[#data-attrib="foo"]//a[position()=n]//#href
(n being the current index)
My question:
Is there a way to make this query work, so that I'm able to extract a new index of the expression for each thread?
Also, as I mentioned, I'm using JMeter. JMeter creates a variable for each of the resulting nodes, of an XPath query. However it names them as "VarName_n", and doesn't store them as a traditional array. Does anyone know how I can dynamicaly pick one of theese variables, if possible? This would also solve my problem.
Thanks in advance :)
EDIT:
Nested variables are apparently not supported, so in order to dynamically refer to variables that are named "VarName_1", VarName_2" and so forth, this can be used:
${__BeanShell(vars.get("VarName_${n}"))}
Where "n" is an integer. So if n == 1, this will get the value of the variable named "VarName_1".
If the "n" integer changes during a single thread, the ForEach controller is designed specifically for this purpose.
For the first question -- use:
(//div[#data-attrib="foo"]//a)[position()=$n]/#href
where $n must be substituted with a specific integer.
Here we also assume that //div[#data-attrib="foo"] selects a single div element.
Do note that the XPath pseudo-operator // typically result in very slow evaluation (a complete sub-tree is searched) and also in other confusing problems ( this is why the brackets are needed in the above expression).
It is recommended to avoid using // whenever the structure of the document is known and a complete, concrete path can be specified.
As for the second question, it is not clear. Please, provide an example.
I have a readonly xml file and I have a set of xpath values.
I need to create a function which would take in the xpath and return the value(s) corresponding to the xpath.
I am a little confused regarding what would be the best way to proceed. The options I am thinking are using the regular XPathDocument/Navigator/Iterator classes or using LINQ to xml.
The function I am trying to implement is:
T GetString(string inputXpath) where T could be bool/string/array etc.
Can someone help?Also, this function is going to be called all across the application, so performance might be a consideration.
Thank you!
-Agent
What you want to write will just return:
XpathNavigator.Evaluate(inputXpath);
Obviously, T must be just... object :)
Read the XpathNavigator.Evaluate() documentation here.
It's hard for me to grasp what a rewrite is actually doing. I would like to setup some rules and then be able to throw tests at it and step through it like a debugger.
As far as I'm aware, there isn't a tool that would let you do that, however, there's a few things you could use that have been helping me a lot.
We all know rewrites are all about regular expressions, and being able to write them properly is a MUST.
Helicon Tech has a tool called Regular Expression Test Utility (in the bottom of the page). it's really good for writing your rules and evaluating them. It will let you use rewrite commands, and will tell you if there are matches, or errors with your evaluations.
Also, as a second tools (for quick regexps), i use a tool called regexr by gskiner. it's available as an online version, or my favourite desktop version. It won't check rewrite evaluations, but will let you write your regular expressions, and highlight the results, so when for example I want to redirect a user that hits the page:
http://www.website.co.uk/blog/index.cfm?article=1
with
http://www.website.co.uk/blog/article/1
I simply use it to test my matches as such:
alt text http://img13.imageshack.us/img13/5608/exampleyo.jpg
Hope this help you