|
||||||||||||||||||
Technical FAQ - Web Functional Testing
General : Recording :
3. Does QEngine record / play the alert window popup? Yes, QEngine does support record / playback over “Alert”,“Confirm”, “Prompt”, “Security”, “Authentication” , “Open (Browse)” popups. We can also insert Testcases to validate the message shown in the popup. 4. Does QEngine support modal / modeless dialog windows? Yes, QEngine does support record and playback in modal and modeless dialogs fully. 5. What does the numeric value at the end of each script line means ? The numeric value in each script line represent the time taken (in seconds) by the user between each action while recording . So in each and every recording line QEngine will store the actual time taken between the current action and the previous action as the last argument. Example: setWindow(“Login Window ID”,5) setText(“username”,”admin”,2) setText(“password”,”Adsnge”,2) clickButton(“Login”,3) In the above the number parameter in each script line is the time taken between each and every actions during recording. During playback QEngine will wait for these seconds before doing the corresponding actions. You can also instruct the QEngine to skip these wait time by selecting the “Fast Mode” under settings. 6. How to record click over the button inside the Flash object? To click in the flash button follow the below steps :
fireEventOnObject("clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","object","372","380","click","NONE") 7. How to record set a text to the text field inside the Flash object? To set a text value in the flash text box follow below Steps:
8. How to record the mouseover in a dropdown menu list? Recording of mouseover actions can be switched on / off. Also there is time period after which only the mouseover actions will be recorded. Otherewise moving mouse over any of the element will record the mouse over action. Record the mouse over action as explained below,
9. How to record double click in the grid element? By default QEngine will recognize only click action. To simulate double click follow the steps as below,
By default QEngine will recognize only click action. To simulate right click follow the steps as below,
Script and Suite Related : 1. How to group the related scripts under a separate module? While creating the script provide script name as <module_name>/<script_name> Example: To create a script "login" under the module "common", provide the scriptname as below, common/login 2. How to rename the script? To rename a script right click over the particular script that needs to be renamed, from the Suites tree, and choose the option "Rename" and provide the name for renaming. 3. How to rename the suite? To rename a suite, use the "Rename Suite" option available in the Suite Manager page and rename the suite. 4. How a script from one Suite can be copied to another Suite in QEngine? Yes, you can move the script from one suite to other suite. You can use the “Save In Suite” option to do this. If you right click the corresponding script node in the tree, QEngine will list many options including the “Save In Suite” option. Select this option and choose the corresponding suite. 5. Does QEngine has support to protect Suites / Scripts from unauthorized access ? QEngine does have option to protect the suites created by an user from unauthorized access. There is an option called "User Administration" available in QEngine, which needs to be enabled under the "Admin" Tab. Then the user can give access privilege to other users to view / modify the suite created by him.
You can use the export and import to do this. For e.g, To move the suite from machineA to machineB follow the below steps.
Script Syntax : 1. What language QEngine scripts are based on? QEngine script is based on Jython Scripting Language. Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform. The link below will help to customize the QEngine script for your scenarios. http://www.jython.org/Project/index.html 2. How to define ‘if-else’ condition in QEngine script ? You may use the IF-ELSE statement in QEngine as follows: Syntax: if expression: (provide a tab)statement to be executed else: (provide a tab)statement to be executed Example: x=1 if x>0: (tab)displayMessage("x is positive") else: (tab)displayMessage("x is negative") 3. How to define ‘for’ loop in QEngine script ? For loop: The for loop statement is used to perform iterative looping. It processes a sequence returned from the supplied expression, taking each element in turn. As long as elements remain in the sequence, the loop is executed. The for statement has the following forms: Syntax: for vars in expression: statement Example: for i in range(0,10) (provide a tab)displayMessage("The number is =" + i) Kindly follow this link to get more info on using the forloop: http://qengine.wiki.zoho.com/Illustrating-Data-Configuration-and-For-Construct.html 4. How to define 'while' loop in QEngine script ? While loop: The while statement is used to perform conditional looping. As long as the expression evaluates to true, the loop is executed. In QEngine, you can use the while loop as follows: Example: While X>0: (provide a tab)callScript("Test1","Test1") else: (provide a tab)statement to be executed 5. How to use mathematical operator in QEngine script ? '+' symbol can be used as follows: i=1+2 displayMessage(i) # to display the result in the outfile. '-' symbol can be used as follows: i=5-1 displayMessage(i) '*' symbol can be used as follows: i=5*5 displayMessage(i) '/' symbol can be used as follows: i=25/5 displayMessage(i) 6. How to add comments to the script ? You can add your own comments in the script by beginning the line with "#" symbol. 7. How to use string / int variable in QEngine Script ? The Example below illustrates the variable declaration in QEngine script, Example: variableA=25 // decalration for int variable variableB=”Use this string” // declaration for string variable 8. How to convert a string variable to an integer variable in the script? You can convert a string variable to int value as explained below, variableA=”25” // decalaring a string variable which can be casted to numeric value variableB=int(variableA) // now the value stored in the string variable is casted into int value. 1. How to select multiple options in a select / combo box? Database : 1. How to retrieve the values from a Database table to use it in the script ? To retrieve the values from a Database table use getDBValues("<Query>"). Example: result=getDBValues("Select * from LoginTable") for i in range (0,len (result)): for j in range (0,len (result[i])): displayMessage (result[i][j]) 2. How to write a value into a database table from the script? To write a value in your database table from the script use writeToDB("<insert query>") function which is listed under the database functions in "Insert Built-in Functions". Example: result=writeToDB("Insert into employee (emp_id,emp_name,dept) values ('emp1','peter','payroll')") 3. Does QEngine allow to fetch set of values from the database table to use it in the script? Yes, QEngine does allow getting the values from the database tables to use it in the script. You should first create a dataset, which should be configured as below,
result = getValuesFrom("TestDB") // retrieve the values from the database and store it in the two dimensional array The above will store the data fetched from the database into the result variable. Then the result variable can be iterated and values can be obtained. CSV : 1. How to fetch the values from a CSV file to use it in the script ? To fetch data from a CSV file:
result = getValuesFrom("CSV_login") for i in range(0,len(result)): var1=str(result[i][0]) var2=str(result[i][1]) setText("yourname",var1,3) setText("dept",var2,3) The above sample illustrates handling of single dimensional array of values from CSV. In the above sample script, var1 and var2 takes the values from the CSV file. You can replace the original value entered while recording by this variable to playback with different values from the CSV file. 2. How to write a value into a CSV File from the script? To write a value into a CSV file from the script by using the inbuilt function writeToCSVFile() Example: writeToCSVFile("abc.csv",result,"false") For more info, please refer this link: http://forums.manageengine.com/?ftid=49000002692887 3. Can QEngine allow to fetch values from multiple CSV file in the Script? Yes, QEngine does allow fetching the values from multiple CSV file to use it in the script at the same time. After the dataset configuration, you can change the inserted lines as below, initDataSet("TestCSV") result1 = getValuesFrom("TestCSV") i.e., rename the variable “result” as “result1”, Now you can configure another dataset and you can store it in another variable called “result2”. Thus you can fetch and use the values from multiple CSV files in the QEngine script. Data Driven : 1. How to do the login/logout action sequence in a web application for 50 times with different username & password? You can repeat the login/logout action sequence in web application for 50 times by configuring 50 usernames and password through the data configuration. You can fetch data either from the CSV file or from a database. For more info, follow this link: http://qengine.wiki.zoho.com/Data-Configuration.html Variables : 1. How to pass a value from one script to another script? You can pass a value from one script to another script by declaring the varible in setGlobal() function. Example: setGlobal("var1","test1") If you want to use this varible in a different script, you can retrieve the value by using the function getGlobal() Example: result = getGlobal("loopstring") 2. How to use a variable from the script inside a test case? The variable set using setTestVariable("<var_name>","<var_value>") can be used inside the testcase. Example: setTestVariable("var1","QEngine") Inside a testcase configure value for any check property as TEST_VAR('var1') By this you can use the script variable inside testcase. Built-in Functions : 1. How to compare a value from the webpage with the database table value ? To compare a value from the web page with the database table value follow the steps as below,
2. How to compare a value from the webpage with the CSV value? To compare a value from the webpage with the CSV table value follow below steps:
3. How to retrieve the value present in the HTML Table cell ? To retrieve the value present in the HTML Table cell, use the function getCellValueAt() as described below,
result = getCellValueAt("tableid",2,2) # Arguments are Table ID linked in the GUI Map, row id and column id from where the value needs to be retrieved. displayMessage(result) 4. How to click over the set of radio buttons present in each row of an HTML Table one after one ? To click over the radio buttons present in each row of an HTML table one by one, follow the steps below:
rowcount = getHTMLTableRowCount("Table1") displayMessage(rowcount) for i in range(0,rowcount): fireEventOnCellElement("Table1",i,2,"click","NONE","NONE","NONE","NONE",1) Where i is the row index. 5. How to find whether a given string is part of another string ? Use indexOf() function from Built-in functions of "Function Generator" to find the given string is part of another string. Example: result = indexOf("ManageengineQEngine","QEngine") displayMessage(result) The output of above snippet is 9. If the given string not present in the another string then it will return "-1" 6. How to retrieve a portion of a given string ? To get the portion of a given string use substring function as explained below, Example: result = subString("ManageengineQEngine",9,16) displayMessage(result) The output is QEngine. 7. How to replace a portion of string with another string ? Use replaceAll() function to replace a portion of a string with another string. Example: result = replaceAll("Manageengine QEngine","QEngine","Appmanager") displayMessage(result) The output is Manageengine Appmanager 8. How to invoke a batch/sh/exe file from a script ? To invoke bat/sh/exe files use invokeApplication function available in built-in functions. There were four functions namely,
invokeApplicationWithArgs("C:\\Vim\\gvim.exe","C:\\test.txt") # multiple arguments should be passed in the same argument with single space " " separator. 9. How to report the validation performed in the script to report ? To report the status of validation to the Testcase report use reportTestCase function from built-in functions, Example: reportTestCase("Validation-001",0,"Test Passed","ShowStopper") where 0 is Passed and 1 is Failed. To report the status of validation to the script report use reportStatus function from built-in functions, Example: reportStatus("Scr-001",0,"Test passed") where 0 is Passed and 1 is Failed. 10. How to print a value in the testout file ? To print a value in the testout use displayMessage function from built-in functions. Example: displayMessage("A is greater than B") 11. How to capture screen shot of the application browser during test execution ? To capture screen shot of the application window use saveScreenShot() function from built-in functions. Example: saveScreenShot("error",1) # arguments are filename to save the screen shot and wait time before invoking the function. 12. How to fetch all the values from a HTML Table column and use it in the script? To fetch the values from the HTML Table column use getHTMLTableColumnvValues() function from built-in functions. Example: result = getHTMLTableColumnValues("Table1",1) #fetches all the column values under the specified table identified through Table1 properties for i in range(0,len(result)): displayMessage(str(result[i])) 13. How to fetch all the values from a HTML Table and use it in the script? To fetch all the values from the HTML table use getAllHTMLTableCells() from built-in functions, Example: result=getAllHTMLTableCells(""Table1") for i in range(0,len(result)): for j in range(0,len(result[i])): displayMessage(str(result[i][j])) 14. Does QEngine support to manipulate any string / int data inside the script? QEngine does support to manipulate any string/int data inside the script. For int manipulation you can use any mathematical operator such as +,-,*,/ inside QEngine script. For string manipulation QEngine provides you many functions like Java,
Script Sequencing and Execution : 1. How to execute the scripts in a defined sequence ?
|
|||||