This play includes tips for organizing, writing, and running tests in FitNesse for Appian, as well as designing Appian applications for testing with FitNesse. This is intended to complement the existing documentation that comes with FitNesse for Appian. The existing documentation, the FitNesse for Appian Cheat Sheet, and examples can be accessed from the FitNesse for Appian home page, shown below.
It is highly recommended to read the FitNesse for Appian documentation before reading this play to have the necessary context for the best practices described. For more general FitNesse documentation, visit the FitNesse Full Reference Guide.
For additional information on Automated Testing with FitNesse, visit the Automated Testing and Automated Testing with FitNesse for Appian pages.
FitNesse is comprised of Static, Suite, and Test pages. The image below shows examples of each type of page and how they are used. More information on each page type and what they should include can be found in the “Organizing Tests” page of the FitNesse for Appian documentation and the FitNesse documentation on page properties.
Scenarios are reusable test scripts used to reduce the maintenance effort for repetitive tests. Scenarios are to FitNesse what a reusable expression rule is to Appian. If the same test script is repeated on several test pages, this script should be made into a scenario so that any changes to it will be reflected in all of its implementations. Note that scenarios can contain other scenarios.
A list of scenarios, called a “ScenarioLibrary,” can be created as a Test Page. This library can then be called by other Test Pages. The ScenarioLibrary Test Page can be located on a Static Page where other utility scripts are called, such as the Set up and Tear Down scripts (as pictured in Fig. 2). The image below demonstrates the structure of the ScenarioLibrary and how a Test Page calls its scenarios within the test flow. For more information on where the ScenarioLibrary is kept and used, refer to the “Scenarios” and “Organizing Tests” pages of the FitNesse for Appian documentation and the Scenario Table page in the FitNesse documentation.
The primary Static page, shown below, is where Test Pages, Scenario Library, and Set Up/Tear Down scripts are located. Users can select Test Pages to edit or execute their tests. Users can select the Scenario Library link to edit the various scenario scripts that will be called from the Test Pages. The Suite Set up, Set Up and Tear Down scripts are used to initialize and cleanup Selenium drivers. Learn more about special pages like SuiteSetUp and SuiteTearDown in the FitNesse documentation.
Any script that should be executed before a Test Page should go into SetUp, and every script that should be executed after every Test Page should go into TearDown. See the figure below to understand how these tables are related to a Test or Suite Page.
Note: The Suite Set Up script initializes the test by navigating to the desired URL. So, the Suite Set Up script is specific to a single environment and will need to be adjusted for testing in new environments.
FitNesse for Appian includes a link to “FitNesse for Appian Cheat Sheet” at the bottom of the page, as shown in the image below. The Cheat Sheet lists all available methods for writing test scripts with formatting examples.
Some considerations to take when writing tests:
In Fitnesse, test data can be substituted with variables when needed. When creating test scripts or scenarios, it is a best practice to avoid hard-coding test data, which requires users to manually locate and update the test values whenever a change is needed. Instead, use variables to keep test data values in one place at the top of the script. Doing so will make changing test data easier and reduce the risk of errors when tests need to be updated. More detailed information on variables in FitNesse for Appian can be found in the “Using Variables” page of the FitNesse for Appian documentation.
There are three ways to use variables:
If tests rely on data or processes to be in a certain state, it is useful to create the following two web API's per application: one to set up the test data, and the other one to clean up the test data. Test scripts can call these web APIs using “|get web api|” syntax which can be found in the FitNesse for Appian Cheat Sheet. Web APIs used for testing purposes should not be deployed to a Production environment.
Web API for Setting Up Test Data: If a test requires an existing approval task, or a record to be in a certain status before testing can proceed, those will need to be set up ahead of time. Web APIs can be used to generate data and write to tables, or to kick off processes, depending on what is required.
Web API for Cleaning Up Test Data: After tests are run and test data is no longer needed, a web API can be used to delete test data and clean up any changes in the app.
FitNesse for Appian generally utilizes field labels and indexes to identify and populate Appian components. However, more graphical clickable components such as rich text icons and cards do not have labels and are identified by other properties, like link labels, alt text, and accessibility text. Although these properties do not impact what the end user sees, it is a best practice to populate them with values that are intuitive to an end user or tester so that:
To achieve the above, follow these guidelines:
Example FitNesse Script: