Huge job opportunities waiting for you across the globe. Are you ready to face the interview? Go through the interview question on Ionic framework, crack back-to-back interviews at incredible ease and speed.
Software testing is a very vast concept but basically categorized into two: manual testing and automated testing.
Both manual and automated testing is having advantages benefits and disadvantages.
Manual Testing | Automation Testing |
---|---|
Less Reliable - Manual Testing is not accurate at all times due to human error, hence it is less reliable | More Reliable - Automated testing is more reliable, as it is performed by tools or scripts’. |
Time Consuming - Manual testing is time-consuming taking up human resources | Time Saving - Automated testing is executed by software tools so it is significantly faster than a manual approach |
Resource Availability - Manual testing allows for human observation, which may be more useful if the goal is user-friendliness or improved customer experience | Resource Unavailability- Automation testing does not entail human observation |
Regression Testing: Here, automated testing is suitable because of frequent code changes and the ability to run the regressions in a timely manner.
Load Testing: Automated testing is also the best way to complete the testing efficiently when it comes to load testing.
Repeated Execution: Testing which requires the repeated execution of a task is best automated.
Performance Testing: Similarly, testing which requires the simulation of thousands of concurrent users requires automation.
Silk Test is the Silk Test client used by the Automation tester how wants to reduce the manual testing efforts. It provides the visual test option where automation suite can be easily created with no coding knowledge.
Where as a scripting option provides extra advantage power and flexibility to the automation suite. Visual tests can be combined with the VB.NET scripts to enhance the suite. However with Silk Test Workbench functional flows/test case can be recorded for system under test to create tests which can be further enhance by adding verifications and test logic, and play back the tests to ensure that the applications work as per the expectation.
Silk test methodology is a six-phase testing process:
Visual tests can be a series of simple recorded actions, or they can be complex, involving function calls or ActiveData.
Recording is the best way to quickly create visual tests. During recording, all actions except interaction with Silk Test Workbench are recorded. However, it is possible to interrupt recording to insert verification. You can modify a visual test after initial recording is finished.
Silk Test Workbench uses scripts in the same manner as visual tests to mimic the actions that are performed while testing an application. It controls an application or Web page in the same way that a user would by using keystrokes and mouse actions to select menus, list items, and buttons. During recording, Silk Test Workbench generates all of the keystrokes and mouse clicks that test the application.
Silk Test Workbench's scripting language is Microsoft's Visual Basic, a robust programming language that gives you total control over any application running in the Microsoft .NET framework. .NET scripts contain the functionality of a high-level programming language as well as features designed specifically for software control and testing. Using the language, you can develop scripts that:
The actions taken to test an application, making menu selections, typing data, checking the way it is processed, and so on, are represented in scripts as VB.NET commands. These commands are inserted into a script and can be modified and played back.
Silk Test Workbench lets you quickly record and playback scripts. Modify scripts to include “hand-coded” statements that cannot be recorded, to make amendments to reflect changes in the test application, or to create new scripts by cutting and pasting code from existing scripts. You can also use the Identify Object dialog box to record locators or object map items for individual objects and then use the locator or object map item in a script.
Recording is the best way to quickly create scripts. Recording enables you to become familiar with how Silk Test Workbench generates code for scripts. This provides familiarity with the basics of script creation, which then allows better understanding of creating efficient test solutions, modularizing scripts, and creating independent code modules.
Scripts records each and every action performed by the user at object level. Scripts are been recorded for each test steps that includes the menu selection from the dropdown, typing the test data in the text field, clicking a button or icons or links and verifying the test results.
Below are the advantages for maintaining test procedures in scripts
While creating the test script there are few general guidelines that might help to create test scripts that are maintainable, reusable, and lead to stable tests.
An object map is a test asset that contains items that associate a logical name (an alias) with a control or a window, rather than the control or window's locator. Once a control is registered in an object map asset, all references to it in visual tests and scripts are made by its alias, rather than by its actual locator name.
You can use object maps to store objects that you are using often in multiple scripts. Multiple tests can reference a single object map item definition, which enables you to update that object map definition once and have Silk Test Workbench update it in all tests that reference the object map definition.
In your scripts, you can mix object map identifiers and locators. This feature enables you to keep your object maps relatively small and easier to manage. You can simply store the commonly used objects in your object maps, and use locators to reference objects that are rarely used.
Tip: To optimally use the functionality that object maps provide, create an individual project in Silk Test Workbench for each application that you want to test.
Example for object maps
The following construct shows a definition for a BrowserWindow where the locator is used:
_desktop.BrowserApplication("cnn_com").BrowserWindow("//BrowserWindow[1]")
The name of the object map asset is cnn_com. The locator that can be substituted by an alias in the object map is the following:
"//BrowserWindow[1]"
The object map entry for the BrowserWindow is BrowserWindow.
The resulting definition of the BrowserWindow in the script is the following:
_desktop.BrowserApplication("cnn_com").BrowserWindow("BrowserWindow")
If the index in the locator changes, you can just change the alias in the object map, instead of having to change every appearance of the locator in your test script. Silk Test Workbench will update all tests that reference the object map definition.
Object maps have the following advantages:
You can configure Silk Test Workbench to use the locator name or the alias from the object map during recording.
To use the alias from the object map during recording:
This behavior has the following benefits:
You can use image recognition in the following situations:
If you want to click on a control that is otherwise not recognizable, you can use the ImageClick method with an image asset. If you want to verify that an otherwise not recognizable control exists in your application under test, you can use the VerifyAsset method with an image verification.
Image recognition methods are supported for all technology domains that are supported by Silk Test Workbench.
You can use image assets in the following situations:
Image assets consist of an image with some additional information that is required by Silk Test Workbench to work with the asset.
You can create image verifications in one of the following ways:
When the execution of an image verification in a visual test or a script fails, you can open the Image Verification Differences View to examine the differences between the expected image and the actual image found in the application under test.
To open the Image Verification Differences View, perform the following steps:
Keyword driven testing helps non techies i.e. business analysts to get involved in automation testing
Silk Central and Silk Test support the keyword-driven testing methodology.
Keyword driven test is set of executable keywords and been executed just like any other normal test script.
There are two steps involved while creating keyword-driven tests:
The advantages of using the keyword-driven testing methodology are the following:
You can pass parameters between keywords and you can pass back values from a keyword, which is implemented as a visual test or a .NET script. You cannot pass back the value of visual test global variables to a keyword, as these variables are managed by the visual test execution engine and are not visible to .NET scripts and keywords.
On top of keyword list recommended keywords are been listed down which are been indicated by a bar graph with the filled-out portion of the graph corresponding
Based on the following point Silk Test Workbench is been recommended
With Silk Test Workbench, you can replay tests against web applications that use:
You can record tests for web applications using one of the following browsers:
When recording a script for cross-browser testing, Micro Focus recommends using Google Chrome, Mozilla Firefox, or Microsoft Edge, as a script recorded with Silk Test Workbench against Internet Explorer might slightly differ in comparison to a script recorded on one of the other browsers.
To repeatedly play back visual tests and scripts using data other than the literal data, you must modify the visual tests or scripts to use different data values.
ActiveData testing enables you to leverage existing data as input for powerful, comprehensive application testing solutions. With ActiveData, you can perform multiple transactions against test applications using a different set of data for each transaction without writing complicated code or compromising existing data.
You can write new data to existing data files without having to edit those data files manually.
Using ActiveData, testers can input valid or non-valid data into the test application and verify the results. This means fewer visual tests or scripts are needed to carry out a series of test conditions and less maintenance overhead.
Application testing often involves inserting data into controls in the application under test (AUT), then processing the data, and finally reporting results to ensure the AUT works as expected. Entering data while recording a test and replaying the test without any further modifications only validates that the AUT works as expected with the specific data set.
To help you in creating tests that test your AUT against a wide variety of supported scenarios and edge cases, instead of having to record individual tests for each scenario, Silk Test Workbench includes the ActiveData testing feature, which offers the following benefits:
Visual tests provide the following advantages:
Silk Test Workbench provides the following features to support you when you are working with custom controls:
With the help of Dynamic Invoke methods can be called directly, properties can be retrieved or even properties can be set in the application under test. Moreover methods and its propertied can be called even though they are not available in the Silk Test Workbench API for this control.
In visual tests Dynamic invoke is not available.
Understanding the syntax of recorded script lines makes scripts easier to read. Commands that test objects are composed of identical syntax elements. The syntax elements include a With statement for the application windows, such as the main application window or dialog boxes, followed by a locator or object map item that identifies the class, attribute, and action.
Using Object Maps
An object map is a test asset that contains items that associate a logical name (an alias) with a control or a window, rather than the control or window's locator.
By default, Silk Test Workbench includes object map items in the script context when you record a script.
The following example shows a typical recorded action in a script that tests a Web application.
With _desktop.BrowserApplication("webBrowser") With .BrowserWindow("browserWindow") .DomListBox("quickLinkJumpMenu").Select("Auto Quote") End With End With
The With_ desktop.<application> portion identifies the main application window.
The DomListBox portion in the previous example identifies the class to use.
The ("quickLinkJumpMenu") portion identifies the attribute for the object. In this case, the attribute identifies the list box link menu. While the Select() portion identifies the action or command to perform against the object.
After the initial With command is defined, you do not need to repeat it in additional calls for that window. For each additional window that you test, you must specify a With statement. For example, the following code shows how multiple windows are called within the same script:
With _desktop.Window("untitledNotepad") .MenuItem("aboutNotepad").Select() With .Dialog("aboutNotepadDialog") .PushButton("ok").Select() End With End With
Object map items are enclosed in parentheses and quotation marks ("") and replace the need to use locator captions.
Using Locators
Within Silk Test Workbench, literal references to identified objects are referred to as locators. By default, Silk Test Workbench includes object map items in the script context when you record a script. If you turn off object maps, locators are included in the script context instead of object map items when you record a script.
The following example shows a typical recorded action in a script that tests a Web application.
With _desktop.BrowserWindow("/BrowserApplication[1]//BrowserWindow") .DomLink("@textContents='Court: Gender pay lawsuit can go to trial'").Select() End With The With_ desktop.<application> portion identifies the main application window.
The DomLink portion in the first example and the MenuItem portion in the second example identifies the class to use.
The ("@textContents='Court: Gender pay lawsuit can go to trial'") portion identifies the attribute for the object. In this case, the attribute identifies the text content. While the Select() portion identifies the action or command to perform against the object.
After the initial With command is defined, you do not need to repeat it in additional locator strings for that window. For each additional window that you test, you must specify a With statement. For example, the following code shows how multiple windows are called within the same script:
With _desktop.Window("@caption='Untitled - Notepad'") .MenuItem("@caption='About Notepad'").Select() With .Dialog("@caption='About Notepad'") .PushButton("@caption='OK'").Select() End With End With
The caption attribute identifies the objects to test. The caption identifies the main application window ("@caption='Untitled - Notepad'") followed by the menu item ("@caption='About Notepad'"), the subsequent dialog box ("@caption='About Notepad'"), and the button ("@caption='OK'") to click.
When you record a script, a base state is automatically recorded that starts the application that you want to test. However, if your script tests multiple applications or you turn off the Execute base state functionality for any reason, you must start the test application from within your script.
Note: If the executable for the application that you want to test is in the same directory as Silk Test Workbench, you do not need to specify the full path.
The entire script to start Internet Explorer and go to Yahoo.com looks like the following:
Imports System Imports System.Diagnostics Public Module Main Public Sub Main() Dim _desktop As Desktop = Agent.Desktop Dim ieProcess As New Process() Dim psi As New ProcessStartInfo() psi.FileName = "C:\Program Files\Internet Explorer\iexplore.exe" psi.Arguments = "http://www.yahoo.com" ieProcess.StartInfo = psi ieProcess.Start() End Sub End Module
Assuming the table has a hierarchical structure similar to HTML, you should be able to do the following:
Putting it all together, you'll get a locator like //WPFDataGridCell[@text='Obama']/..//WPFHyperLink[@caption='Default'].
Unfortunately it’s not possible to use action recording for uploading the file, but there are ways to achieve this via scripting
With _desktop.BrowserApplication() With .BrowserWindow() .DomTextField("//INPUT[@id='file-upload']").TypeKeys("c:\temp\test.txt") .DomButton("//INPUT[@id='file-submit']").Click() Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text) End With End With
Or you can click on the upload control to bring up the "File Open" dialog and then automate that via the Win32 API
With _desktop.BrowserApplication() With .BrowserWindow() .DomTextField("//INPUT[@id='file-upload']").Click() End With End With With _desktop.Dialog("@caption='Open'") .TextField("@caption='File name:'").SetText("c:\temp\test.txt") .PushButton("@caption='Open'").Select() End With With _desktop.BrowserApplication() With .BrowserWindow() .DomButton("//INPUT[@id='file-submit']").Click() Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text) End With End With
You could add a timer to the code that uses SendKeys.SendWait - like this - adapting it a little for your test environment
Dim WithEvents timer1 As New System.Timers.Timer timer1.Interval = 5000 timer1.Enabled = True MsgBox("Hello. I will go bye-bye in 5 seconds.") timer1.Enabled = False
And as a separate sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Elapsed SendKeys.SendWait("{ENTER}") End Sub
It is known as ActiveData in silk test Workbench
It allows enhancing your visual tests with external data, for example from an Excel file.
ActiveData testing enables you to leverage existing data in external files as input for powerful, comprehensive application testing solutions. ActiveData testing enables you to perform multiple transactions against test applications using a different set of data for each transaction without writing complicated code or compromising existing data.
We can use cascading dynamicInvoke-calls to access the elements in the LegendCollection.
We can then also access properties of that element if the default ToString().
You might want to not use the generated IDs as identifies in the test scripts. Therefore you can tell SilkTest to not use the "id" attribute when it creates an locator (e.g during recording).
You can do this as follows:
In SilkTest Workbench: Open Tools > Options > Record > xBrowser. Add id attribute to the "Locator attribute name exclude list" text field
When you delete a test script or a visual test that includes object map entries, the associated object maps are not changed. All object map entries are persisted
It is recommended to create the object maps during the recording of a test. However, you can also create an empty object map and manually add object map entries to this map.
To create a new object map, right-click on Object map in the Asset Browser and select New Object map.
Method | Description |
---|---|
ImageClick | Clicks in the middle of the image that is specified in an asset. Waits until the image is found or the Object resolve timeout, which you can define in the synchronization options, is over. |
ImageExists | Returns whether the image that is specified in an asset exists. |
ImageRectangle | Returns the object-relative rectangle of the image that is specified in an asset. |
ImageClickFile | Clicks on the image that is specified in a file. |
ImageExistsFile | Returns whether the image that is specified in a file exists. |
ImageRectangleFile | Returns the object-relative rectangle of the image that is specified in a file. |
VerifyAsset | Executes a verification asset. Throws a VerificationFailedException if the verification does not pass. |
Method | Description |
---|---|
ImageClick | Clicks in the middle of the specified image asset. Waits until the image is found or the Object resolve timeout, which you can define in the synchronization options, is over. |
ImageExists | Returns whether the specified image asset exists. |
ImageRectangle | Returns the object-relative rectangle of the specified image asset. |
Software testing is a very vast concept but basically categorized into two: manual testing and automated testing.
Both manual and automated testing is having advantages benefits and disadvantages.
Manual Testing | Automation Testing |
---|---|
Less Reliable - Manual Testing is not accurate at all times due to human error, hence it is less reliable | More Reliable - Automated testing is more reliable, as it is performed by tools or scripts’. |
Time Consuming - Manual testing is time-consuming taking up human resources | Time Saving - Automated testing is executed by software tools so it is significantly faster than a manual approach |
Resource Availability - Manual testing allows for human observation, which may be more useful if the goal is user-friendliness or improved customer experience | Resource Unavailability- Automation testing does not entail human observation |
Regression Testing: Here, automated testing is suitable because of frequent code changes and the ability to run the regressions in a timely manner.
Load Testing: Automated testing is also the best way to complete the testing efficiently when it comes to load testing.
Repeated Execution: Testing which requires the repeated execution of a task is best automated.
Performance Testing: Similarly, testing which requires the simulation of thousands of concurrent users requires automation.
Silk Test is the Silk Test client used by the Automation tester how wants to reduce the manual testing efforts. It provides the visual test option where automation suite can be easily created with no coding knowledge.
Where as a scripting option provides extra advantage power and flexibility to the automation suite. Visual tests can be combined with the VB.NET scripts to enhance the suite. However with Silk Test Workbench functional flows/test case can be recorded for system under test to create tests which can be further enhance by adding verifications and test logic, and play back the tests to ensure that the applications work as per the expectation.
Silk test methodology is a six-phase testing process:
Visual tests can be a series of simple recorded actions, or they can be complex, involving function calls or ActiveData.
Recording is the best way to quickly create visual tests. During recording, all actions except interaction with Silk Test Workbench are recorded. However, it is possible to interrupt recording to insert verification. You can modify a visual test after initial recording is finished.
Silk Test Workbench uses scripts in the same manner as visual tests to mimic the actions that are performed while testing an application. It controls an application or Web page in the same way that a user would by using keystrokes and mouse actions to select menus, list items, and buttons. During recording, Silk Test Workbench generates all of the keystrokes and mouse clicks that test the application.
Silk Test Workbench's scripting language is Microsoft's Visual Basic, a robust programming language that gives you total control over any application running in the Microsoft .NET framework. .NET scripts contain the functionality of a high-level programming language as well as features designed specifically for software control and testing. Using the language, you can develop scripts that:
The actions taken to test an application, making menu selections, typing data, checking the way it is processed, and so on, are represented in scripts as VB.NET commands. These commands are inserted into a script and can be modified and played back.
Silk Test Workbench lets you quickly record and playback scripts. Modify scripts to include “hand-coded” statements that cannot be recorded, to make amendments to reflect changes in the test application, or to create new scripts by cutting and pasting code from existing scripts. You can also use the Identify Object dialog box to record locators or object map items for individual objects and then use the locator or object map item in a script.
Recording is the best way to quickly create scripts. Recording enables you to become familiar with how Silk Test Workbench generates code for scripts. This provides familiarity with the basics of script creation, which then allows better understanding of creating efficient test solutions, modularizing scripts, and creating independent code modules.
Scripts records each and every action performed by the user at object level. Scripts are been recorded for each test steps that includes the menu selection from the dropdown, typing the test data in the text field, clicking a button or icons or links and verifying the test results.
Below are the advantages for maintaining test procedures in scripts
While creating the test script there are few general guidelines that might help to create test scripts that are maintainable, reusable, and lead to stable tests.
An object map is a test asset that contains items that associate a logical name (an alias) with a control or a window, rather than the control or window's locator. Once a control is registered in an object map asset, all references to it in visual tests and scripts are made by its alias, rather than by its actual locator name.
You can use object maps to store objects that you are using often in multiple scripts. Multiple tests can reference a single object map item definition, which enables you to update that object map definition once and have Silk Test Workbench update it in all tests that reference the object map definition.
In your scripts, you can mix object map identifiers and locators. This feature enables you to keep your object maps relatively small and easier to manage. You can simply store the commonly used objects in your object maps, and use locators to reference objects that are rarely used.
Tip: To optimally use the functionality that object maps provide, create an individual project in Silk Test Workbench for each application that you want to test.
Example for object maps
The following construct shows a definition for a BrowserWindow where the locator is used:
_desktop.BrowserApplication("cnn_com").BrowserWindow("//BrowserWindow[1]")
The name of the object map asset is cnn_com. The locator that can be substituted by an alias in the object map is the following:
"//BrowserWindow[1]"
The object map entry for the BrowserWindow is BrowserWindow.
The resulting definition of the BrowserWindow in the script is the following:
_desktop.BrowserApplication("cnn_com").BrowserWindow("BrowserWindow")
If the index in the locator changes, you can just change the alias in the object map, instead of having to change every appearance of the locator in your test script. Silk Test Workbench will update all tests that reference the object map definition.
Object maps have the following advantages:
You can configure Silk Test Workbench to use the locator name or the alias from the object map during recording.
To use the alias from the object map during recording:
This behavior has the following benefits:
You can use image recognition in the following situations:
If you want to click on a control that is otherwise not recognizable, you can use the ImageClick method with an image asset. If you want to verify that an otherwise not recognizable control exists in your application under test, you can use the VerifyAsset method with an image verification.
Image recognition methods are supported for all technology domains that are supported by Silk Test Workbench.
You can use image assets in the following situations:
Image assets consist of an image with some additional information that is required by Silk Test Workbench to work with the asset.
You can create image verifications in one of the following ways:
When the execution of an image verification in a visual test or a script fails, you can open the Image Verification Differences View to examine the differences between the expected image and the actual image found in the application under test.
To open the Image Verification Differences View, perform the following steps:
Keyword driven testing helps non techies i.e. business analysts to get involved in automation testing
Silk Central and Silk Test support the keyword-driven testing methodology.
Keyword driven test is set of executable keywords and been executed just like any other normal test script.
There are two steps involved while creating keyword-driven tests:
The advantages of using the keyword-driven testing methodology are the following:
You can pass parameters between keywords and you can pass back values from a keyword, which is implemented as a visual test or a .NET script. You cannot pass back the value of visual test global variables to a keyword, as these variables are managed by the visual test execution engine and are not visible to .NET scripts and keywords.
On top of keyword list recommended keywords are been listed down which are been indicated by a bar graph with the filled-out portion of the graph corresponding
Based on the following point Silk Test Workbench is been recommended
With Silk Test Workbench, you can replay tests against web applications that use:
You can record tests for web applications using one of the following browsers:
When recording a script for cross-browser testing, Micro Focus recommends using Google Chrome, Mozilla Firefox, or Microsoft Edge, as a script recorded with Silk Test Workbench against Internet Explorer might slightly differ in comparison to a script recorded on one of the other browsers.
To repeatedly play back visual tests and scripts using data other than the literal data, you must modify the visual tests or scripts to use different data values.
ActiveData testing enables you to leverage existing data as input for powerful, comprehensive application testing solutions. With ActiveData, you can perform multiple transactions against test applications using a different set of data for each transaction without writing complicated code or compromising existing data.
You can write new data to existing data files without having to edit those data files manually.
Using ActiveData, testers can input valid or non-valid data into the test application and verify the results. This means fewer visual tests or scripts are needed to carry out a series of test conditions and less maintenance overhead.
Application testing often involves inserting data into controls in the application under test (AUT), then processing the data, and finally reporting results to ensure the AUT works as expected. Entering data while recording a test and replaying the test without any further modifications only validates that the AUT works as expected with the specific data set.
To help you in creating tests that test your AUT against a wide variety of supported scenarios and edge cases, instead of having to record individual tests for each scenario, Silk Test Workbench includes the ActiveData testing feature, which offers the following benefits:
Visual tests provide the following advantages:
Silk Test Workbench provides the following features to support you when you are working with custom controls:
With the help of Dynamic Invoke methods can be called directly, properties can be retrieved or even properties can be set in the application under test. Moreover methods and its propertied can be called even though they are not available in the Silk Test Workbench API for this control.
In visual tests Dynamic invoke is not available.
Understanding the syntax of recorded script lines makes scripts easier to read. Commands that test objects are composed of identical syntax elements. The syntax elements include a With statement for the application windows, such as the main application window or dialog boxes, followed by a locator or object map item that identifies the class, attribute, and action.
Using Object Maps
An object map is a test asset that contains items that associate a logical name (an alias) with a control or a window, rather than the control or window's locator.
By default, Silk Test Workbench includes object map items in the script context when you record a script.
The following example shows a typical recorded action in a script that tests a Web application.
With _desktop.BrowserApplication("webBrowser") With .BrowserWindow("browserWindow") .DomListBox("quickLinkJumpMenu").Select("Auto Quote") End With End With
The With_ desktop.<application> portion identifies the main application window.
The DomListBox portion in the previous example identifies the class to use.
The ("quickLinkJumpMenu") portion identifies the attribute for the object. In this case, the attribute identifies the list box link menu. While the Select() portion identifies the action or command to perform against the object.
After the initial With command is defined, you do not need to repeat it in additional calls for that window. For each additional window that you test, you must specify a With statement. For example, the following code shows how multiple windows are called within the same script:
With _desktop.Window("untitledNotepad") .MenuItem("aboutNotepad").Select() With .Dialog("aboutNotepadDialog") .PushButton("ok").Select() End With End With
Object map items are enclosed in parentheses and quotation marks ("") and replace the need to use locator captions.
Using Locators
Within Silk Test Workbench, literal references to identified objects are referred to as locators. By default, Silk Test Workbench includes object map items in the script context when you record a script. If you turn off object maps, locators are included in the script context instead of object map items when you record a script.
The following example shows a typical recorded action in a script that tests a Web application.
With _desktop.BrowserWindow("/BrowserApplication[1]//BrowserWindow") .DomLink("@textContents='Court: Gender pay lawsuit can go to trial'").Select() End With The With_ desktop.<application> portion identifies the main application window.
The DomLink portion in the first example and the MenuItem portion in the second example identifies the class to use.
The ("@textContents='Court: Gender pay lawsuit can go to trial'") portion identifies the attribute for the object. In this case, the attribute identifies the text content. While the Select() portion identifies the action or command to perform against the object.
After the initial With command is defined, you do not need to repeat it in additional locator strings for that window. For each additional window that you test, you must specify a With statement. For example, the following code shows how multiple windows are called within the same script:
With _desktop.Window("@caption='Untitled - Notepad'") .MenuItem("@caption='About Notepad'").Select() With .Dialog("@caption='About Notepad'") .PushButton("@caption='OK'").Select() End With End With
The caption attribute identifies the objects to test. The caption identifies the main application window ("@caption='Untitled - Notepad'") followed by the menu item ("@caption='About Notepad'"), the subsequent dialog box ("@caption='About Notepad'"), and the button ("@caption='OK'") to click.
When you record a script, a base state is automatically recorded that starts the application that you want to test. However, if your script tests multiple applications or you turn off the Execute base state functionality for any reason, you must start the test application from within your script.
Note: If the executable for the application that you want to test is in the same directory as Silk Test Workbench, you do not need to specify the full path.
The entire script to start Internet Explorer and go to Yahoo.com looks like the following:
Imports System Imports System.Diagnostics Public Module Main Public Sub Main() Dim _desktop As Desktop = Agent.Desktop Dim ieProcess As New Process() Dim psi As New ProcessStartInfo() psi.FileName = "C:\Program Files\Internet Explorer\iexplore.exe" psi.Arguments = "http://www.yahoo.com" ieProcess.StartInfo = psi ieProcess.Start() End Sub End Module
Assuming the table has a hierarchical structure similar to HTML, you should be able to do the following:
Putting it all together, you'll get a locator like //WPFDataGridCell[@text='Obama']/..//WPFHyperLink[@caption='Default'].
Unfortunately it’s not possible to use action recording for uploading the file, but there are ways to achieve this via scripting
With _desktop.BrowserApplication() With .BrowserWindow() .DomTextField("//INPUT[@id='file-upload']").TypeKeys("c:\temp\test.txt") .DomButton("//INPUT[@id='file-submit']").Click() Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text) End With End With
Or you can click on the upload control to bring up the "File Open" dialog and then automate that via the Win32 API
With _desktop.BrowserApplication() With .BrowserWindow() .DomTextField("//INPUT[@id='file-upload']").Click() End With End With With _desktop.Dialog("@caption='Open'") .TextField("@caption='File name:'").SetText("c:\temp\test.txt") .PushButton("@caption='Open'").Select() End With With _desktop.BrowserApplication() With .BrowserWindow() .DomButton("//INPUT[@id='file-submit']").Click() Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text) End With End With
You could add a timer to the code that uses SendKeys.SendWait - like this - adapting it a little for your test environment
Dim WithEvents timer1 As New System.Timers.Timer timer1.Interval = 5000 timer1.Enabled = True MsgBox("Hello. I will go bye-bye in 5 seconds.") timer1.Enabled = False
And as a separate sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Elapsed SendKeys.SendWait("{ENTER}") End Sub
It is known as ActiveData in silk test Workbench
It allows enhancing your visual tests with external data, for example from an Excel file.
ActiveData testing enables you to leverage existing data in external files as input for powerful, comprehensive application testing solutions. ActiveData testing enables you to perform multiple transactions against test applications using a different set of data for each transaction without writing complicated code or compromising existing data.
We can use cascading dynamicInvoke-calls to access the elements in the LegendCollection.
We can then also access properties of that element if the default ToString().
You might want to not use the generated IDs as identifies in the test scripts. Therefore you can tell SilkTest to not use the "id" attribute when it creates an locator (e.g during recording).
You can do this as follows:
In SilkTest Workbench: Open Tools > Options > Record > xBrowser. Add id attribute to the "Locator attribute name exclude list" text field
When you delete a test script or a visual test that includes object map entries, the associated object maps are not changed. All object map entries are persisted
It is recommended to create the object maps during the recording of a test. However, you can also create an empty object map and manually add object map entries to this map.
To create a new object map, right-click on Object map in the Asset Browser and select New Object map.
Method | Description |
---|---|
ImageClick | Clicks in the middle of the image that is specified in an asset. Waits until the image is found or the Object resolve timeout, which you can define in the synchronization options, is over. |
ImageExists | Returns whether the image that is specified in an asset exists. |
ImageRectangle | Returns the object-relative rectangle of the image that is specified in an asset. |
ImageClickFile | Clicks on the image that is specified in a file. |
ImageExistsFile | Returns whether the image that is specified in a file exists. |
ImageRectangleFile | Returns the object-relative rectangle of the image that is specified in a file. |
VerifyAsset | Executes a verification asset. Throws a VerificationFailedException if the verification does not pass. |
Method | Description |
---|---|
ImageClick | Clicks in the middle of the specified image asset. Waits until the image is found or the Object resolve timeout, which you can define in the synchronization options, is over. |
ImageExists | Returns whether the specified image asset exists. |
ImageRectangle | Returns the object-relative rectangle of the specified image asset. |
Submitted questions and answers are subjecct to review and editing,and may or may not be selected for posting, at the sole discretion of Knowledgehut.