Modifying the Base State from the User Interface

You can edit the base state from the user interface to specify how Silk4J starts an application under test (AUT) during recording and replay. You can specify the executable location of the AUT, the working directory, the URL and the connection string for a web application, and so on. For example, if you want to execute tests on a production web site, which have already been executed on a staging web site, you can simply change the URL in the base state and the tests are executed against the new web site.

Note: To specify how Silk4J starts an application under test (AUT) only for specific tests during replay, edit the base state in the script that contains the tests. For additional information, see Modifying the Base State in a Script.

To edit the base state through the user interface:

  1. Click the drop-down arrow next to the Silk Test toolbar icon Toolbar and choose Edit Application Configurations. The Edit Application Configurations dialog box opens and lists the existing application configurations.
  2. Click Edit to the right of the application configuration that you want to change.
  3. To test a web application or a mobile web application, if you have not set an application configuration for the current project, select one of the installed browsers or mobile browsers from the list. You can also click Change to open the Select Application dialog box and then select the browser that you want to use.
  4. To specify an executable, type the full path to the executable into the Executable field.
    Note: If you are testing a web application, and you want to specify an executable for the browser, select the custom browser type.
    For example, to start Mozilla Firefox, type C:\Program Files (x86)\Mozilla Firefox\firefox.exe.
  5. If you are testing a desktop application and you want to use an executable pattern, type the executable name and file path of the desktop application that you want to test into the Executable Pattern text box. For example, you might type *\calc.exe to specify the Calculator.
  6. If you are testing a desktop application and you want to use a command line pattern in combination with the executable file, type the command line pattern into the Command Line Pattern text box. Using the command line is especially useful for Java applications because most Java programs run by using javaw.exe. This means that when you create an application configuration for a typical Java application, the executable pattern, *\javaw.exe is used, which matches any Java process. Use the command line pattern in such cases to ensure that only the application that you want is enabled for testing. For example, if the command line of the application ends with com.example.MyMainClass you might want to use *com.example.MyMainClass as the command line pattern.
  7. To specify command line arguments, type the arguments into the Command Line Arguments field.
    Note: If you are testing a web application, and you want to start a browser with command line arguments, select the custom browser type.
    For example, to start Mozilla Firefox with the profile myProfile, type -p myProfile.
  8. If you are testing an application which depends on a supplemental directory, specify the path to the directory in the Working directory filed.
    For example, if you use a batch file to start a Java application, the batch file may reference a JAR file that relies on a relative path. In this case, specify a working directory to reconcile the relative path.
  9. If you are testing a desktop application, specify the main window of the application in the Locator field. For example, the locator might look like /Shell[@caption='Swt Test Application'].
  10. If you are testing a web application, type the address of the web application into the Navigate to URL text box.
  11. Optional: If you want to test a web application on a desktop browser with a predefined browser size, select the browser size from the Browser size list.
    For example, to test a web application on Apple Safari and in a browser window which is as big as the screen of the Apple iPhone 7, select Apple iPhone 7 from the list.
  12. Optional: Select an Orientation for the browser window.
  13. Optional: Click Edit Browser Sizes to specify a new browser size and to select which browser sizes should be shown in the Browser size list.
  14. If you are testing a web application or a mobile native application on a remote location, for example on a mobile device that is connected to a Mac, and you want to edit the remote location, click Change to open the Select Application dialog box and then click Edit Remote Locations.
  15. If you are testing a mobile application or a web application on Apple Safari, type the connection string into the Connection String text box. For additional information, see Connection String.
  16. To edit the capabilities for a WebDriver-based browser, you can use the Connection String text box. For example, to start Google Chrome with a maximized browser window, type the following into the Connection String text box:
    chromeOptions={"args":["--start-maximized"]}
    For additional information, see Setting Options and Capabilities for Web-Driver Based Browsers.
  17. If you are testing a mobile native application, specify the application:
    • If you want to install the app on the mobile device or emulator, click Browse to select the app file or enter the full path to the app file into the App file text field. Silk4J supports HTTP and UNC formats for the path.
    • If you want to use an app that is already installed on an Android device, select the app from the Package/Activity list or specify the package and the activity in the Package/Activity field.
    • If you want to use an app that is already installed on an iOS device, specify the Bundle ID.
    • If you want to use an app that is available in Mobile Center, specify the App identifier.
  18. Click OK.
  19. If the application under test usually takes a long time to start, increase the application ready timeout in the replay options.

Executing the base state starts the application if it is not already running. If the application is already running, Silk4J does not start another instance of the application.

If your test includes multiple application configurations and you are modifying an application or Web page other than the object associated with the base state, you can turn off the base state. This indicates that the base state will not be used for recording or replaying the modifications. Therefore, you must record the steps to launch the application or Web page within your test. For instance, if you want to test a Web page, start Internet Explorer within your test.

Note: Do not add more than one browser application configuration when testing a web application with a defined base state.