15 Answers, 1 is accepted
Test Studio can automate the download of a PDF file or opening it in a browser, however is not able to verify the contents or format of the PDF file itself. You can however leverage .NET to write coded steps that can work within your file system once the PDF is downloaded, however I cannot comment on what the effort in code would be or if additional libraries would be required to accomplish your goal.
Regards,
Daniel Levy
the Telerik team
Test Studio can automate the download of a PDF file or opening it in a browser, however is not able to verify the contents or format of the PDF file itself. You can however leverage .NET to write coded steps that can work within your file system once the PDF is downloaded, however I cannot comment on what the effort in code would be or if additional libraries would be required to accomplish your goal.
Regards,
Daniel Levy
the Telerik team
by that i mean, is it possible to make some verification to a telerik reporting (for example displayed on the web viewer)
it would be very great as our application output is mainly telerik reports.
sebastien
Unfortunately there is no difference. A PDF file loaded in the browser does not have a DOM structure like a traditional web page, so Test Studio cannot read or verify against its contents.
See the bottom of this page for more information and a suggested alternative.
Anthony
the Telerik team
I dont understand how the test studio can perform a test where it can download a csv file (coming from a telerik report) and use that csv to perform verfication.
thanks for your help
sebastien
While dynamic data binding is not a built-in feature, you can use of one the solutions from our KB article on the topic.
Greetings,Anthony
the Telerik team
Sandhya
Thank you for contacting us.
If you have configured/calibrated the browser properly every new report will be opened in a new window.
Here is an article about IE configuration.
You can verify that the number of elements in Manager.Browsers collection are more after opening the report.
Hope this helps.
Regards,
Boyan Boev
Telerik
Test Studio Trainings
I checked to make sure my browser is caliberated properly. I ran my reports, but the Adobe reader opens with a dialog box. I have to close the dialog box to open the report in browser. I have attached the screen shots. My question is how can we automate this in test studio. Also do you recommend writing code when using test studio for issues like this.
Thank you
Sandhya
Since this is not a web dialog, it can be automated only with coded step which simulates simple key presses.
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);
This will press tab and enter once. Please make the right combination of the key presses to handle it.
Hope this helps.
Regards,
Boyan Boev
Telerik
Test Studio Trainings
Reference required to assembly 'System.Windows.Forms, Version = 4.0.0.0 ....
I also tried to add reference to my project from project settings - > Script options screen but I don't find this assembly under C:/Drive telerik test studio Bin folder. I am not sure where else to look.
Could you also tell me why I should add this reference for the code to work.
Sandhya
This is a Microsoft assembly, not a Telerik one.
It should be in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll on 64 bits machine.
Let me know if this helps.
Regards,
Boyan Boev
Telerik
Test Studio Trainings
Sandhya
Glad to hear that!
If you need additional assistance, please let us know.
Regards,
Boyan Boev
Telerik
Test Studio Trainings
This post is for Boyan. He found a great solution to this issue, but unfortunately our paths separated before he could post a reply. So I am here to post what Boyan found. Thank you Boyan, wherever you are:
Hi guys,
After further researching I have
found a very simple solution on how to read a pdf file in code.
1. Download iTextShart from here. It is a free .NET PDF library.
2. Add itextsharp.dll to Test Studio from \itextsharp-all-5.5.8\itextsharp-dll-core folder. Note that before adding you should unblock the dll (right click -> properties -> unblock).
3. Use that code for reading a pdf file:
Dim fileName As String = "folder\\pdfFileName.pdf"
Dim text As New StringBuilder()
If File.Exists(fileName) Then
Dim pdfReader As New PdfReader(fileName)
For page As Integer = 1 To pdfReader.NumberOfPages
Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
Dim currentText As String =
PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)
currentText
= Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.[Default],
Encoding.UTF8, Encoding.[Default].GetBytes(currentText)))
text.Append(currentText)
Log.WriteLine(text.ToString())
Next
pdfReader.Close()
End If
After
executing the coded step the entire text of the pdf file will be stored into
“text” string variable and will be logged into the execution
log of the test.