I have a CSV file that passes the values of http request parameters. It works as desired except for the field that is a date value. It fails not recognizing it as a date. Now I can type it in ex. 2019-04-05 or assign it to a user define variable ex. MyDate = ${_time(date format)} or myDate = 2019-04-05 that works. Any ideas?
I have searched but can't find the right solution for this scenario. Appreciate any help.
Related
I'm working with a date selector, and I'm trying for my UFT script to pick an appointment date 3 days from today's date. I have set up that value specifically to match the property value format in the HTML code:
14
My question is: How can I instruct UFT to look for a property value by matching whatever is in the "aria-label" property with the value that I have defined in my data table?
Also, I noticed that the 'Tab index' is -1, not sure if that has anything to do
Much appreciated
I have the following code, but UFT does not recognize it "strAppointmentDate" is the cell in the data table where I defined the desired date:
iDate= strAppointmentDate
Set dd = Browser("Browser").Page("Select Appointment").WebButton("aria-label:=" &iDate, "html tag:=td", "index:=-1")
Instead of "aria-label" try "attribute/aria-label".
Is there a way to set the Parameter Values in the Cache Refresh Plan window to use the previous Sunday? The field is a Date/Time field and will not let me enter code such as =DateAdd(DateInterval.Day, -7,DateAdd(DateInterval.Day, 1-Weekday(today),Today)). It is looking for date format. Thanks in advance
I'm unaware of any parameter caching options. However, you should be able to get a default value to work. Perhaps the expression below will work.
=DateAdd(dd,1- DatePart(dw, CDate(Today())), CDate(Today()))
If you still can't get it to work, another option would be to add a data set that spits out the value. You could use something like:
SELECT DATEADD(dd,1- DATEPART(dw, CAST(GETDATE() AS DATE)), CAST(GETDATE() AS DATE))
I have created a Test plan in which there is date and time being passed in the parameters...I need to change the parameters dynamically so that when I run the test plan a new date and time is generated....the parameters look like this:
Name. Value
request : 2018-04-08 22:13:51
What should I do?
You can use __time function
The time function returns the current time in various formats.
Enter your format as the first paramater yyyy-MM-dd hh:mm:ss
Enter your variable name as second parameter:
${__time(yyyy-MM-dd hh:mm:ss, Value)}
I have CSV (Users.CSV)which contains 10000 Username, Firstname,LastName and Email ID which are unique. In one of the POST request in my test plan, I need to pass date. I can POST data only once for same date. How i can handle this using CSV or any other way?
I can think of two options:
1. Drag same date for all the 10000 entry in same Users.CSV. And then Copy paste Username, Firstname,LastName and Email ID again in same CSV and then drag next date.
2. Maintain two CSV files, One for Users and one for Date. Date.csv will have 10000 entries for same date and after 10001 will contains next date.
On both the solutions i will need to maintain sample count as i will need to delete those many entries from CSV for the next run.
Can someone please share any better option to achieve this?
Use __time() function to generate the current date (or combine it with __longSum() function if you need past/future timestamps)
By default __time() function returns current time in milliseconds since beginning of Unix epoch, however you can control the format using SimpleDateFormat patterns.
See How to Use JMeter Functions posts series for more information on above two and other JMeter functions
You can use two compoenent to resolve this issue:-
User Defined Variables
BeanShell-PreProcessor
Step 1: Define a vraible in script using user definded variables to keep counter of date, so that same date should not be used aagain while making that particular POST request.
Step 2: Use variable defined in step 1, and write script to get unique date in pre-processor. This pre-processor should be added as child to that particular POST request.
sample code for pre-processor:-
import java.text.SimpleDateFormat;
import java.util.Date;
int dateCounter=Integer.parseInt(vars.get("dateCounter"));
Date currentDate = new Date();
SimpleDateFormat date = new SimpleDateFormat("dd/MMM/yyyy");
long milliseconds = (long) dateCounter * 24 * 60 * 60 * 1000;
Date previousDate = new Date(currentDate.getTime() - milliseconds);
String strDate = date.format(previousDate);
vars.put("date",strDate);
dateCounter = dateCounter - 1;
vars.put("dateCounter",Integer.toString(dateCounter));
Note that we are using last 1000 days in the example, you can make changes as per your need. Now this date -a Jmeter variable can be used through out the thread group and once you generate a date using that partilculare POST sampler, a new date would be generated for next request.
We have a requirement where date time values would be passed to the report parameter which is of "String" date type (and not "DateTime"). The report parameter would be a queried one i.e. it would have a list of values in which the passed value should fall in.
The strange part is that if the date time value passed to this parameter is passed in this format mm/dd/yyyy hh:mm:ss AM/PM then only it succeeds otherwise a error is displayed (If month/date/hour/minute/second is having a single digit value then we need to pass single digit value to parameter as well).
Assuming that the report server picks this format from the "regional settings" in control panel, we tried modifying the date & time formats as yyyy-mm-dd & HH:mm:ss but the outcome was the same.
On researching more I found some suggestions specifying to change the language property in the rdl (I was not able to figure out how) but this would not be the solution I am looking for. I also found another topic here but it didn't provide the solution we are looking for.
I need to understand if this format is controlled at the report server level & is it configurable. It would be great if someone can provide some guidance.
Thanks.
Format(,"mm/dd/yyyy hh:mm:ss AM/PM ")
Then it doesn't matter what the regional settings are.