The K Test Client Actions Core library provides a framework for configuring and running automated unit tests on client actions. There is also a block, TestResultsBlock, for displaying results of client action unit tests.
Use the K Test Manager forge component to provide a user interface to the manage test scripts and review results.
The forge components are separated as your code will depend on this component, whereas the K Test Manager only needs to be deployed to the dev environment.
First write a client test script. Then write test cases to verify client actions in multiple scenarios.
Client Side Tests - Installation
The "K Test Client Actions Core" library contains all the client actions required to write unit tests for client actions. It depends on K Test Core.
Client unit tests are run on the server using Puppeteer. You can also run client tests manually by opening the page yourself.
To add the library:
Now write each set of unit tests as a test script.
How to Write a Client Test Script
The test script runs all the test cases for the script (see below for writing a test case).
Consider using the Client Action Tests screen template to create the boilerplate code for your test cases. It will create the screen and client actions for the test.
To write a test script
Write as many test cases as you need. This is your test script.
Add the TestResultsBlock to your page to display the test results immediately. Otherwise view results of tests in the K Test Manager.
How to Write a Client Test Case
The test case verifies a particular "target", normally a client action, for a particular scenario.
To write a test case
Have a look at the demo app KTestClientActionsDemo to see an example of client unit tests. Notice it has a pattern for creating a unit test template for testing a particular client action. This pattern helps writing unit tests quickly for differing scenarios.
Create a page to run the test script, eg "RunTests"
Write as many test cases as you need. This is your test script!
Create an action naming it with the target and scenario.
For example, testing an action ProcessStructure with large data values call the test Test_ProcessStructure_WithLargeData
The K Test Client Actions Core library provides a framework for configuring and running automated unit tests on client actions.