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
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
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.
Got it.
Thanks Aaron
@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
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?
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.
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.
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.
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
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
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