You can test multi-lang data patterns using the following procedure.
Table of contents
Create data patterns
Move to the Settings > Multi-lang data patterns screen, and download a data pattern template by clicking Export CSV. (figure 1)
Figure 1, Multi-lang data patterns screen.
After describing the data pattern in CSV format in the template, as shown in figure 2, import it by clicking Import CSV.
Figure 2. Data pattern CSV file.
- When editing the CSV, in the case of Mac, you can either use TextEdit, or edit the spreadsheet using an application such as Numbers, LibreOffice, or Excel.
- When you want to edit the imported data, you can export and then import again.
Utilize data patterns
After creating a data pattern, the Multi-lang Data Pattern item will be displayed on the test run settings dialog, allowing the user to select the language pattern to be used in the test. (figure 3)
Figure 3. Select the language pattern.
The language pattern value can be referenced using ${...} in the test script. (figure 4)
Figure 4. Reference language patterns.
References
- Utilize data patterns (Data-driven testing)
- Utilizing Variables > 7. Order in which variables are set
Use case
The figure below illustrates an example of a menu display for a website available in both English and Japanese versions.
Here, let's assume we register a multi-lang data pattern as shown in the figure below and create a test case.
If the locator for "Reserve" is xpath=//a[text()='宿泊予約'] on the Japanese site and xpath=//a[text()='Reserve'] on the English site, you can handle this by including the multi-lang data pattern within the locator.
Please refer to the following for how to add or edit locators:
If the locator does not contain text, such as when a unique ID is assigned, there is no need to modify the locator.
If you want to make the text you're verifying support multiple languages, you can use the multi-lang data pattern within the step.
Include a newline in patterns
It is possible to include a newline in multi-lang patterns.
To include a newline, enclose the pattern in double quotation marks (""), and make sure the newline character is placed within the quotation marks.
Figure 5. A CSV file containing a newline in multi-lang patterns