Is anyone using some other way ?
On Jul 20, 8:41 pm, Moises Siles <
moises.si...@gmail.com> wrote:
> Cool, I just want to make sure, I think this works for me..
>
> Thanks for all your help guys
>
> On Wed, Jul 20, 2011 at 8:30 AM, Luke Inman-Semerau
> <
luke.seme...@gmail.com>wrote:
>
>
>
>
>
>
>
> > That's basically one way for your test runner to not stop on the first
> > error, there's other ways to accomplish this without having to catch every
> > possible exception your test may throw
>
> > -Luke
>
> > On Jul 20, 2011, at 7:23 AM, Moises Siles <
moises.si...@gmail.com> wrote:
>
> > So I'm planning to catch all the assertions in a stringbuilder and then I
> > can check the StringBuilder variable in the Teardown, I saw this approach
> > when I export an example from IDE to c#, in order to see if the string var
> > is empty or it has errors. Please let me know if that could work correctly
> > or it is not a good practice
>
> > [TearDown]
> > public static void Teardown()
> > {
> > try
> > {
> > webDriver.Quit();
> > }
> > catch (Exception e)
> > {
> > Log.writeLog(e.Message);
> > }
> > Assert.AreEqual("", verificationErrors.ToString());
> > }
>
> > public static void VerifyElementText(string ElementText, string
> > TextValue)
> > {
> > try
> > {
> > Assert.AreEqual(ElementText, TextValue);
> > }
> > catch (Exception e)
> > {
> > Log.writeLog(e.Message);
> > verificationErrors.Append(e.Message);
> > }
> > }
>
> > On Wed, Jul 20, 2011 at 7:34 AM, Moises Siles < <
moises.si...@gmail.com>
> >
moises.si...@gmail.com> wrote:
>
> >> Thanks for the answer guys,
>
> >> On Tue, Jul 19, 2011 at 8:53 PM, Krishnan Mahadevan <<
krishnan.mahadevan1...@gmail.com>
> >>
krishnan.mahadevan1...@gmail.com> wrote:
>
> >>> Moises
>
> >>> Atleast with TestNG provided asserts, I do know that the asserts do
> >>> provide a mechanism to provide an optional "Descriptive message" to be added
> >>> when an Assert Fails.
>
> >>> The following could work for you (Am doing this in Java, you can convert
> >>> it into C#)
>
> >>> try{
> >>> Assert.assertEquals(actual, expected);
> >>> } catch(AssertionError e){
> >>> log(mymessage);
> >>> throw new AssertionError(e);
> >>> }
>
> >>> Thanks & Regards
> >>> Krishnan Mahadevan
>
> >>> "All the desirable things in life are either illegal, expensive,
> >>> fattening or in love with someone else!"
>
> >>> On Wed, Jul 20, 2011 at 3:32 AM, Moises Siles < <
moises.si...@gmail.com>
> >>>
moises.si...@gmail.com> wrote:
>
> >>>> yep Luke, I think you are right, the test runner should catch all of
> >>>> those things. I just want to catch the assert error in my log file.
>
> >>>> something like
>
> >>>> INFO 2011-07-19 02:56:31 – Verify Page Title - My Title here
> >>>> ERROR2011-07-19 02:56:32 – Expected string length 48 but was 49.
> >>>> Strings differ at index 1.
> >>>> Expected: "My Title here 2"
> >>>> But was: "My Title here"
>
> >>>> On Tue, Jul 19, 2011 at 3:13 PM, Luke Inman-Semerau <<
luke.seme...@gmail.com>
> >>>>
luke.seme...@gmail.com> wrote:
>
> >>>>> I actually like to use a fluent-assertions library (i'm in java and use
> >>>>> fest) which usually allow you to add a description. I'm not sure why you are
> >>>>> logging, but you probably have some reason? Usually the test runner reports
> >>>>> back the failed test and tracebacks should be apart of it if an exception
> >>>>> was thrown..
>
> >>>>> On Tue, Jul 19, 2011 at 2:04 PM, Moises Siles <<
moises.si...@gmail.com>
> >>>>>
moises.si...@gmail.com> wrote:
>
> >>>>>> yep, I was doing something like this
>
> >>>>>> try
> >>>>>> {
> >>>>>> Assert.AreEqual(webDriver.Title, Title);
> >>>>>> }
> >>>>>> catch (Exception e)
> >>>>>> {
> >>>>>> log.write(e.Message);
> >>>>>> throw e;
> >>>>>> }
>
> >>>>>> But I want to make sure if there is a best way to achieve this.
>
> >>>>>> On Tue, Jul 19, 2011 at 3:00 PM, Luke Inman-Semerau <<
luke.seme...@gmail.com>
> >>>>>>
luke.seme...@gmail.com> wrote:
>
> >>>>>>> You can add a throw e (sorry don't know c# syntax... but sure it's
> >>>>>>> close) after your log then.
>
> >>>>>>> On Tue, Jul 19, 2011 at 1:43 PM, Moises Siles <<
moises.si...@gmail.com>
> >>>>>>>
moises.si...@gmail.com> wrote:
>
> >>>>>>>> mmm, that was what I thought, so I can't catch that error in the log
> >>>>>>>> file.....
>
> >>>>>>>> On Tue, Jul 19, 2011 at 2:34 PM, Luke Inman-Semerau <<
luke.seme...@gmail.com>
> >>>>>>>>
luke.seme...@gmail.com> wrote:
>
> >>>>>>>>> That's because you're catching the exception and essentially
> >>>>>>>>> suppressing it... if you want it to fail just remove the try / catch.
>
> >>>>>>>>> On Tue, Jul 19, 2011 at 11:48 AM, Moises Siles <<
moises.si...@gmail.com>
> >>>>>>>>>
moises.si...@gmail.com> wrote:
>
> >>>>>>>>>> Hi,
>
> >>>>>>>>>> Guys one question, I'm running my scripts using Gallio Icarus with
> >>>>>>>>>> NUnit, webdriver and C#, but for example in the code that I put below, if
> >>>>>>>>>> the titles doesn't match it should mark the test as Failed, but so far it
> >>>>>>>>>> always show the results as Passed even if the Title is wrong
>
> >>>>>>>>>> try
> >>>>>>>>>> {
> >>>>>>>>>> Assert.AreEqual(webDriver.Title, Title);
> >>>>>>>>>> }
> >>>>>>>>>> catch (Exception e)
> >>>>>>>>>> {
> >>>>>>>>>> log.write(e.Message);
> >>>>>>>>>> }
>
> >>>>>>>>>> Should I need to add something in the Catch to indicates that the
> >>>>>>>>>> test is failing.
>
> >>>>>>>>>> Regards
>
> >>>>>>>>>> --
> >>>>>>>>>> You received this message because you are subscribed to the Google
> >>>>>>>>>> Groups "webdriver" group.
> >>>>>>>>>> To post to this group, send email to <
webd...@googlegroups.com>
> >>>>>>>>>>
webd...@googlegroups.com.
> >>>>>>>>>> To unsubscribe from this group, send email to
> >>>>>>>>>> <
webdriver%2Bunsu...@googlegroups.com>
> >>>>>>>>> <
seleniu...@googlegroups.com>
seleniu...@googlegroups.com.
> >>>>>>>>> To unsubscribe from this group, send email to
> >>>>>>>>> <
selenium-users%2Bunsu...@googlegroups.com>
> >>>>>>>> <
seleniu...@googlegroups.com>
seleniu...@googlegroups.com.
> >>>>>>>> To unsubscribe from this group, send email to
> >>>>>>>> <
selenium-users%2Bunsu...@googlegroups.com>
> >>>>>>> <
seleniu...@googlegroups.com>
seleniu...@googlegroups.com.
> >>>>>>> To unsubscribe from this group, send email to
> >>>>>>> <
selenium-users%2Bunsu...@googlegroups.com>
> >>>>>> <
seleniu...@googlegroups.com>
seleniu...@googlegroups.com.
> >>>>>> To unsubscribe from this group, send email to
> >>>>>> <
selenium-users%2Bunsu...@googlegroups.com>
> >>>>> <
selenium-users%2Bunsu...@googlegroups.com>
> >>>> <
selenium-users%2Bunsu...@googlegroups.com>
> ...
>
> read more »