Effective Using of Function Libraries
- This topic has 0 replies, 1 voice, and was last updated 8 years, 8 months ago by Valentin ZAP.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Home › Forums › ZAPTEST › Best Practices › Effective Using of Function Libraries
ZAPTEST enables the use of external libraries (collection of functions or procedures). We can include libraries not only from local PC, but also from HP ALM and CA Agile Central servers.
Q. How does the “Include” method work?
Before executing the script ZAPTEST is looking for function libraries and then Includes them before executing. Therefore we should put the Include methods at the top of the scripts as the first lines of code.
In case of Javascript: make sure to write each Include method on its own line. combining them into a single line will cause ZAPTEST to ignore the statements.
Q. Could we use cross-script variables for implementing Include logic?
No. We can use only global variables. But don’t forget that ZAPTEST doesn’t have concrete including order for functional libraries (Include method) like C/C++ languages. ZAPTEST includes all function libraries before executing the script. Just like if we put them to ZAPTEST Options (Tools -> Options -> Function Libraries)
Q. We cannot use If statement for Include method. But how to implement complex logic?
Yes, we cannot use Include method insight method or If statement. But we can use local variables for that:
‘ base folder
rootFolder = “c:libraries”
libraryName = “PC.zap”‘ in case of android
If Datatable.Value(“device”) = “android” Then
‘ change path
libraryName = “Android.zap”
End If
Include rootFolder & libraryName‘ some code
Q. Can we use Datatable values as parameter of Include method?
Sure. We can use Datatable values. Each iteration the value updates to current table row.
Include someVariable & Datatable.Value(“library”)
Q. What about GetGlobalVar and GetLocalVar methods?
We can use them like Datatable.Value method.
Include baseFolder & GetGlobalVar(“device”) & “.zap”
Already have an account? Login
Check you SPAM folder if you do not see the email.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |