Testing, collecting and printing of custom error messages

Discussion in 'Ruby' started by Kga Agk, Jun 19, 2009.

  1. Kga Agk

    Kga Agk Guest

    I want to i want to store the messages n the assertions and print them
    in a cleen output. I am going to test a bunch of testes and i want to
    give a aoutput that puts the name of the test and success if it succeds,
    and if it has errors then it print name, error and a cleean short
    description of the errors.


    I youse Rspec, and i have initielized shoulda to.

    escribe "Echo" do
    include ... some stuff

    before :all do
    ...
    some startup stuff
    ...
    end
    after:)all) do
    ... #print collected errors, or othe reports
    end

    it "Err" do
    assert(false, "I want to store this error message")
    end
    end


    I have tried to use a seperate class ad written the assert like this.

    assert(false, errorReport.push("I want to store this error message"))

    But by doing that the message is printed bouth when the test fails and
    when it succeds, and i want it only if it fails.
    --
    Posted via http://www.ruby-forum.com/.
     
    Kga Agk, Jun 19, 2009
    #1
    1. Advertising

  2. Kga Agk

    Kga Agk Guest

    Is there somthing like. If assertion is false, then do somthing. Becouse
    i want to store my own easy error messages in adition to those the test
    framework prints out. I can do this by writing som extra code, or my own
    assertion methods, but i thought it might be a easye way, just by using
    those asertions that already are there.

    Somthing like this should hav worked.

    if assert(false) == false then
    report.pushError("It was false")
    end

    or if i wrote this

    assert false, report.pushError("It was false")

    then the secound parameter would only be don when the assertion was
    false, and not when it is true also, as it dos now.
    --
    Posted via http://www.ruby-forum.com/.
     
    Kga Agk, Jun 19, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sloan
    Replies:
    1
    Views:
    315
    Masudur
    Jan 25, 2007
  2. gsa

    printing error messages

    gsa, May 30, 2008, in forum: C Programming
    Replies:
    19
    Views:
    579
    Nick Keighley
    Jun 5, 2008
  3. Brett Ossman

    Custom Membership Provider - Custom Error Messages

    Brett Ossman, Mar 11, 2009, in forum: ASP .Net Security
    Replies:
    0
    Views:
    790
    Brett Ossman
    Mar 11, 2009
  4. sloan
    Replies:
    2
    Views:
    125
    sloan
    Jan 25, 2007
Loading...

Share This Page