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

How to access exception messages

7 Answers 167 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kristine Ayson
Top achievements
Rank 1
Kristine Ayson asked on 15 Jun 2010, 09:25 AM
I have a code like this:

 

Assert.IsFalse((ArtOfTest.Common.CompareUtils.StringCompare(DataSetCell.Text, ((

 

string)(System.Convert.ChangeType(Data["Dataset"], typeof(string)))), ArtOfTest.Common.StringCompareType.Same) == false), string.Format("gridviewcell: text same {0}. failed. Actual value {1}", ((string)(System.Convert.ChangeType(Data["Dataset"], typeof(string)))), DataSetCell.Text));

 


This line has thrown an exception with message like below.

Exception thrown executing coded step: '[Verify_CodeName_CodedStep] : Verify Code Name, RequiresSilverlight=True'.
InnerException:
ArtOfTest.Common.Exceptions.AssertException: Assert.IsFalse - [Expected:False],[Actual:True]
   at ArtOfTest.Common.UnitTesting.Assert.IsFalse(Boolean condition)
   at ArtOfTest.Common.UnitTesting.Assert.IsFalse(Boolean condition, String message)
   at GRCSuite_Default.Test_DA_Dashboard_Completeness.Verify_CodeName_CodedStep() in c:\Users\kayson\Documents\WebUI Test Studio Projects\GRCSuite_Default\Test_DataAdmin\Dashboard\Test_DA_Dashboard_Completeness.aii.cs:line 148

Where is error message logged? It will help a lot in the debugging.

7 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 15 Jun 2010, 09:57 PM
Hi Kristine Ayson,

When a test is run as part of a test list in QA edition, results are stored in the Results folder of the project. In this folder you will find .aiiresult files and "files" folders. The .aiiresult file is an XML formatted result output from the test runner. The "files" folder contains additional details about any detected failures such as a screenshot and a copy of the DOM at the point of failure.

Is this what you are looking for?

Best wishes,
Cody
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
Kristine Ayson
Top achievements
Rank 1
answered on 16 Jun 2010, 03:41 AM
I'm looking for the message in the Assert.IsTrue(condition, message). I placed my debug message in it. Can it be found in any of the files you mentioned? The application is correct so I am not expecting any exception to occur. There is something wrong with my code, have to debug it. :)
0
Cody
Telerik team
answered on 16 Jun 2010, 10:15 PM
Hello Kristine Ayson,

I am sorry. After more investigation I found we do have a bug in the tool. Unfortunately the message from the Assert.IsFalse(Boolean condition, String message) function is currently discarded.

In the meantime you can use the Log.WriteLine(String message) function. If you examine the contents of the .aiiresult file you'll find text like this:

--------------------------------------------------
'6/16/2010 4:10:31 PM' - 'Pass' : 1. Navigate to : 'http://www.bing.com'
'6/16/2010 4:10:31 PM' - 'Pass' : 2. Set 'SbFormQText_0' text to 'sunset'
'6/16/2010 4:10:33 PM' - 'Pass' : 3. Click 'SbFormGoSubmit_0'
'6/16/2010 4:10:33 PM' - 'NotRun' : 4. Verify 'TextContent' 'Contains' 'Sunset Two' on 'SunsetStrongTag'
'6/16/2010 4:10:33 PM' - Log: my message
'6/16/2010 4:10:33 PM' - 'Fail' : 5. [BingTest_CodedStep] : Verify 'TextContent' 'Contains' 'Sunset Two' on 'SunsetStrongTag'
--------------------------------------------------

The "Log: my message" line is the output from my Log.WriteLine from a sample for a quick test I threw together.

Will that do until we fix our bug?

All the best,
Cody
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
Kristine Ayson
Top achievements
Rank 1
answered on 17 Jun 2010, 02:33 AM
Hi Cody,

Yeah, the Log.WriteLine(string message) will do. I just really need a way to flag messages to ease up my debugging.
Many thanks for your patient reply! :)

Best Regards,
Kristine


0
Cody
Telerik team
answered on 17 Jun 2010, 04:40 AM
Hello Kristine Ayson,

And we appreciate your patience with us as we fix our little flaws. Do you want to be notified when a build is available containing a fix for the Assert.IsFalse(Boolean condition, String message) function?

Greetings,
Cody
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
srikanth
Top achievements
Rank 1
answered on 23 Mar 2015, 07:23 AM
Hi,

I'm facing the same issues like not able to see the message i e passed as an argument to Assert.Equal(expected,actual,message) when this assertion fails . I'm using VS12 and 13 . I observed even when assertion fails it wont displays message anywhere .
My approaches

Assert.IsTrue(Pages.Google0.Gb70Link.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "Sign in"), "not found");
 
string text = Pages.Google0.Gb70Link.ToString();
Assert.AreEqual(text,"Sign in", "not found");


Assert.AreEqual(Pages.Google0.Gb70Link.TextContent.ToString(), "Sign in", "not found"); nothing works when im navigated to someother page and also unexpectedly the test passes even the expected and actual values are differ. so please help me out in this.


Thank You,
K.Sreekanth kumar
0
Cody
Telerik team
answered on 23 Mar 2015, 05:35 PM
Hi K.Sreekanth,

I used this code:

Assert.AreEqual("string 1", "string 2", "Comment in coded step. They are not equal.");

I got the comment as expected:

Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[Scratch_HTML_Test_CodedStep] : New Coded Step'.
InnerException:
ArtOfTest.Common.Exceptions.AssertException: Comment in coded step. They are not equal. - [Expected:string 1],[Actual:string 2]
   at ArtOfTest.Common.UnitTesting.Assert.AreEqual[T](T expected, T actual, String message)
   at TestExamplesProject.Scratch_HTML_Test.Scratch_HTML_Test_CodedStep() in E:\Users\Dad\Documents\Test Studio Projects\TestExamplesProject\Scratch HTML Test.tstest.cs:line 5

Can you send me a test I can run to reproduce this problem?



Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Kristine Ayson
Top achievements
Rank 1
Answers by
Cody
Telerik team
Kristine Ayson
Top achievements
Rank 1
srikanth
Top achievements
Rank 1
Share this question
or