Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTesting Tools @ OneStopTestingSilkTest @ OneStopTesting

Message Icon Topic: Donate a user defined function to this topic !!!

Post Reply Post New Topic
Author Message
tanushree
Senior Member
Senior Member
Avatar

Joined: 04Apr2007
Online Status: Offline
Posts: 2160
Quote tanushree Replybullet Topic: Donate a user defined function to this topic !!!
    Posted: 12Oct2007 at 5:25am
Here's a variation on Verify that strongly prefer over the original.
code:
[+] VerifyAndContinue( anytype pInActual ,anytype pInExpected ,string pDesc )
[-] do
[ ] Verify( pInActual ,pInExpected ,pDesc )
[ ] print( "VERIFY "+ pDesc+ " PASSED." )
[ ]
[-] except
[ ] LogVerifyError( pInActual ,pInExpected ,pDesc )
[ ]
[ ]
[+] // NOTES for VerifyAndContinue:
[ ] // Objections to Verify:
[ ] // 1: On PASS ,nothing is written to the .res.
[ ] // 2: On FAIL ,the testcase is terminated immediately.
[ ]
[ ] // Both these objections are overcome by VerfiyAndContinue.
[ ] // 1: On PASS ,"Verify "+ pDesc+ " passed." is written to the .res.
[ ] // 2: On FAIL ,except path prevents termination and LogVerifyError is executed.
[ ]
[ ] // Otherwise Verify behaves nicely.
[ ] // In particular ,it can handle lists of different lengths.
[ ]



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
ram7vasu
Newbie
Newbie
Avatar

Joined: 22Nov2007
Location: India
Online Status: Offline
Posts: 29
Quote ram7vasu Replybullet Posted: 08Jan2008 at 1:49am

Example1:

 STRING s = "now is the time for all the good men"

        //search forward to find first occurrence of "the"

        Print (StrPos ("the", s)) // prints: 8

        //search backward to find second occurrence of "the"

        Print (StrPos ("the", s, TRUE)) // prints: 25

        Print (StrPos ("x", s))  // prints: 0

 

RandPick function

Returns a random item from a list.Smile

 

Syntax

aElem = RandPick (lList)

 

Notes

 RandPick returns a random item from laList. The item can have any data type.

 

Example2:

testcase RandPickExample ()

           LIST OF STRING lsItems

           STRING sRandomItem

           lsItems = {...}

              "Clam Chowder"

              "Fried Chicken"

              "Lobster"

              "Green Eggs and Ham"

           sRandomItem = RandPick (lsItems)

           Print ("The special of the day is {sRandomItem}.")

RAM SAKSOFT
IP IP Logged
ram7vasu
Newbie
Newbie
Avatar

Joined: 22Nov2007
Location: India
Online Status: Offline
Posts: 29
Quote ram7vasu Replybullet Posted: 08Jan2008 at 2:13am

In how many ways we can perform datadriven test in...  

In silk test we can parametrize through
1. Flat file by using file handling concept
            HFILE f1
            f1 = FileOpen(filepath,FM_READ)
            string str

            filereadline(f1, str)
         this "str" parameter can be passed to the scripting for parametrization
            fileclose(f1)
2. Using external database and establishing connection through scripting
          HANDLE h1
          HANDLE h2
          h1 = db_connect("DSN = x.mdb")
          h2 = db_executesql(h1,"Select * from table1")
          string i
          while(db_fetchnext(h2,i)
           this "i" parameter can be used for data driven
          db_finishsql(h2)
          db_disconnect(h1)
3. List of function
          List of string a = {....}
          "xyx"
         " 123"
         "@#$"
       for each x in a
         this "x" parameter can be used for data driven

Smile
RAM SAKSOFT
IP IP Logged
ram7vasu
Newbie
Newbie
Avatar

Joined: 22Nov2007
Location: India
Online Status: Offline
Posts: 29
Quote ram7vasu Replybullet Posted: 08Jan2008 at 2:17am

[-] testcase DBTester () appstate none

            [ ]

            [ ] // Use the QA DBTester functions to access the GMO database

            [ ] // Print GMO's customer list

            [ ]

            [ ] STRING custnum, lname, fname

            [ ] HDATABASE hdbc

            [ ] HSQL hstmnt

            [ ]

            [ ] // connect to the GMO Microsoft Access database, gmt.db

            [ ] hdbc = DB_Connect ("dsn=gmovb")

            [ ]

            [ ] // retrieve everything from the customer table

            [ ] hstmnt = DB_ExecuteSql (hdbc, "SELECT * FROM cidb ORDER BY last_name")

            [ ]

            [ ] // process the retrieved data and print customer names

            [ ] print ("GMO Customer List:")

            [ ] print ()

            [-] while (DB_FetchNext (hstmnt, custnum, fname, lname))

                        [ ] print ("{lname}, {fname}")

            [ ]

            [ ] // release resources

            [ ] DB_FinishSql (hstmnt)

            [ ]

            [ ] // disconnect from the GMO database

            [ ] DB_Disconnect (hdbc)  Smile

RAM SAKSOFT
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 7.969 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting