Test Execution
The XML-based testing framework is designed to facilitate comprehensive testing across multiple applications or distinct sections of a single application. It leverages a structured approach to define test suites, harnesses, and dependencies, allowing for a high degree of modularity and reusability. By employing the FindNode and assert mechanisms under stest framework, the framework focuses on locating specific elements within the application and validating their properties or behaviors, ensuring that each component functions as expected.
Structure and Components
Test Harness
The Test Harness acts as the top-level container for organizing test execution. It can reference both Test Suite files and other Test Harness files, allowing for a hierarchical organization of tests. This structure enables testers to group tests logically and execute them at varying levels of granularity, depending on the scope and requirements of the testing phase.
Every app must have at least one harness file that includes one or more suite files.
Test Suite
Each Test Suite XML file encapsulates a series of test scripts, each defined with unique identifiers and optional dependencies. The suite includes detailed configurations such as the start date, time, iterations, and a Test Run specification to selectively execute tests.
FindNode and assert
The core of the testing framework lies in its use of FindNode and assert functions within each test script. FindNode is responsible for locating specific elements within the application under test, using identifiers like names, IDs, or other attributes. Once an element is found, assert statements are used to verify its properties, such as text content, color, visibility, or other relevant attributes. This methodical approach ensures that each element not only exists but also behaves as expected, providing a robust mechanism for validating the functionality of complex applications. Assert fail means fail otherwise it is a pass.
Conclusion
This XML-based testing framework offers a powerful and flexible solution for managing extensive testing activities across multiple applications or various sections of a single app. Its hierarchical structure, combined with the precision of FindNode and assert functions, provides a comprehensive toolset for ensuring application quality and reliability. By centralizing test definitions and configurations within XML files, the framework facilitates easy maintenance, scalability, and reusability of test components, making it an invaluable asset for any rigorous testing process.
Example
Test Harness
The Test Harness serves as the root level in our testing hierarchy, orchestrating the execution of multiple test suites and, if necessary, other test harnesses. This allows for a scalable and flexible approach to testing diverse components of our application.
<TestHarness>
<Name>Main Application Test Harness</Name>
<TestSuiteFiles>
<TestSuiteFile path="path/to/ui_tests.suite" />
<TestSuiteFile path="path/to/api_tests.suite" />
<!-- Additional Test Suite files can be added here -->
</TestSuiteFiles>
<TestHarnessFiles>
<!-- If this Test Harness needs to run other Test Harnesses -->
<TestHarnessFile path="path/to/another_harness.harness" />
<!-- Additional Test Harness files can be added here -->
</TestHarnessFiles>
</TestHarness>
Test Suite
Test Suites are collections of Test Scripts that target specific features or functionalities within the application. They are designed to group related tests for efficient execution and management. This version simplified the design and push the ID, dependencies to the scripts.
<TestSuite>
<Name>UI Test Suite</Name>
<AppName>com.example.myapp</AppName>
<Description>User Interface functionality tests for the application</Description>
<TestScripts>
<TestScript prefix="LP">
<Path>tests/ui/login_page_tests.py</Path>
</TestScript>
<TestScript prefix="SM">
<Path>tests/ui/message_sending_tests.py</Path>
</TestScript>
<!-- Additional TestScript entries as needed -->
</TestScripts>
</TestSuite>
Test Execution Configuration (TEC)
This component outlines the dynamic aspects of test execution, such as start times, device specifications, iteration counts, and specific tests to be run. This allows for flexible test execution tailored to various scenarios and requirements.
<TestExecutionConfiguration>
<Target>
<Type>Harness</Type>
<FilePath>path/to/mainApplicationTestHarness.harness</FilePath>
</Target>
<LogConfiguration>
<ReportLogPath>report.log</ReportLogPath>
<ExecutionLogPath>test.log</ExecutionLogPath>
</LogConfiguration>
<StartTime>2024-04-10T08:00:00</StartTime>
<Devices>
<Device name="Pixel 4"/>
<Device androidVersion="10" count="10"/>
<Device name="Galaxy S20"/>
<Device groupName="group1"/>
<Device androidVersion="14" count="10"/>
<Device groupName="group2" androidVersion="14"/>
<Device groupName="group2"/>
</Devices>
<Iterations>5</Iterations>
<TestRun>
<Include>LP:1</Include> <!-- Test ID 1 from Login Page tests -->
<Include>LP:2-4</Include> <!-- Test IDs 2 to 4 from Login Page tests -->
<Include>SM:10</Include> <!-- Test ID 10 from Send Message tests -->
</TestRun>
</TestExecutionConfiguration>
TEC is executable, once it is done, 2 files will be created for TEC run: result files in JSON and log file. The framework will run “report generator” to parse the result and log files and process the data. Test framework bundle very primitive report generator, users are free to use their own report generator of their choice.
Instances in Total Control
Total Control provides a complete example of App automation testing. After installing Total Control, you can find it in the following directory: %appdata%\Sigma-RT\Total Control\modules\test
Run Automated Tests
Run Through the Command Line
Open Total Control - Script - Terminal, and enter the following commands in the terminal to run the script
addToClasspath('C:/Users/admin/AppData/Roaming/Sigma-RT/Total Control/modules/test'); //Set the path to the directory where your automation test scripts are located
runTest("TestExecutionConfiguration.tec") //Run the test execution configuration file
Run Through the User Interface
Through the user interface, you can easily generate and run test execution configuration files (*.tec) or edit saved *.tec files.
In the script window of Total Control, click "Test Execution" to open the test execution window.
Click the “+” button to create a new test execution configuration file.
Once created, click "Save and Run," specify the file name and location, and start the test. (You can also open an already saved test execution configuration file with the “.tec” extension, click "Save and Run," and start the test.)
You will see a new record added to the list.
Click the log icon next to the record to view the report log and execution log.