Made the change and here is what I get in comparison. getText is not returning
the Correct string.
Manoj
MODULE:
ui.Container(uid:"subnav", clocator:[tag:"ul",id:"subnav"]){
Container(uid: "CoreLinks", clocator:[tag: "li", id:
"core_links"]){
List(uid:"links", clocator:[tag: "ul"], separator: "li"){
UrlLink(uid: "all", clocator:[:])
}
}
Container(uid: "subscribe", colocator:[tag:"li", id: "subscribe"]){
UrlLink(uid: "link", clocator:[:])
}
}
Assert CODE:
org.junit.Assert.assertEquals("Subscribe to Front
Page",brhp.getText("subnav.subscribe.link"));
ERROR:
org.junit.ComparisonFailure: expected:<[Subscribe to ]Front Page> but
was:<[]Front Page>
Manoj
>
>From: Jian Fang <[email protected]>
>To: [email protected]
>Sent: Wednesday, June 17, 2009 3:44:05 PM
>Subject: Re: TrUMP Generated DSL.
>
>>You mean you want to get text for the Link with tag "a"? If that is true, you
>>should change
>
>UrlLink(uid: "subscribe", colocator:[tag:"li", id: "subscribe"])
>
>to
>
>>Container(uid: "subscribe", colocator:[tag:"li", id: "subscribe"]){
> UrlLink(uid: "link", clocator:[:])
>}
>
>and then use
>
>brhp.getText("subnav.subscribe.link" to get back the text.
>
>Otherwise, you will get text for tag "li".
>
>Hope this can solve your problem.
>
>Thanks,
>
>Jian
>
>
>On Wed, Jun 17, 2009 at 6:37 PM, Manoj Chavan <[email protected]> wrote:
>
>>>I feel like an idot now.. dont know I missed that... thank you for pointing
>>>that out. Now that the test
>>is working. I have run into a Comparison problem. In my assert statement below
>>
>>org.junit.Assert.assertEquals("Subscribe to Front
>>Page",brhp.getText("subnav.subscribe"));
>>
>>I am expecting it to pass. But what Is being compared is different due to the
>>nested Container. (see the original msg below for the Module definition and
>>the html source). The getText is returning back the entire string from the
>>root module instead of the specific control. Am I using the getText method
>>correctly?
>>
>><snippet from testCase.txt>
>>org.junit.ComparisonFailure: expected:<[]Subscribe to Front P...> but
>>was:<[Front Page Top Writers Activities Write ]Subscribe to Front P...>
>>
>>
>>Manoj
>>
>>
>>
>>//MY MODULE DEFINITION:
>>
>>>> ui.Container(uid:"subnav", clocator:[tag:"ul",id:"subnav"]){
>>
>> Container(uid: "CoreLinks", clocator:[tag: "li", id:
>> "core_links"]){
>>>> List(uid:"links", clocator:[tag: "ul"], separator: "li"){
>>>> UrlLink(uid: "all", clocator:[:])
>>>> }
>>>> }
>>
>> UrlLink(uid: "subscribe", colocator:[tag:"li", id: "subscribe"])
>>>> }
>>
>>
>>>>// HTML UNDER TEST:
>>
>>
>>>><ul id="subnav">
>>>><li id="core_links">
>>>><ul>
>><li class="active">
>>>><a href="/" style="background-color: rgb(169, 218, 146);">Front Page</a>
>>>></li>
>>>><li>
>>>><a href="/top-writers" style="background-color: rgb(169, 218, 146);">Top
>>>>Writers</a>
>>>></li>
>>>><li>
>>>><a rel="nofollow" href="/activities" style="background-color: rgb(169, 218,
>>>>146);">Activities</a>
>>>></li>
>>>><li>
>>>><a href="/articles/new" style="background-color: rgb(169, 218,
>>>>146);">Write</a>
>>>></li>
>>
>><li/>
>>>></ul>
>>>></li>
>>>><li id="subscribe">
>><a href="/articles;feed?tag_id=1" style="background-color: rgb(169, 218,
>>146);">Subscribe to Front Page</a>
>>>></li>
>>>></ul>
>>
>>
>>
>>
>>
>>
>
>>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---