how-to-use-future-or-past-date-in-jmeter-without-any-code

Jmeter is one of the most popular open source load testing tool. Jmeter itself has some of the built in functions which we need regularly while creating script like.

  • Base encoding
  • Generating time in different formats
  • Url encode
  • Url decode
  • Random String
  • Random Number
  • UUID
  • Random Date
  • File to string
  • CSV Reader
  • timeshift

In some scenarios we need to use future date to complete the flow like example when user trying to book a flight or placing food order user need to choose future time whether it may be in minutes or hour or even days

In jmeter we have a function name __timeShift  which will allow use to create future date in any format.

 

Go To Function Helper Dialogue option is changed in latest version of jmeter

 

Then select __timeShift  function like below

in  First row we need to mention which Format we need like below.

dd-MM-yyyy hh:mm:ss 

For more Patterns info

Letter for Pattern Date or Time component Examples
G Era designator AD
y Year 2019(yyyy),19(yy)
M Month in year July(MMMM), Jul(MMM), 07(MM)
w Results in week in year 30
W Results in week in month 2
D Gives the day count in the year 266
d Day of the month 09(dd), 9(d)
F Day of the week in month 4
E Day name in the week Monday, mon
u Day number of week where 1 represents Monday, 2 represents Tuesday and so on 2
a AM or PM marker AM
H Hour in the day (0-23) 12
k Hour in the day (1-24) 23
K Hour in am/pm for 12 hour format (0-11) 0
h Hour in am/pm for 12 hour format (1-12) 12
m Minute in the hour 16
s Second in the minute 20
S Millisecond in the minute 560
z Timezone Indian Standard Time; IST; GMT-05:30
Z Timezone offset in hours (RFC pattern) -0800
X Timezone offset in ISO format -08; -0800; -08:00

In second row from which date you want to change by default it will be current timestamp if we need we can give another time

In third row need to time shift duration whether it can be in minutes,  seconds, hours ,days,

Examples :

  • PT15M parses as 15 minutes( adds 15 Minutes for given time in second row )
  • PT10H parses as 10 hours(Adds 10  Hours  for given time)
  • P2D parses as 2 days(adds 2 days  for given date in Second row)
  • -P6H3M parses as -6 hours and -3 minutes(subtracts  6 hours 3 minutes from given date in second row )

H  : H stands for hours

M : M Stands for Minutes

S  : S  Stands for Seconds

D  : D Stands for Days

P  : P stands for Adding

-P : Stands for Subtracting

In Fourth row we can save the create Date into variable.

 

 

how-to-get-all-Soap-request-from-wsdl-file-using-java

In this tutorial will see how to get all SOAP Operations/Requests using WSDL file

Create Simple maven project and add below PluginRepositories your pom

Next Add Below repository to your POM

Then add the dependency

Create Java Class with name SoapServicesRequests and add  below code

 

how-to-get-all-jsonpaths-from-json

In this tutorial will see code to get all json paths from a json object

json path expression is used to extract the value from json object

Add below dependency to your project

then Create Class with JSONPathmain  class name then use below code

Next Create Another class with name JsonParser  and use below code

Change your JSON Object in JSONPathmain  class  and run java class to see the output

how-to-get-all-xpaths-from-xml-content-using-java

This tutorial will help you in getting xpath of all the values of your xml content using java

Create a project using maven or gradle or ant or general java project in this tutorial creating project in maven

Step -1

  • Right click on Package explorer New –> Other like below

  • Search for maven in search box & select maven Project

  • Select Maven Project

  • Check the Create a simple project

  • Add your gorupid , Artifact And click Finish
  • Add below class into your package

 

Run the above file to get all xpaths of xml

 

Thanks

 

How to Reinstall Trail Software After Trial Period has Expired

Generally most of the useful software’s are more expensive to purchase its license. But the good thing is Software owners will give us trail version to use the tool. Some software’s tool will show you trail versions has expired even after multiple time you have uninstalled and installed again.

This post will tell you how install software again as a new installation to use the software

in my machine I want to reinstall SQL Yog

After uninstalling your required software follow below steps

  • Delete complete installation folder from your machine
  • Windows + R to open run window
  • Type  %appdata% as shown below

            

  • see if your software name still exist in Appdata folder as shown below( if still exists remove complete folder).

  •  repeat same steps if you have multiple use logins in your machine
  • Now open windows + R to open run window
  • Type Regedit  in run window as below
  • You will seeing like this below

 

  • Then expand the HKEY_CURRENT_USER  you will be seeing the software menu

  • HKEY_CURRENT_USER –> Software –>software name
  • Expand software and look for the software  name you have uninstalled from your machine like below

  • To delete the registry, Right click on selected software for options
  • From list options select Delete option
  • delete your software same  if exists  from HKEY_LOCAL_MACHINE –> SOFTWARE &  HKEY_LOCAL_MACHINE–>SOFTWARE–>WOW6432node
  • restart machine and  try to re install your software

 

Hope You like it.

 

decode-JWT-token-in-Jmeter

This tutorial will help you in decoding JWT token and sent by server to client.

First how to identify the string is JWT token or some other String generated by Server.

  • If the string is JWT then string should contain 3 dots (header,body,Signature).

Recently most of the applications are using JWT for adding security to their application.

lets assume generated Jwt Token is like below

Create a beanshell sampler with below code

in above bean shell sampler.

  • first getting the jwt token into bean shell sampler.
  • then splitting the string with .(dot). JWT will having 3 sections (header,body,Signature).
  • taking the first index of created array(if you want to decode the header section then change the index from 1 to zero in bean shell sampler ).
  • replacing all _ values with slash(/).
  • doing base 64 decode and adding it to jmeter variables.

executed the bean shell sampler and below is the decoded response is below

if you want to capture values from JWT token the add json path extractor to decoded variable from beanshell sampler.

 

 

how to create json web token (jwt) using java

In this tutorial we will see how we gonna create json web token using java

What is JWT ?

JSON Web Token is string in encrypted format. After the decryption of the JWT String will have json information.

JWT is generally used for session validations and to pass user information to client side in secure way. every time when a user access the pages server will send a JWT token. which is used JWT token is used for user authentication at server side.

what is the JWT Structure

 

we can create JWT token using different programming languages. it is independent of programming language.

 

How to Create JWT token in java.

 

Create a simple maven project. add below dependency

Below is the Code to generate the JWT token

in above code we are creating the JWT token for Map object with subject as json web token. generated jwt token is using SignatureAlgorithm.HS512.  we can use the different algorithms by referring api.

below are all available algorithms

Created token will be looks like below

 

For Decoding the JWT Token below is the code

Jwstoken  is the token generated and sent to client.

below is the complete class for encoding and decoding of JWT

 

 

Note: For decoding JWT Token setSigningKey should be same as the Key used for encoding

 

Happy Coding

rename-update-json-field-keys-in-mongo-document

In this tutorial will see how to modify/rename  json keys without deleting/Modifying the Json Object for respective key.

I have an document shown below

Now I want to update the key “key1” to “key” in “json1” object  without delete or re adding the document.

with the help of dotted notation we are telling Mongo DB to update particular node with specific key should be updated or modify with name we want. below is the Query

from above Query we are mentioning object in “json1” with key “key1” need to be rename with “key” by using dot notation.

in the Query we have mentioned multi:true we are telling mongo db to update multiple records which are matching with the same pattern “json1.key1” from all documents

 

After executing the Query below is the output.

 

 

 

reset-password-wordpress-admin-from-backend

This Tutorial will help you in resetting password of your word press users from backend.

Go to SQL Editor and execute the below command to create MD5 encryption password

Copy result of the above command which we need to update in users table of word press

 

Browse to the wordpress installation directory you can see the file name as wp-config.php which hold you wordpress database user,password,Database name

by using this credentials connect to database using any mysql client. you will have a table name ends with users  copy the table name

in my case table name is wo_users as shown in screen shot

execute the below select command to see the all users and to get id of user to reset password.

select the user id as shown below

get the User Id as highlighted above and execute the update command to reset password

 

in my case Query will be

commit the changes and try with new password. you should able to login into word press admin

 

 

Creating-ssl-Certificate-and-Downloading-from-Godaddy-installing-on-apache

This tutorial will help you only when you have already purchased Certificate in godaddy and want to install it in another hosting providers.

First login into hosting machine using ssh and execute the below command to create CSR Token (Certificate Signing Request)

In above command replace mydomain your domain for example if my domain is taskincomplete.com  then my command will be like below

after executing the command in the current directory from where you have executed the command you should find the two files with mydomain.key and mydomain.csr. If you don’t files execute the below command to see all list of files in current directory

edit the .csr file with notepad or other editors with winscp. Copy the complete .CSR paste it in csr window in godaddy

as show below screen shots

Click on Revoke & manage Icon. next paste the generated csr text area as shown below

 

After adding the Content from CSR file click on Save button. Within 15 to 20 mins you will be getting an email as your certificate verification has completed.

 

 

you can download the Certificates by clicking on Download icon from screen shown below

 

while Downloading godaddy will show option for what server we are going to install certificate. In downloaded zip you will be getting two files one is bundle crt file and actual Certificate file Copy the files to hosting server.

 

add key and certificate to apache ssl configuration like below

below two line has to be modified in ssl conf file

before adding this files make sure mod_ssl module is enable in http.conf file

 

 

Happy Coding