Is ByDocument/UsingDocument working?

Jul 7, 2008 at 9:20 PM
First I must say that this program is a wonderful addition to the WaTiN set of test tools.

I found a few issues with Find methods.

1) The commands.htm documemnt mentions the correct syntax is "ByDocument" in all the examples except one link which uses the syntax "UsingDocument".  So I think the documentation is incorrect.

2) Looking further into this issue I created a test file with ByDocument as the Find method.  Using that method causes the program to fail to load a .xls file.  I looked in the code and it is expecting "UsingDocument".  So I used "UsingDocument" and the test file loaded. I then tried to execute the test file and the WaxRunner program crashed.  I further looked into the code and it does not look like "UsingDocument" is connected to anything in the WatiN library.  Does it work?  I browsed change set 4231 where it was introduced and it see not to be hooked up there either.

3) I tried the ByTitle Find method.  It too crashed the WaxRunner program.  Does that work?
Coordinator
Jul 11, 2008 at 1:13 PM
I'll take a look over the weekend and get back to you


Regards Ed.

BAylesworth wrote:
First I must say that this program is a wonderful addition to the WaTiN set of test tools.

I found a few issues with Find methods.

1) The commands.htm documemnt mentions the correct syntax is "ByDocument" in all the examples except one link which uses the syntax "UsingDocument".  So I think the documentation is incorrect.

2) Looking further into this issue I created a test file with ByDocument as the Find method.  Using that method causes the program to fail to load a .xls file.  I looked in the code and it is expecting "UsingDocument".  So I used "UsingDocument" and the test file loaded. I then tried to execute the test file and the WaxRunner program crashed.  I further looked into the code and it does not look like "UsingDocument" is connected to anything in the WatiN library.  Does it work?  I browsed change set 4231 where it was introduced and it see not to be hooked up there either.

3) I tried the ByTitle Find method.  It too crashed the WaxRunner program.  Does that work?



Jul 12, 2008 at 7:38 PM
Hi Edward Wilde,
This program is a wonderful! Many thanks.
I have already fixed this bug (UsingDocument, ...)
In WaxLib project --> Test.cs file --> public void Execute(IExecutionContext context, bool shouldThrowErrors) method, add more this code:

                catch (ValidateException validateException)
                {
                    if (OnErrorOccured(new ExcecutionException(validateException.Message, validateException, command)))
                    {
                        throw;
                    }
                }

We have 3 Exception: FindMethodException, ValidateException, CommandException, The contents of Execute method would look like this:

        [CLSCompliant(false)]
        public void Execute(IExecutionContext context, bool shouldThrowErrors)
        {
            this.ThrowErrors = shouldThrowErrors;
            this.numberOfCompletedCommands = 0;
            this.numberOfFaildedCommands = 0;

            foreach (Command command in this.Commands)
            {
                bool success = false;
                System.Diagnostics.Debug.Assert(command != null, "Command object should not be null");

                try
                {
                    command.Execute(context);
                    success = true;
                    this.numberOfCompletedCommands = this.numberOfCompletedCommands + 1;
                }
                catch (FindMethodException findException)
                {
                    if (OnErrorOccured(new ExcecutionException(findException.Message, findException, command)))
                    {
                        throw;
                    }
                }
                catch (ValidateException validateException)
                {
                    if (OnErrorOccured(new ExcecutionException(validateException.Message, validateException, command)))
                    {
                        throw;
                    }
                }
                catch (CommandException commandException)
                {
                    if (OnErrorOccured(commandException))
                    {
                        throw;
                    }
                }

                if (this.CommandCompleted != null)
                {
                    this.CommandCompleted(command, new CommandCompletedEventArgs(this.numberOfCompletedCommands, this.numberOfFaildedCommands, success));
                }
            }       

In addition, in WaxLib project -->ValidateCommand.cs  file --> private void ValidateStringValue(string value) method, we should change else if(value != this.ExpectedValue) --> else if (!value.Contains(this.ExpectedValue)) make search result more exactly.

Regards,
Hung PQ
Coordinator
Jul 13, 2008 at 7:13 PM
Edited Jul 13, 2008 at 7:14 PM
Thanks guys, for the input and suggested fix.

I've implemented the fix and put a new release out http://www.codeplex.com/wax/Release/ProjectReleases.aspx?ReleaseId=15264

Cheers Ed.