Mailingliste - Einträge 2005

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qftestJUI] How to write procedures for common functionalities

  • Subject: Re: [qftestJUI] How to write procedures for common functionalities
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 30 Dec 2005 10:02:37 +0100

Hi Giri,

judging from your description your approach sounds fine.

If you can fill each field separately and have it validated by the
server, you don't really need pageCheckFields. Instead I suggest you
create a CSV file with four columns

idx, input, length, error

where idx is the index of the field (0-7). You can map this index to
the component IDs of the field and of the error message, e.g by
defining suite variables
field_0 = ID of first field
field_1 = ...
msg_0 = ID of first message

and then using $(field_$(idx)) and $(msg_$(idx)) as the ids for input
field and error message.

Now, simply parse the CSV file as usual, iterate over the rows and
call fieldValidation for each passing the four variables.

I hope you'll be able to take it from here :-)

Best regards,

girishhk <girishhk@?.uk> writes:

>    Hi Greg,
>    Thank you very much for your input. Let me explain what  I have done
>    and where I am stuck. If you have an idea better than that, plz let me
>    know.
>    Requirement
>    ------------------
>    My page has 8 text fields. When page is submitted with data, server
>    side validation will be done and error messages will be displayed on
>    the same page under each text fields if the validation fails.
>    Implementation using QFtest
>    -----------------------------------------
>    I am passing data to these text fields using data driven method. So my
>    data are in csv file. I have written server script to load this csv
>    file, fetch data and fill the fields. This is my first node(server
>    script).
>    Next node is a procedure call (pagecheckFields) passing the above 8
>    data as parameters.       pagecheckFields ( 8 parameters)
>    In procedure pageCheckFields, I am calling the procedure
>    fieldVailadtion 8 times passing each field at a time along with the
>    respective fieldLength and expected error message. Planning to pass
>    field length and expected error message through file. I need your
>    suggestion how to make it. Do I have to store this in a different file
>    or I can use the above file itself? And how to get  this to the
>    variables fieldLength and expErrMag?        fieldVailadtion(3
>    parameters)
>    Procedure fieldValidation should have the code for actual validation.
>    I am again stuch here. How to put this in sequence? Depending on the
>    validation result, I should use event textCheck to verify the error
>    message. So I am calling another procedure here called checkText
>    passing the component id of the errormessage and the error message.
>    Is this approac! h right? If this is the right approach, I need your
>    suggestion where I am stuck.
>    Thanks in adavnce
>    Giri.
>    Gregor Schmid <Gregor.Schmid@?.de> wrote:
>      Hi Giri,
>      interesting question. Though the task itself is reltively easy to
>      handle, you have to piece a few things together to do it correctly:
>      Create a procedure checkLength with parameters id (of component)
>      and
>      length (and maybe client, see the qfs.qft standard library provided
>      by
>      with qftestJUI).
>      As first node, add the following server script:
>      good = 'A' * $(length) # Create a string of length times A
>      bad = good + 'B' # append one B
>      rc.setLocal("good", good)
>      rc.setLocal("bad", bad)
>      A! hh, the power of Jython... :-)
>      You now have two strings defined, one that should just work and one
>      that just shouldn't. Next node, add a Text input with "Component
>      id"
>      $(id), text $(good) and select "Clear first" and "Replay single
>      events". The latter is essential, otherwise the length check of the
>      field cannot work.
>      Follow that with a "Check text" for Component $(id), expected value
>      $(good).
>      Copy the "Text input" and "Check text" node, and change the text
>      attribute of the input from $(good) to $(bad). Keep the check's
>      expected value $(good). If your text field silently ignores the
>      extraneous input you should be done. If you get an error message
>      instead, remove the last check and replace it with a check for and
>      closing of the error message.
>      Best regards,
>      Greg
>      girishhk writes:
>      > Hi,
>      >
>      > I have a scenario where in a java page has few text
>      > fields and need to be done validation for those fileds
>      > for their maximum length input. My plan is to write
>      > procedure, pass the textfields, their max length and
>      > the expected result as parameters to this procedure.
>      > How can I do this in QFTest? Any idea/suggestions/help
>      > are greately appriciated.
>      >
>      > Thanks
>      > Giri

Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH           
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876