Automated VB script to check the web application status and send mail to stakeholders when app is down

 VB script code:

Dim waittime : waittime = 60000

do

Set objOutlook = CreateObject("Outlook.Application")

set objMail = objOutlook.CreateItem(0)

Dim strWebsite

strWebsite = "vnothperformancetesting.blogspot.com"

MailSubject = "Application Status on" & " " & Now & " is down"

If PingSite( strWebsite ) Then

    WScript.Echo "Application" & strWebsite & " is up and running!"

Else

    WScript.Echo "Application" & strWebsite & " is down!!!"

objMail.Display

objMail.To = "katXXXu@gmail.com"

ObjMail.Recipients.Add("katXXXu@gmail.com")

objMail.cc = "katXXXu@gmail.com"

objMail.Subject = MailSubject

objMail.Body = "Hi, Ping status to application shows that application is Down!. Pls look into it."

objMail.Send

objOutlook.Quit

set objMail = Nothing

Set objOutlook = Nothing

End If

WScript.Sleep(waittime)

loop

Function PingSite( myWebsite )

    Dim intStatus, objHTTP

    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )

    objHTTP.Open "GET", "http://" & myWebsite & "/", False

    objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"

On Error Resume Next

objHTTP.Send

intStatus = objHTTP.Status

On Error Goto 0

If intStatus = 200 Then

PingSite = True

Else

PingSite = False

End If

Set objHTTP = Nothing

End Function

Blazemeter execution failing with "Test Configuration Error"

Error: 

On running a Blazemeter test, test got stopped with the below error message in the screenshot.


On checking the bzt.log file, the following error message was seen in the log 

Aug 17, 2022, 4:44:04 AM[system][r-v4-62fca9eab948b393945869]File /tmp/artifacts/taurus-base-config.yml not found on disk

Solution:

Check the length of the Jmeter script / .jmx script file name and reduce it. 

Example: If the current file name is "01_Scenario_01_Tab_Navigation_All_Dashboard.jmx", then reduce the length of the file name "01_Scenario_Tab_Nav_Dshbrd.jmx"

Replace a part of the string in Jmeter

 There will be instances where we will have to replace a part of the correlation string and pass it on to subsequent request in Jmeter. This can be achieved in 2 methods. 

Actual Correlation Output: C_SID = Hello&#x2dWorld

Expected Correlation Output: C_SID_R = Hello-World

Method 1: Using the existing "__strReplace" function from "Custom JMeter Functions" Plugin.

Install the "Custom JMeter Functions" Plugin from plugins manager and restart the Jmeter.

Syntax: ${__strReplace(InputString,To Be Replaced,To Replace,OutputString)

Code : ${__strReplace(${C_SID},&#x2d,-,C_SID_R)



Method 2: Using a Beanshell sampler

Code:

String a = vars.get("C_SID");

String b = a.replaceAll("&#x2d", "-");

vars.put("C_SID_R",b);