Working with CLI action steps
Quite often there is a need to validate the content of a downloaded document which could be a PDF, Word Document, CSV file or databases such as MySQL, MongoDB. All these are possible within Testim using the CLI action step. This feature helps to create and execute custom Node.js scripts at runtime; to perform different […]
Quite often there is a need to validate the content of a downloaded document which could be a PDF, Word Document, CSV file or databases such as MySQL, MongoDB. All these are possible within Testim using the CLI action step. This feature helps to create and execute custom Node.js scripts at runtime; to perform different validations. Below are some tips to help with CLI action steps.
Tip 1: How to find out what node.js packages you can use?
The different node.js packages that can be used within Testim are the ones found in https://www.npmjs.com/. This is the official website that has references to all the open source node.js packages. Say for example, you are searching for a package related to pdf documents; just search for “pdf” and you will get a list of all the node.js packages available for pdf.
Tip 2: What are the available CLI action steps within Testim?
Below are the available CLI action steps within Testim-
- Add CLI action
- Add CLI validation
- Add CLI wait for
- Validate download
- Wait for download
Tip 3: How to add node.js packages to Testim?
To add node.js packages to Testim, follow the below steps
- Add one of the above mentioned CLI action steps
- In the Properties Panel, click on PARAMS-> PACKAGE
Tip 4: How to execute CLI action steps locally?
To execute node.js scripts via CLI action steps locally, you need to first set up the runtime environment using the below command. Ensure this command is executed from the command line before running a test with a CLI action step.
npm i -g @testim/testim-cli && testim –agent
Putting everything together
Lets see how all the tips work together to execute node.js scripts. Say you want to validate the content of a downloaded document such as a PDF file. The steps to do this would be-
- Ensure CLI Action feature is enabled (Contact our CSM or customer support for this)
- Add the “Validate Download” action
- Add the necessary node.js package for the pdf content validation. In this case, we are adding the latest version of the package pdf-parse
- Then, add the necessary code to do the content validation
Here is a sample test to show how to do PDF content validation – PDF Validation
For more CLI action examples, check out the last section of this doc – CLI Action
A few weeks ago, we talked about automating tests. Now it’s time to take a look at six of the best Python test automation tools. The good news is that the Python standard library already includes excellent unit testing tools. You can go a long way toward setting up robust test automation using the language’s […]
Presenting a perfect product to the customer is the end goal of every organization. But did you know that there was a time when testing wasn’t even a part of the software development life cycle (SDLC)? Nothing puts off customers more than bug-filled user experience. So when enterprises realized this, they began to include testing […]
We’ve already undergone quite a journey to evolve from “classical testing” and test automation to continuous testing. Nevertheless, when we look into the future, it’s clear that even continuous testing won’t be sufficient. Certainly, digital transformation happens in test automation, as it does in every field. We’ve come from manual testing to a robust automated […]