Skripting in QF-Test (Fortgeschritten) | GUI Testtool für Java, Web und Windows

Welcome to the next video about working with scripting languages in QF-scan. This time i will show you additional potentialities of the QF test ways as well as interfaces, provided through QF-scan for the supported scripting languages. The APIs and methods shown here can be utilized in all supported scripting languages. These are currently Jython, Groovy and JavaScript. First we take a deeper look on the potentialities of the QF-scan-RunContext, which that you can handle with the variable rc in scripts. The first approaches that I wish to show you perform checks immediately within the script and then write the corresponding result within the log. That you could perform these exams making use of the rc.Assess and rc.CheckEqual approaches. Rc.Assess expects any evaluation as a parameter and rc.CheckEqual compares the primary two parameters for equality, if the parameters do not fit, there is an error message or if the condition rc.Determine fails, there may be additionally an error message. Additionally it is possible to evaluate pictures, however extra on that later. If I run the script in my example now, I get an error message considering that the 2d determine fails. In the log, it appears like we’re used to with the traditional QF-experiment tests. Of direction, the QF-test-RunContext additionally presents the possibility to write down any log entries, warnings or error messages. The approaches rc.LogMessage, logWarning and logError are on hand for this. The QF-scan-RunContext additionally offers the probability to access variables from the scan run. Which you can even entry the contents of the variables in a sort-riskless manner, either making use of the look up and getStr ways to entry strings, for getInt or getNum to entry numbers or getBool to access a Boolean value. I am now walking this script and down here in the output we will see the strings, the integer number or the waft number that used to be determined using getNum or the Boolean worth that used to be decided using rc.GetBool. Of direction that you could also set variable values. That is accomplished making use of the approaches rc.SetLocal for nearby variables, rc.SetGlobal for world variables or utilizing the rc.SetProperty process to fill property organizations with member variables. Furthermore, there are a lot of other approaches for executing methods, executing experiment circumstances and even stopping the scan case. That you may get all possible ways in this editor by using tapping the point after the rc and then use the distance bar to display the system list. In addition to the methods, that you can additionally see the corresponding description on the right. Additionally to the QF-test RunContext, the QF-scan Scripting Editor also gives you entry to the qf module. The qf module allows you to call up further QF scan performance for logging, as well as outputting whatever on the terminal, specially when the QF-scan-RunContext is just not on hand and likewise different easy ways to participate in a string operation and many others. In my case, I now print something on the terminal utilizing qf.Println (). QF-scan presents you the so-referred to as photograph wrapper class for working with display pix. With this photo wrapper classification, which you could generate screen executors of the complete reveal or in SUT scripts of targeted accessories. That you would be able to then either write these screenshots into the QF-test protocol or store them to a file. Of path it is usually viable to load photographs from documents and / or to examine these photos with each and every other, what the rc.CheckImage () approach does. As you’re used to with the QF-scan-RunContext, With the qf module, as with the photograph wrapper, there is a advice of the approaches to be referred to as up using the space bar, the place that you may then select the proper process. Lifestyles is made less complicated for testers of net functions on the grounds that QF-experiment comes with its possess DOM API for working with the add-ons of the website. Right here we see instance calls to examine, for illustration, all factors of an HTML object from a distinct HTML tag, with this process getElementsByTagName or all factors inside a QF-test factor from a precise QF-test type utilizing the getElementsByClassName procedure. Of path, it is also feasible to use the ordinary identification methods, similar to xpath or CSS type sheets. Right here, for illustration, there’s the getByXPath process. And as traditional, as soon as you style the variable node point and open the method list with the manage bar, you will see all other approaches here. QF-experiment additionally comes with a number of interfaces that enable you to adapt the functionality of QF-scan in a huge kind of areas to your needs. The first of these interfaces is the so-known as resolver interface, which enables you to have an effect on the awareness of the picture components. In my example, the textual content fields displayed within the SUT have dynamic names. I recorded that right here. Here you’ll discover the dynamics at the again utilizing the numbers. Because of this the name of this article area will exchange throughout the next scan run and the textual content area will not be identifiable. To throw out the dynamics right here, which you could put into effect a NameResolver, whose job it’s to edit the dynamic title so that it is either a stable identify or that we ignore the title totally. In my case, I made up our minds not to replace the digits or the minus with anything and to generate a steady identify. If I run this script as soon as, this resolver is registered and i can now click on the text fields and i get stable names in the re-recording. Within the add-ons you can see right here that there are no extra numbers. The earlier file contained the numbers, the brand new document now not. These resolvers can be utilized to have an effect on the recorded homes of the accessories. This is applicable to the category, the names, the characteristic, as well as the other characteristics of a element and even for the factor hierarchy within the window and element tree. A ordinary software for resolvers is to take away dynamics from aspect awareness, as we’ve got now noticeable or that a greater algorithm that you could put into effect in your utility and you could then map this in this resolver. The subsequent probability to extend QF-scan is the so-referred to as TestRunListener interface. A TestRunListener enables you with the methods: runStarted, runStopped, nodeEntered, nodeExited or problemOccurred to intervene in the present experiment run and hence perform moves. For illustration, you can set variables or delete variables, which you can perform your own measurements and log them in separate files. You will see that such an application within the load checking out example within the QF experiment delivery. For example, that you could handiest generate monitor photographs mechanically when entering certain nodes and write them to the log. In my illustration, every time a scan case is entered, a message is output within the terminal and likewise when this experiment case is exited. So once I run a scan case, I see the corresponding messages here. In addition to the interfaces and ways provided through QF-test, you could additionally integrate your own classes and libraries in QF-experiment. To do that, place these libraries in a detailed directory within the QF-test set up. In the usual case you’re going to find this in the QF-test process directory or you could enter your possess route whilst you QF-test. You place your own Groovy courses and Groovy modules in this Groovy directory. Position your possess JavaScript modules in the JavaScript directory. Position your own Jython modules and lessons within the Jython directory and Put your possess Java classes or external Java lessons that you need to use in the QF-test plugin directory. To then use these outside modules, import them as you’re used to within the respective scripting language. In my case, i have now imported a HelloWorld Python script and once I do that, I see my message here hence. In the QF-experiment manual, partially four of the technical reference, you will in finding the description of the QF-experiment RunContext, image wrapper of the qf module, the Node API for web applications as well because the resolver and the TestRunListener interface and likewise the right way to integrate outside scripts. Chapters 44, 45 and 48 are intriguing for this. With the script nodes and the offered approaches and interfaces, as well as the fast enlargement choices, QF-scan offers you a relatively convenient method to simplify, optimize or broaden your assessments. Don’t fail to see these options.

Add Comment