function searchdatainexcel(strpath, searchcol, searchval)
path="c:abc. xls"
set searchdata=DDT. exceldriver(strpath, "sheet1", true)
do while not searchdata. EOF
if aqconvert. vartostr(searchdata. value(searchcol)) =searchvalue then
blnflag=true
exit do
else
blnflag =false
end if
searchdata. next
loop
if blnflag =true then
log. message "record match"
else
log. message "record not match"
end if
end function
Tuesday, November 20, 2018
Test Complete - Find value is present in excel sheet or not
Monday, October 8, 2018
Tosca intergration with c#
Hey folks,
Tosca is one of tge tool used for automation, however personally i dont feel much great tool.
You could write your own advanced logic in C# and integrate it with Tosca. I found this link after almost 1.5 months efforts.
Though it's challenging but helpful to get help after many tickets on tosca support
.
Though it's challenging but helpful to get help after many tickets on tosca support
.
Integration of C# with Special Execution task
- First we need to create a new XModule in our TOSCA Commander:
- On this new Module switch to the Properties tab and create two additional configuration parameters and name them "SpecialExecutionTask" and "Engine".
- The Engine parameter specifies which assemblies/engines are searched for theSpecialExecutionTask specified in the second parameter. We are going to tag our assembly with “TutorialEngine” in order to tell TOSCA to search in our assembly. The key for ourSpecialExecutionTask is "Hello World"
Preparing Visual Studio
First create a new Class Library in C# and make sure you have selected the .Net Framework 4.0. There are 2 assemblies we need to reference in order to successfully create our SET:
· Tricentis.Automation.Creation
· Tricentis.Automation.Interaction
These can be found in “%TRICENTIS_HOME%\Automation\Framework\”.
Right click on References in your Solution Explorer and choose Add Reference: Answer the following warning that might pop up by clicking "Yes". Change the "Copy Local" property of the References to "false".
Next we are going to tag our AssemblyInfo (can be found in your project, under Properties->AssemblyInfo.cs) with the necessary information, we already defined in our Module:
We are going to use the namespace
using Tricentis.Automation.Creation.Attributes;
and add the following EngineIdAttribute:
[assembly: EngineId("TutorialEngine")]
Now we are going to implement our SpecialExecutionTask. We need a class "HelloWorld.cs". You can either create a new class or rename the automatically created "Class1.cs". Then add an attribute to this class. This links the XModule to our class. Add
usingTricentis.Automation.Engines.SpecialExecutionTasks.Attributes;
to any existing usings, as well as the attribute SpecialExecutionTaskName
[SpecialExecutionTaskName("HelloWorld")]
public class HelloWorld {
}
to our class.
Our class is going to derive from the abstract class SpecialExecutionTask. We are going to override the Execute method. In this method we return a passing resultwith our message.
public class HelloWorld : SpecialExecutionTask {
public override ActionResultExecute(ISpecialExecutionTaskTestAction testAction) {
return newTricentis.Automation.Engines.PassedActionResult("Hello World!");
}
}
Now build the assembly for AnyCPU and copy the output *.dll to %TRICENTIS_HOME%\Automation\Framework\
You should now be able to use the XModule in a TestCaseand see the results in your ExecutionList:
cheers
Trupti
Friday, October 5, 2018
Read XML file as string using Vbscript
hi folks, To read XML file as entirely string we can use below logic. Hope it will useful.
set xmldoc=createobject("MICROSOFT. XMLDOM")
xmldoc. async=false
xmldoc. load(recentxmlfilepath)
for each ochdnd in xmldoc. documentelement. childnodes
strxmldocline=ochdnd. nodename & ":" & ochdnd. text & vbcrlf
xmldocdata= xmldocdata & strxmldocline
next
msgbox xmldocdata
cheers
Trupti
Labels:
Automation Frameworks,
File system,
QTP,
UFT,
XML File validation
Thursday, August 2, 2018
Text file edit using UFT/QTP/VBS
Hi folks
Create test file on path with content.
Test file edit data-Trupti to Jethva
Data -Trupti
Save file c:\test.txt
Now write function as
Public function fnModifytextfile(strfilepath,strchangedata)
Const ForReading=1
Const ForWriting=2
Set objfso=createobject(“scripting.filesystemobject”)
Set myfile=objfso.opentextfile(strfilepath,forreading,true)
Set mytemp=objfso.opentextfile(strfilepath & “.tmp”, forwriting,true)
Do while not myfile.atendofstream
Myline=myfile.readline
If instr(myline,”Data”) then
Orignaldata=split(myline,”-“)
Orignaldatachange=orignaldata(1)
Datatobechange=“ “& strchangedata
Myline=replace(myline,orignaldatachange,datatobechange)
Endif
Mytemp. Writeline myline
Loop
Myfile.close
Mytemp.close
Objfso.deletefile(strfilepath )
Objfso.movefile strfilepath & “.tmp”, strfilepath
Msgbox “done”
End function
Call fnModifytextfile(“c:\test.txt”,”jethva”)
Create test file on path with content.
Test file edit data-Trupti to Jethva
Data -Trupti
Save file c:\test.txt
Now write function as
Public function fnModifytextfile(strfilepath,strchangedata)
Const ForReading=1
Const ForWriting=2
Set objfso=createobject(“scripting.filesystemobject”)
Set myfile=objfso.opentextfile(strfilepath,forreading,true)
Set mytemp=objfso.opentextfile(strfilepath & “.tmp”, forwriting,true)
Do while not myfile.atendofstream
Myline=myfile.readline
If instr(myline,”Data”) then
Orignaldata=split(myline,”-“)
Orignaldatachange=orignaldata(1)
Datatobechange=“ “& strchangedata
Myline=replace(myline,orignaldatachange,datatobechange)
Endif
Mytemp. Writeline myline
Loop
Myfile.close
Mytemp.close
Objfso.deletefile(strfilepath )
Objfso.movefile strfilepath & “.tmp”, strfilepath
Msgbox “done”
End function
Call fnModifytextfile(“c:\test.txt”,”jethva”)
Subscribe to:
Posts (Atom)