Wednesday, 9 January 2019
Sunday, 6 January 2019
Finding characters, numbers and special characters
Given string:
bhojaraju007@gmail.com
Output:
Characters:bhojarajugmailcom
Numbers:007
Spl.Characters:@.
Steps:
----------
First, we find Length of string
Using loop and mid method we find each and every character from given string
Syntax
----------------
Mid(string, Start, Number of characters)
Script
---------------
Dim str,strlen,strstart
Dim temp
Dim numeric, strChar, splChar
str="bhojaraju007@gmail.com"
strlen=Len(str)
For strstart=1 to strlen
temp=Mid(str,strstart,1)
If IsNumeric(temp) Then 'IsNumeric is VB method to get only Numeric values
numeric=numeric+temp
'If Character between A-Z a-z will store in strChar
Elseif ASC(temp)>64 and ASC(temp)<123 Then
strChar=strChar+temp
Else
splChar=splChar+temp 'Else all character(Spl.Charaters will store)
End If
Next
msgbox strChar
msgbox numeric
msgbox splChar
bhojaraju007@gmail.com
Output:
Characters:bhojarajugmailcom
Numbers:007
Spl.Characters:@.
Steps:
----------
First, we find Length of string
Using loop and mid method we find each and every character from given string
Syntax
----------------
Mid(string, Start, Number of characters)
Script
---------------
Dim str,strlen,strstart
Dim temp
Dim numeric, strChar, splChar
str="bhojaraju007@gmail.com"
strlen=Len(str)
For strstart=1 to strlen
temp=Mid(str,strstart,1)
If IsNumeric(temp) Then 'IsNumeric is VB method to get only Numeric values
numeric=numeric+temp
'If Character between A-Z a-z will store in strChar
Elseif ASC(temp)>64 and ASC(temp)<123 Then
strChar=strChar+temp
Else
splChar=splChar+temp 'Else all character(Spl.Charaters will store)
End If
Next
msgbox strChar
msgbox numeric
msgbox splChar
Saturday, 5 January 2019
Difference between Instr and InstrRev
InStrRev:
The InStrRev Function returns the first occurrence of one string within another string. The Search happens from right to Left.
Syntax:
InStrRev(string1,string2[,start[,compare]])
Example:
str = "abcdeabcde"
MsgBox InStrrev(str, "e") ' search from end, , will return 10
InStr:
The InStr Function returns the first occurrence of one string within another string. The search happens from left to right.
Syntax:
InStr([start,]string1,string2[,compare])
Example:
str = "abcdeabcde"
MsgBox InStr(str, "e") ' search from start, will return 5
The InStrRev Function returns the first occurrence of one string within another string. The Search happens from right to Left.
Syntax:
InStrRev(string1,string2[,start[,compare]])
Example:
str = "abcdeabcde"
MsgBox InStrrev(str, "e") ' search from end, , will return 10
InStr:
The InStr Function returns the first occurrence of one string within another string. The search happens from left to right.
Syntax:
InStr([start,]string1,string2[,compare])
Example:
str = "abcdeabcde"
MsgBox InStr(str, "e") ' search from start, will return 5
Finding factorial of a given number
Dim n,f
n=inputbox("enter a number")
f=1
If n<0 Then
msgbox "invalid number"
else if n=0 or n=1 then
msgbox "the factorial of given number is : "& f
else
For i=1 to n
f=f*i
Next
msgbox "the factorial of given number is : "&f
end if
End if
Function
---------------------------
Function Factorial(a)
x=1
For i=1 to a
x=x*i
next
Factorial=x
End Function
Msgbox Factorial(5)
n=inputbox("enter a number")
f=1
If n<0 Then
msgbox "invalid number"
else if n=0 or n=1 then
msgbox "the factorial of given number is : "& f
else
For i=1 to n
f=f*i
Next
msgbox "the factorial of given number is : "&f
end if
End if
Function
---------------------------
Function Factorial(a)
x=1
For i=1 to a
x=x*i
next
Factorial=x
End Function
Msgbox Factorial(5)
Difference between code, Script and Program
Code:
Code is the simple instruction, it is used to make script or program.
Code is the simple instruction, it is used to make script or program.
Script:
Script is a sequence of instructions, that is interpreted by another program rather than a processor.
Script is a sequence of instructions, that is interpreted by another program rather than a processor.
Program:
The program is sequence of instructions, it is executed by processor
The program is sequence of instructions, it is executed by processor
Uses of Redim Preserve Keyword
In order to save the data in the array, Preserve keyword is to be used.
Example
-----------------------
'Initialize Dynamic array
Dim arr()
'In the brackets 2 is mentioned, this indicates the last index of the array.
'So number of cells will be 3 as index starts from 0.
Redim arr(2) '
arr(0) = "Akash"
arr(1) = "Padam"
arr(2) = "Prashant"
'Re-dimension array as there is a need to delete last element from the array
'In the bracket 1 is mentioned indicating that the last cell index should be 1
'So there will be two elements in the array, at arr(0) and at arr(1)
ReDim arr(1)
Msgbox arr(0) ' Return Empty
Msgbox arr(1) ' Return Empty
' If Preserve is not used array will be Re-Dimensioned, but existing values will be deleted
'In order to save the data, Preserve is to be used
'So the correct code will be:
ReDim Preserve arr(1)
Msgbox arr(0) ' Return Akash
Msgbox arr(1) ' Return Padam
Finding Length of the String without using Len Function
Method-1
----------------------------------
str1="ABCDEFG"
var=InStrRev(str1,Right(str1,1))
MsgBox var
Method-2
----------------------------------
strVal = InputBox("please enter any value")
msgbox len(strVal)
for i=1 to 1000
val = mid(strVal ,1,i)
msg=msg & val & vbnewline
arrVar = split(msg,vbnewline)
blnres = arrVar(i-1)
If blnres = strVal then
msgbox "The length of the given string is := "& i
exit for
End if
Next
Method-3
----------------------------------
str="ABCDEFG"
i=0
Do Until str=""
i= i+1
b=Left(str,1)
str=Replace(str,b,"")
Loop
MsgBox i
----------------------------------
str1="ABCDEFG"
var=InStrRev(str1,Right(str1,1))
MsgBox var
Method-2
----------------------------------
strVal = InputBox("please enter any value")
msgbox len(strVal)
for i=1 to 1000
val = mid(strVal ,1,i)
msg=msg & val & vbnewline
arrVar = split(msg,vbnewline)
blnres = arrVar(i-1)
If blnres = strVal then
msgbox "The length of the given string is := "& i
exit for
End if
Next
Method-3
----------------------------------
str="ABCDEFG"
i=0
Do Until str=""
i= i+1
b=Left(str,1)
str=Replace(str,b,"")
Loop
MsgBox i
Finding whether a string is Palindrome or Not
Method- 1
-----------------------------------
Xstring=inputbox("enter a string")
if xString= strreverse(xString) then
msgbox "Its a Palindrome"
else
msgbox "Its NOT a Palindrome"
End if
Method-2
----------------------------------------
MyStr=Ucase(inputbox("Enter the String:"))
RevStr=strreverse(MyStr)
if strcomp(MyStr,RevStr)=0 then
msgbox "It is a Palindrome"
else
msgbox "It is not a Palindrome"
end if
-----------------------------------
Xstring=inputbox("enter a string")
if xString= strreverse(xString) then
msgbox "Its a Palindrome"
else
msgbox "Its NOT a Palindrome"
End if
Method-2
----------------------------------------
MyStr=Ucase(inputbox("Enter the String:"))
RevStr=strreverse(MyStr)
if strcomp(MyStr,RevStr)=0 then
msgbox "It is a Palindrome"
else
msgbox "It is not a Palindrome"
end if
Wednesday, 2 January 2019
7 New Features of UFT 14.51
1. Support for test parameters in UFT Test Batch Runner command line tool.
Starting from UFT 14.51 Micro Focus has enhanced RPA(Robotic Process Automation) support by enabling the UFT Test Batch Runner command line tool to support test parameters in commands.
2. Docker Support for UFT.
3. Automatic Run Result Exports to PDF with HTML export.
4. Smart Identification Properties in Run Results.
If UFT used Smart Identification during run time, the run results would now provide details about which Smart Identification properties were used. You also get a COPY NEW DESCRIPTION button just below the Smart Identification results which enables you to copy the description into the object repository.
5. Parallel test enhancements.
6. Test Object to Repository.
A new option Open a Repository has been added to the right click menu of a test object. Now you can right click on any test object in the UFT IDE and it will take you to the respective repository of that object.
7. Miscellaneous Enhancements in UFT 14.51.
a. Git version control that was introduced in UFT 12.5 has been extended for creating, switching, and merging branches.
b. UFT Jenkins Plugin support which was introduced in UFT 14.01 has been enhanced to configure failure scenarios for your test runs.
c. If Jenkins is used to trigger multiple tests and one of the tests fail, Jenkins can now load the test results for already completed tests.
d. The JQuery library used in UFT’s Web Extensibility support is now isolated, preventing errors due to conflicting libraries.
e. UFT 14.51 now supports a new Release method to release a mobile device, such as after completing the relevant test steps for that device in a script that tests multiple devices.
f. UFT 14.51 supports BPT enhancements provided in ALM version 12.60 patch 1.
g. A new MCConnection object and the MCConnection options object property has been introduced to configure a connection to Mobile Center directly from your automation scripts.
h. A new SAPNWBCTabStrip object has been introduced which would support testing SAP NWBC Desktop TabControl objects using the Belize theme.
i. UFT 14.51 will support the following new technology versions: Angular 6, IBM Personal Communications 13, NWBC Desktop 6.5 PL10, PowerBuilder 2017 R3, QT 4.8.5 and 5.11, Stingray 12.1 and 12.2, TE Rumba 9.2, Web-to-Host 6.9
j. In addition to the browser versions earlier supported, UFT 14.51 will support these new browser versions: Edge support for SAP Fiori 1.44 and 1.52 SAPUI5 1.44 (test runs only), Firefox 62-63, Chrome 69-70
Subscribe to:
Posts (Atom)