Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to save a text file automatically and search for some keywords
#1
Not Solved
Hey Everybody,

I am a beginner at QTP. My QA manager gave me QTP to play with and for me to figure out a way to automate all the test plans.

We use the actual software Debugview(NOT the QTP debugview) to establish that when we play a video clip, whether if it uses our video chip or not(we look for a certain output in debugview which confirms it).

Here's what I would like to do:

1)We need to play a clip lets say 500 times to do regression testing.
2) Everytime we play the clip, it activates the Video card and turns it off when the video shuts off. As i said earlier, we look at the kernel text output on debugview to see if it turned ON or not. I need to somehow find a way to save the text file from debugview and Search it for a certain text command. That command should show up 500 times on debugview log if the clip was played correctly using our chip.
I was able to use looping and figured out how to play and close the player over and over again.
What i cant figure out is how to parse the debugview file and count if that TEXT COMMAND showed up 500 times or not.

Ill appreciate it if anyone can help me with this.

Thanks,
Syed.
Reply
#2
Not Solved
What is the type of your debugview file? Is it a text file?
Reply
#3
Not Solved
Syed,

It is very simple. I will give you the logic, see if you can implement it.

1. ReadAll the data in the file.
2. SPLIT it line by line.
3. Find out if a substring exist in the whole line.
4. Introduce and iterate the counter where the value is found.
5. Report the final value of the counter.

PS : Vbscript should do, and the COM i am talkin about is Scripting.Filesystemobject.

Each line which i have provided has a keyword. Try to search and you will find the end of the road soon mate !!
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Not Solved
Hey thanks for helping me out on this. I get the logic behind it but im not sure how to use the debugview log and Read the data on it. The problem is, even if i add Debugview as Windows application to QTP, it still doesnt register any activity on QTP when im recording.
For instance, if i am trying to record just to open the debugview log and close it and maybe do it 500 times for every clip, It doesnt register the mouse clicks on it. So im not sure how to save it and search it.
I am attaching the debugview log, its just a txt file. Notice Lines 78 and 158 "Job created in Flush". I just want to confirm that this command shows up on debugview every time i play a clip ( indicating the activation of our chip).

Thanks alot again.

yes its a text file. I am attaching it so you can have a look at it. All i want is to verify a certain command " Job Created in Flush" which you can see on lines 78 and 158. So everytime we play a clip, this should show up on debugview log indicating that our chip is activated, if not then its a fail.


Attached Files
.txt   Debug-logs.txt (Size: 10.8 KB / Downloads: 69)
.txt   Debug-logs.txt (Size: 10.8 KB / Downloads: 82)
Reply
#5
Not Solved
Hi,
you can use following steps to get the content in your log file. Then you can follow the logic mentioned by Basanth.
Code:
Set MyClipboard = CreateObject("Mercury.Clipboard")
MyClipboard.Clear
SystemUtil.Run "c:\Debug-logs.txt","","","" 'this will open ur text file-provide the correct location for the file
wait 1
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "^a" 'to select All the content of text file
WshShell.SendKeys "^c" 'copy
wait 2
a = MyClipboard.GetText 'here now 'a' contains all the texts that is in your log file
Reply
#6
Not Solved
Hi sasmitakumari,

Thanks for the code. If i were to just pars the debugview txt file, this would work. but the problem is, i need to find a way to save the txt file everytime the clip is played. and then open the file and search for the text. I cant seem to Save it as a text file auotmaticaly. Thats my biggest problem. Because it dowesnt record any clicks on debugview software.
Thanks for helping me on this.
Syed
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CyberArk CorePAS REST API to search for accounts pramod 0 837 06-29-2023, 03:11 PM
Last Post: pramod
MyBB how can i automatically click ok button in msgbox popup test 11 24,861 07-12-2022, 11:50 PM
Last Post: akash warke
  Extract and save a file from zip folder using VB Script karthicksri07 1 6,426 06-29-2016, 02:19 PM
Last Post: Ankesh
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,894 09-13-2015, 12:06 AM
Last Post: ADITI1992
  How to retrieve specied string from text file nsuresh316 1 2,467 06-09-2015, 12:24 AM
Last Post: nsuresh316

Forum Jump:


Users browsing this thread: 1 Guest(s)