This is a migrated thread and some comments may be shown as answers.

Writing to the Log

13 Answers 822 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nigel
Top achievements
Rank 2
Nigel asked on 30 Jan 2012, 05:57 PM
Hi,
I am a newcomer to Test Studio, still in the trial period.  I hope I am posting to the write forum. 

I need to write a debug line to the log so I can trace failures.

I have an Excel data source with multiple columns and multiple rows.  My scripts parse the data fine, and tell me there has been a failure, but the log does not make it easy to see in which iteration the failure occurred.

One of the columns in my data is a row counter.  How can I read the value in this counter (the column name is Iteration)?  I assumed I could simply bind the value to a comment with $(Iteration), but this does not appear possible.

I tried putting a VB "log.writeline($(Iteration))" expression in the code-behind window but this just failed (I am far from an expert in VB).

Any advice would be appreciated.

Thanks,
Nigel.

13 Answers, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 31 Jan 2012, 03:12 PM
Hi Nigel,
the correct VB code is as follows:
Log.WriteLine("Value from iteration column is: " + DirectCast(Data("iteration"), [String]))

Check out the following article:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/attach-columns-to-input-values-in-code.aspx

Let me know if you require additional assistance in order to get this to work.

Greetings,
Stoich
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Nigel
Top achievements
Rank 2
answered on 31 Jan 2012, 03:30 PM
Wonderful!  It's always easy when you know how, isn't it?  Many thanks for your excellent assistance, Stoich!  :)
0
srikanth
Top achievements
Rank 1
answered on 17 May 2016, 04:51 PM
Can you also post the code in C# for writing Error log.
0
Aaron
Top achievements
Rank 1
answered on 17 May 2016, 07:06 PM

Log.WriteLine("Insert a line into the log.");

It is basically the same as the VB code, except you need to add the semicolon onto the end of the line.

0
srikanth
Top achievements
Rank 1
answered on 17 May 2016, 07:07 PM

Got it.

Thanks Aaron

0
Boyan Boev
Telerik team
answered on 19 May 2016, 03:15 PM
Hello,

@Aaron, thank you for sharing your knowledge with the community. We appreciate it.

@Srikanth, If you need further assistance please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Viral
Top achievements
Rank 1
answered on 29 Aug 2016, 04:22 AM

Hi,

Is there anyway to disable log writing of specific test case?

Scenario: We are using one test case (Test-A) as a step in almost all of our test cases repetitively. Test execution writes a lot of lines log of Test-A repetitively in log file and it makes it hard to read tes log file. 

I was wondering if there is a way to disable log writing for specific test case or test step?

0
Viral
Top achievements
Rank 1
answered on 29 Aug 2016, 04:25 AM

Sample of logs of test case looks like below.

>>> Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log starts:

Overall Result: Pass
------------------------------------------------------------
'8/29/2016 2:08:44 PM' - Detected custom code in test. Locating test assembly: TestAutomation.dll.
'8/29/2016 2:08:44 PM' - Assembly Found: C:\QualityAssurance\AutomatedTests\bin\TestAutomation.dll
'8/29/2016 2:08:44 PM' - Loading code class: 'TestAutomation.Helpers_TestSteps_Wait_WaitForBrowserReady'.
------------------------------------------------------------
------------------------------------------------------------
'8/29/2016 2:08:44 PM' - Enabling Html Popup Tracker. Test expecting Popups.
'8/29/2016 2:08:44 PM' - Using 'InternetExplorer' version '11.0' as default browser. 
'8/29/2016 2:08:44 PM' - Using 'https://example.com/' as base url.
'8/29/2016 2:08:45 PM' - 'Pass' : 1. Waiting
------------------------------------------------------------
'8/29/2016 2:08:45 PM' - Overall Result: Pass
'8/29/2016 2:08:45 PM' - Duration: [0 min: 1 sec: 611 msec]
------------------------------------------------------------

<<< Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log ends.

0
Viral
Top achievements
Rank 1
answered on 29 Aug 2016, 04:26 AM

Sample of log records look like as below:

>>> Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log starts:

Overall Result: Pass
------------------------------------------------------------
'8/29/2016 2:08:44 PM' - Detected custom code in test. Locating test assembly: TestAutomation.dll.
'8/29/2016 2:08:44 PM' - Assembly Found: C:\QualityAssurance\AutomatedTests\bin\TestAutomation.dll
'8/29/2016 2:08:44 PM' - Loading code class: 'TestAutomation.Helpers_TestSteps_Wait_WaitForBrowserReady'.
------------------------------------------------------------
------------------------------------------------------------
'8/29/2016 2:08:44 PM' - Enabling Html Popup Tracker. Test expecting Popups.
'8/29/2016 2:08:44 PM' - Using 'InternetExplorer' version '11.0' as default browser. 
'8/29/2016 2:08:44 PM' - Using 'https://example.com/' as base url.
'8/29/2016 2:08:45 PM' - 'Pass' : 1. Waiting
------------------------------------------------------------
'8/29/2016 2:08:45 PM' - Overall Result: Pass
'8/29/2016 2:08:45 PM' - Duration: [0 min: 1 sec: 611 msec]
------------------------------------------------------------

<<< Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log ends.
<<< Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log ends.

0
Viral
Top achievements
Rank 1
answered on 29 Aug 2016, 04:27 AM

Sample of log records look like as below. I want to disable these lines being logged.

 

>>> Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log starts:<br><br>Overall Result: Pass<br>------------------------------------------------------------<br>'8/29/2016 2:08:44 PM' - Detected custom code in test. Locating test assembly: TestAutomation.dll.<br>'8/29/2016 2:08:44 PM' - Assembly Found: C:\QualityAssurance\AutomatedTests\bin\TestAutomation.dll<br>'8/29/2016 2:08:44 PM' - Loading code class: 'TestAutomation.Helpers_TestSteps_Wait_WaitForBrowserReady'.<br>------------------------------------------------------------<br>------------------------------------------------------------<br>'8/29/2016 2:08:44 PM' - Enabling Html Popup Tracker. Test expecting Popups.<br>'8/29/2016 2:08:44 PM' - Using 'InternetExplorer' version '11.0' as default browser. <br>'8/29/2016 2:08:44 PM' - Using 'https://example.com/' as base url.<br>'8/29/2016 2:08:45 PM' - 'Pass' : 1. Waiting<br>------------------------------------------------------------<br>'8/29/2016 2:08:45 PM' - Overall Result: Pass<br>'8/29/2016 2:08:45 PM' - Duration: [0 min: 1 sec: 611 msec]<br>------------------------------------------------------------<br><br><<< Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log ends.<br><<< Test-as-Step 'Helpers\TestSteps\Wait\Helpers_TestSteps_Wait_WaitForBrowserReady.tstest' log ends.

0
Elena
Telerik team
answered on 31 Aug 2016, 01:31 PM
Hi Viral,

This is the standard log that is being created within test execution and you could only add lines to it but you could create an external log file. Please let me know if you would need further assistance. 

Regards,
Elena Tsvetkova
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Steven
Top achievements
Rank 1
answered on 05 Oct 2018, 10:43 PM

This link is broken: http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/attach-columns-to-input-values-in-code.aspx 

 
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
 
[/quote]
0
Elena
Telerik team
answered on 08 Oct 2018, 07:16 AM
Hi Steve,

Thanks for notifying me about that missing URL. A redirect rule was added accordingly and soon that will be working as well. Meanwhile you could use the currently live URL how to attach data columns to Input fields in code.

Regards,
Elena Tsvetkova
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Nigel
Top achievements
Rank 2
Answers by
Stoich
Telerik team
Nigel
Top achievements
Rank 2
srikanth
Top achievements
Rank 1
Aaron
Top achievements
Rank 1
Boyan Boev
Telerik team
Viral
Top achievements
Rank 1
Elena
Telerik team
Steven
Top achievements
Rank 1
Share this question
or