Force a test to fail

992 views
Skip to first unread message

Leonardo Galani

unread,
Apr 18, 2011, 2:43:29 PM4/18/11
to marathon...@googlegroups.com
Hi there,

Is there a assert function that forces a test to fail.?

I know you can use assert_p to check component's values..  but it need something more.. i need to assert 2 values and if they are no the same.. i want to test to fail... (the values are the result of other values that i got from the app)...

In java+testng i would do something like that: assert.Fails("fail msg")

thks!

Att
Leonardo Barba Galani
Arquiteto de Teste
Java, Selenium e Coca Cola

Dakshinamurthy Karra

unread,
Apr 18, 2011, 2:51:53 PM4/18/11
to marathon...@googlegroups.com
Just use fail(message).

-- KD

--
You received this message because you are subscribed to the Google Groups "Marathon Java GUI Testing" group.
To post to this group, send email to marathon...@googlegroups.com.
To unsubscribe from this group, send email to marathon-testi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/marathon-testing?hl=en.



--
-- KD

--
Dakshinamurthy Karra
CEO & Managing Director
Jalian Systems Pvt. Ltd.
#44, Maruthi Complex, CMR Road
2nd Block, Kalyan Nagar
H.R.B.R Layout, Bengaluru - 560 043
INDIA


Leonardo Galani

unread,
Apr 18, 2011, 4:49:02 PM4/18/11
to marathon...@googlegroups.com
Looking through  rails i found ::Unit  and the assert_equals that can solve my problem.

The problem is that i can import that lib with  require 'test\unit\assertions'

i saw someone else already asked about it but he need to compare components.. i need to compare 2 values.. thats why i really need it :D

why marathon cant find that lib?

he can find "bigdecimal" but why not test\unit\assertions?

Thks!


Att
Leonardo Barba Galani
Arquiteto de Teste
Java, Selenium e Coca Cola

Dakshinamurthy Karra

unread,
Apr 18, 2011, 11:43:56 PM4/18/11
to marathon...@googlegroups.com
I think it is because test is already used for the method name. Have a
look at playback.rb - there is a assert equals in there.

-- KD

Dakshinamurthy Karra

unread,
Apr 18, 2011, 11:46:47 PM4/18/11
to marathon...@googlegroups.com
Try using / instead of \ and see whether it works.

-- KD

On Tuesday, April 19, 2011, Leonardo Galani <l...@leonardobg.com.br> wrote:

Leonardo Galani

unread,
Apr 19, 2011, 9:57:39 AM4/19/11
to marathon...@googlegroups.com
No its not working..

either with '/' or '//' or '\' or '\\'.

This is a bug?

PS: im using marathon 3 beta 2, with last jruby version ( the path is defined on the project settings --> C:\jruby-1.6.0 )

Att
Leonardo Barba Galani
Arquiteto de Teste

Java, Selenium e Coca Cola (http://www.leonardobg.com.br)

Dakshinamurthy Karra

unread,
Apr 19, 2011, 10:50:31 AM4/19/11
to marathon...@googlegroups.com
Are you able to load other modules that don't have 'test' in them. I
will check this out & post a reply.

Leonardo Galani

unread,
Apr 19, 2011, 12:29:03 PM4/19/11
to marathon...@googlegroups.com
Its not a "module".. bigDecimal isnt a module.. (its on jruby folder and not on module folder) is a class with construtor that is basic on ruby language... it loads with no problem.. but and you use installed gem, marathon cant find it(on jruby directory).

Dakshinamurthy Karra

unread,
Apr 19, 2011, 12:56:07 PM4/19/11
to marathon...@googlegroups.com
I was on SO in that discussion ;-)

That said including test/unit working fine for me - though I am using the bundled jruby.

Here is the script:

#{{{ Marathon
require_fixture 'default'
#}}} Marathon

require 'test/unit'

include Test::Unit::Assertions

def test
    # Marathon's assert_equals method
    assert_equals 'HELLO', 'hello'.upcase
    # JRuby's assert_equal method
    assert_equal 'HELLO', 'hello'.upcase
    assert_equal 'hello', 'hello'.upcase
end



HTH

-- KD

Leonardo Galani

unread,
Apr 19, 2011, 3:00:07 PM4/19/11
to marathon...@googlegroups.com
Oh well.. LOL... i copy past jruby libs into marathon jruby lib and now i can call the test/unit/assertions

suposse it wasnt necessary once i filled the jruby folder on the project settings .. anyway

Thks DK
Reply all
Reply to author
Forward
0 new messages