Function Automation Test Cases
Creating a Function Automation Test Case
Test case designers can create function automation cases.
- On the Case Management page, click Function Automation and then click Create.
Figure 1 Function Automation
- Enter the required information and click OK. Parameters marked with a red asterisk(*) are mandatory.
Table 1 Parameters for creating a function automation test case Parameter
Description
Requirement Description
Select a value that a binary scan test case belongs to from the drop-down list.
Case Name
Enter a name for the test case. It is recommended that you standardize the test case name so that the function can be reflected in the test case name.
Deployment Environments
Select the environment for deploying the test case from the drop-down list based on the associated requirement.
Priority
Select the importance level of the test case from the drop-down list.
Description
Describe the test case.
Prerequisites
Enter the prerequisites for executing the test case.
Expected Result
Enter the expected result of each step.
Attachments
Upload the associated files required by the test case.
Test Script Attachment
Upload the compressed test script file of the test case. The following is an example of the test script attachment:testcase ├── __init__.py ├── entry.py ├── case_01.py ├── case_02.py └── sub_dir_01 ├── __init__.py ├── case_01.py └── case_02.py
In this example, the testcase folder is compressed into a .zip package and used as the test script attachment.
Script Path
Enter the relative path of the script execution entry file in the script attachment, for example, testcase/entry.py.
Test with UI
Determine whether you want the script to contain the test on the UI.
Automatic Script Compilation Guide
The compilation of HaydnCSF-compatible function automation scripts must be based on the Pi-Star automation framework. The function automation test case compilation guide and sample code have been released in the solution acceleration field.
Adding Environment Parameters
Environment parameters are used during test case execution. For example, you can set the user name and password required in the function automation script as environment parameters and directly reference them in the script.
- On the function automation test case list page, click View Environment Parameters. In the displayed dialog box, click Add Environment Parameter. In the displayed dialog box, enter the environment name and description, and click OK.
Figure 2 Environment parameters for function automation
- Click Add, enter the parameter name and value, read and agree to the Privacy Policy Statement and HaydnCSF Solution Digital Platform Service Statement, and click OK. (Multiple lines can be added.)
If there are multiple environment parameters, these marked with a pin are default environment parameters. You can click the pin or setting an icon to set the environment parameters to default parameters.
- Parameter Name: The script obtains parameters by referencing parameter names.
- Value: The script obtains the parameter values by referencing the parameter names.
If a parameter needs to be encrypted, select the encryption icon next to the Description column. In the displayed dialog box, click OK.
Uploading an Automation Script Dependency Package
You can upload dependency packages that are missing in the Python script execution environment of HaydnCSF. On the function automation test case list page, click More and then select Upload Automation Script Dependency Package. In the displayed dialog box, click Upload Attachment, select a file, and click OK.
For details about the attachment requirements, see the description in the dialog box for uploading the dependency package.
![](https://support.huaweicloud.com/intl/en-us/usermanual-haydncsf/en-us_image_0000001583161081.png)
Executing Function Automation Test Cases
After a function automation test case is created, the test case executor can directly execute the test case without submitting the test case design.
![](https://support.huaweicloud.com/intl/en-us/usermanual-haydncsf/en-us_image_0000001583170437.png)
- Executing a Single Case
- Use default environment parameters to execute the test case.
Locate the test case and choose More > Execute in the Operation column. Default environment parameters are used to execute the test case.
- Select environment parameters and execute the test case. This method is suitable to the scenario where multiple groups of environment parameters are set. You can customize the environment parameters.
- Use default environment parameters to execute the test case.
- Executing Multiple Cases
Execute a suite of test cases at a time.
- On the function automation test case list page, click More and then select Manage Suite.
- On the displayed page, click Create Suite.
- Enter the suite name and click Add. In the dialog box that is displayed, select the test cases to be added to the suite and click OK. After the configuration, click OK.
Figure 5 Creating a suite
- On the test case execution management page, locate the suite and click Execute (default environment parameters) or click Execute Environment Parameters by Group to select an environment parameter group.
Viewing Execution Results
- Click the test case name or go to the suite management page and click the suite name to view the execution results.
- Click each step to view the execution result of each step.
Figure 6 Viewing the execution results
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot