Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Component with text should not contain certain string
Component with text should not contain certain string [message #1220072] Mon, 09 December 2013 13:55 Go to next message
Sascha Winkler is currently offline Sascha WinklerFriend
Messages: 30
Registered: March 2013
Member
Hey to all,

I tried to check a text field not containing a spezified String. At the Documentation is a hint to use a special regex: To check that a specific string is not in a text, use: ^.*[^(STRING)].*\$

So I use the test case ub_ctx_checkText with the following arguments:
TEXT = ^.*[^(exception)].*\$
OPERATOR = matches

the component type is org.eclipse.swt.custom.StyledText

When I execute the test case, it will passing when "exception" is not contained, but it will also passing when "exeption" is contained in the text.

So what is my error?

regards,
Sascha
Re: Component with text should not contain certain string [message #1220158 is a reply to message #1220072] Tue, 10 December 2013 07:13 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi,

I'm not the regex genius, I'll happily admit. I seem to remember someone correcting the regex, but I can't find the place, and the docs aren't changed at the moment. Either it got forgot, or it is already changed. Google might be your friend unless someone else is better in regex than I am. If you find something that works, let us know. Then we can update the docs.

Best regards,
Alex
Re: Component with text should not contain certain string [message #1220547 is a reply to message #1220158] Thu, 12 December 2013 14:01 Go to previous messageGo to next message
Sascha Winkler is currently offline Sascha WinklerFriend
Messages: 30
Registered: March 2013
Member
Hey Alex,

I found a regex matching for my needs, but now i have a problem converting it to "jubula-regex". The regex is
^((?!hede)[\s\S])*$
I thought that i had to escape the '?' and the '!', but this will ending in an syntax error while the test execution. If I do not escaping anything I can not set the regex at the testcase.
Re: Component with text should not contain certain string [message #1220558 is a reply to message #1220547] Thu, 12 December 2013 14:32 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi there,

Thanks for the update! To escape a whole string, just use single quotes around the string, so: '^((?!hede)[\s\S])*$'

I tested it and it works. I'll update the docs - thanks for your help Smile

Alex
Re: Component with text should not contain certain string [message #1220563 is a reply to message #1220558] Thu, 12 December 2013 14:39 Go to previous message
Sascha Winkler is currently offline Sascha WinklerFriend
Messages: 30
Registered: March 2013
Member
Thanks for your help, too.
single quotes - that was too easy Very Happy

[Updated on: Thu, 12 December 2013 14:40]

Report message to a moderator

Previous Topic:Poll: Do you test Java 1.4 AUT's?
Next Topic:HTML AUT will not start
Goto Forum:
  


Current Time: Fri Apr 26 05:15:10 GMT 2024

Powered by FUDForum. Page generated in 0.02997 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top