SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    May 2003
    Location
    Scottsdale, AZ, USA
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Text file with function call data driven testcases

    Has anyone ever created a text file for data driven testcase that contained the function call in the first colomn? If so How did you call the testcase?

    ie file looks like:
    ABCDEFTestcase;"Param1";"Param2";..."ParamN"
    DEFGHITestcase;"Param1";True;{"H","K"}
    jjjTestcase;""

    where ABCDEFTestcase is the testcase

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    This will do it:

    John


    ------------------

  3. #3
    Member
    Join Date
    May 2003
    Location
    CA
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    In this,
    ABCDEFTestcase;"Param1";"Param2";..."ParamN"

    ABCDEFTestcase -> name of the testcase

    and the followed ones are the data to be passed to the testcase.

    If i am right,

    1. Connect the DSN (which refers to this flat file)
    2. Find the line of the data String using GetTestCaseName and MatchStr function.
    3. If found, using delimiter use the data as LIST OF ANYTYPE.

    I would suggest u to write this as a function within TestCaseEnter, so that u will have the set of data for the data driven testcase before u start the first line of testscript.

    Hope it helps!!

    ------------------

  4. #4
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    Another option (isn't it great to have options??) is to use an ini file using sections to represent your test cases, and the key/value pairs to represent your passed parameters.

    ------------------

  5. #5
    Junior Member
    Join Date
    May 2003
    Location
    Scottsdale, AZ, USA
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    Hello John,

    First off Thanks for your quick reply!
    I've tried your code fragment, adapted a text file read up front and I have one problem.

    I'm getting the error Type_Mismatch parameter (the first parameter) to function ABCDTestcase should be a window.

    The Function declaration calls for this parameter to be a window.
    The text file (all Being Anytype)
    if I use a Print TypeOf() finction it returns a String.

    So My problem is, I can see what the text file data type is, but how can I tell what the Function parameter datatype is?

    and How do I cast a string into a window?

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by tomhart1234:

    I'm getting the error Type_Mismatch parameter (the first parameter) to function ABCDTestcase should be a window.
    <HR></BLOCKQUOTE>

    This message can appear when the count of text-file passed parameters doesn't match the
    count required by the called testcase. But there's another issue at work here that's masked by my thin example laCmds list which includes data types. See below for a solution.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    So My problem is, I can see what the text file data type is, but how can I tell what the Function parameter datatype is?

    and How do I cast a string into a window?
    <HR></BLOCKQUOTE>

    Since everything read in from a standard text file is consider "string" type, you might consider using record formatted input instead. You'd define a record and substitute FileReadValue() for FileReadLine(). That way the record determines the type of each field. The At_Sign_Function routine will still work and you won't have to translate parameter datatypes with casts.


    John



    ------------------

  7. #7
    Junior Member
    Join Date
    May 2003
    Location
    Scottsdale, AZ, USA
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    Hello again John,

    I've got several 100's different Testcases with different parameters. So creating Records for each one is not the way I want to go.

    So with that in mind is there a way to get the Function(parameter)'s data types?

    I can get the Text file datatype with TypeOf() but any Ideas about the Function's data type?

    Thanks for your time

    ------------------

  8. #8
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by tomhart1234:

    So with that in mind is there a way to get the Function(parameter)'s data types?
    <HR></BLOCKQUOTE>

    No, not from the input-side data files themselves since we already know they contain nothing but strings.

    And not from the called testcases either since Silk has no support for querying a function about its parameter data types.

    You could create an intermediate look up table containing testcase names and their list of parameter types. But converting to a record approach would be far less prone to mismatch-induced maintenance issues later.

    I dislike rework as much as anyone but this may be one of those times when it may be needed.


    John


    ------------------

  9. #9
    Junior Member
    Join Date
    May 2003
    Location
    Scottsdale, AZ, USA
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    John,

    You mentioned the 2 following lines:

    No, not from the input-side data files themselves since we already know they contain nothing but strings.

    And not from the called testcases either since Silk has no support for querying a function about its parameter data types.

    but I'm in a quandry?

    When the Scripts runs the error message states:

    Error: Type missmatch - Parameter (1st) or (2nd) ... to function ABCDTestcase should be a WINDOW

    or same message with should be a LIST OF STRING
    ...

    So with that in mind I'm seeing that The Silk error recovery code, Knows what the function data type should be?

    Any Ideas?

    Tom

    ------------------

  10. #10
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating Text file with function call data driven testcases

    I understand your thoughts on this.

    Silk recognizes and reports the error AFTER you attempted to run the test. Silk does not support a run time ability to pre-check the validity of a testcase's parameter set - to verify datatypes with passed variables - before the testcase is called.

    So you can't determine at run time how you might need to cast those parameters so that they'll be accepted by the testcase.

    While you might capture this kind of failure within testcaseexit, parse the message, reformat the attempt and try again, it'd be some work and it's probably better to avoid the whole problem in the first place.


    John


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:57 PM.

Copyright BetaSoft Inc.