Responsive Web Design Testing

Desktop web applications which are built based upon responsive web design might change their appearance in response to the size of the screen or web browser in which these applications are displayed. Choosing the appropriate size of the replay window might have significant impact on the stability of such tests.

Silk Test Workbench enables you to specify the exact size of the browser window in the following situations:
  • When you create a new project for a web application.
  • When you create a new visual test or .NET script.
  • When you record a new test.
  • When you record actions into an existing test.
  • When you replay a test against a web application.
You can use the following settings to specify the size of the browser window:
  • The Browser size list contains a mix of predefined and custom browser window sizes, enabling you to select the size on which you want to test.
  • The Orientation list enables you to select whether you want the browser window to use landscape or portrait orientation.
  • Click Edit Browser Sizes to add custom browser sizes to the Browser size list or to specify which browser sizes are displayed in the list.
    • To add a new custom browser size to the list, click Add Browser Size.
    • To exclude a size from the list, uncheck the corresponding check box.
    • To add the visual breakpoints of a specific web application to the Browser size list, click Detect Visual Breakpoints.

When replaying a test against a web application from the command line or from Silk Central, you can specify the size of the browser viewport by setting the silktest.browserViewportSize environment variable. You can either specify the name of a browser from the Browser Size list or a specific size.

You can change the size of the browser directly in a test script, if Imports SilkTest.ntf.Mobile is defined in the test script:
' VB .NET code
With .BrowserWindow("BrowserWindow")
  .SetViewportName("Google Pixel 2")
  .SetViewportSize(800, 300)
End With

Example: Setting the browser size for automated replay by using the name

The following code sample sets the browser size to SVGA (800, 600) by using the SVGA entry of the Browser size list:
SET silktest.browserViewportSize=name=SVGA;orientation=landscape
STW.exe –script MyScript
You can also specify a specific browser and viewport size by using the following command:
STW –dsn silktest –browser InternetExplorer –script MyScript -viewportname SVGA

Example: Setting the browser size for automated replay by using the width and height

The following code sample sets the browser size to SVGA (800, 600) by using the width and height parameters:
SET silktest.browserViewportSize=width=800;height=600;orientation=landscape
STW.exe –script MyScript
You can also specify a specific browser and viewport size by using the following command:
STW –dsn silktest –browser InternetExplorer –script MyScript -viewportwidth 800 -vieportheight 600