Automated Test Tool

Last Updated on : 2024-06-17 08:41:59download

Tuya IPC SDK automated test tool can easily run automated test tasks on the IPC SDK.

Advantages

In the traditional tests, main process regression and other test tasks were repeatedly performed for IP cameras (IPC). For example, video images might be previewed consecutively 100 times in a single test. This was quite time-consuming.

To accelerate the test, you can integrate Tuya IPC SDK automated test tool. This allows users to run a series of test tasks within a few simple steps. During each test, integral execution logs are generated, and at the end of the test, test results are shown, including the total time consumption, success rate, error messages, and other helpful information.

Preparation

Before the IPC SDK automated test tool is used, prepare an IPC that works properly and add the device to the target home.

The IPC SDK automated test tool serves the development as an extension of Tuya IPC SDK. Follow the instructions in Fast Integration with IPC SDK for iOS to integrate Tuya IPC SDK.

Integration

  1. Add the following code block to the Podfile:

    source 'https://github.com/tuya/TuyaPublicSpecs.git'
    
  2. Add the dependency ThingCameraAutomation to the Podfile.

    pod 'ThingCameraAutomation'
    

Usage

The following code block helps to navigate to the IPC SDK automated test tool:

// Imports the header file
#import <ThingCameraAutomation/ThingCameraAutomationPublicViewController.h>

// Navigates to the viewer controller for the use of the test tool.
ThingCameraAutomationPublicViewController *vc = [ThingCameraAutomationPublicViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];

Concepts

Term Description
Task The minimum running unit. It is an API call in most cases. For example, close a peer-to-peer (P2P) connection.
Task chain Multiple tasks are combined to create a task chain. Two types of task chains are available: cyclic and non-cyclic.
Use case Multiple task chains are combined to create a use case. The number of cycles can be set for each use case. This value will be passed to all cyclic task chains in a use case to specify the number of cycles in the cyclic task chains.
Program Multiple use cases are combined to create a program. The number of cycles can be set for each program. This value will be passed to all use cases in a program, and finally to all cyclic task chains in the use cases to specify the number of cycles in the cyclic task chains.

Preview

Page description

Page Description Example
Test programs Displays all available automated test programs. Users can select a program to run it, or tap Case in the top-right corner of the page to view all available use cases. Automated Test Tool
Test program details
  • Displays details of an automated test program. Before running a use case, users can set the number of cycles for a program. Users can also tap a use case to view details, such as the procedure of the use case.
  • Tap Execute at the bottom of the program details page to sequentially run all use cases of the program.
Automated Test Tool
Use cases Displays all available use cases. Users can tap a use case to view its details. Automated Test Tool
Use case details
  • Displays details of a use case. The tasks included in the use case are visually displayed.
  • Before running the use case, you can set the number of cycles for the use case.
  • Tap Execute at the bottom of the use case details page to sequentially run all task chains of the use case.
Automated Test Tool
View execution logs Dynamically displays execution logs of all tasks, running status of use cases, current execution progress, and more test data. Automated Test Tool
Test report
  • After a program or a use case is completed, the test result will be shown, such as the test results of all use cases and basic test information.
  • If test failures occur, the error codes and error messages of all failed use cases will be listed.
  • If a cyclic task chain failed, the results of the stability use case will also be displayed, including the total number of required cycles and the number of exceptions.
  • Click Log in the top-right corner of the page to share the execution logs.
Automated Test Tool

Test process

The following flowchart shows the process of the preceding use case.

Automated Test Tool
  • If one of the tasks of a non-cyclic chain failed, the system will end the current use case, and run the next use case or exit the non-cyclic chain.

  • If one of the tasks of a cyclic chain failed, the system will end the current cycle and start the next cycle without affecting subsequent task chains.

  • A use case is regarded as a failure as long as any of its tasks failed.