This page shows many simple examples which can be used as parts of your own tests.
It is all java code, so you can mix it as needed with other (not ATS) code.
The test landscape
Before going with the examples bellow, please first have a look at the following simple diagram:
Whenever you work with your tests, it will be good to have an idea about the participating parties, their placement and relations.
This diagram is an example which could be different than your own case but still:
- Test Executor is the application running the tests. It interacts with:
- The AUT(Application Under Test) using some protocol - HTTP, FTP, RMI etc.
- Some external server using some protocol.
For example sometimes the AUT uses a database placed on external host, so the test running on the Test Executor might talk with the external database over JDBC. - Test Explorer by sending all test data to the test database there
- AUT(Application Under Test) is the application we are testing.
It could be a single application or a number of applications working as one - Test Explorer is your main test results storage
- External Servers
File Transfers
ATS supports file transfers over different standard protocols. Here is some FTP example:
import com.axway.ats.action.filetransfer.FileTransferClient; import com.axway.ats.common.filetransfer.TransferProtocol; @Test public void fileTransfer() { // Instantiate the File Transfer client by providing the protocol to use FileTransferClient transferClient = new FileTransferClient( TransferProtocol.FTP ); // set a custom port(if not using the default one) transferClient.setPort( 121 ); // connect using appropriate parameters transferClient.connect( SERVER_IP, USER_NAME, USER_PASSWORD ); // upload a local file to the remote root folder of our user transferClient.uploadFile( LOCAL_FILE_LOCATION + FILE_NAME, "/" ); // disconnect the File Transfer client transferClient.disconnect(); }
We hope you find this example simple enough.
This class can simply do a file transfer between two end points. You cannot, for example, run separate FTP commands.
The beauty of the FileTransferClient class is that the code looks a kind of the same no matter the used protocol. This means if the transfer was over HTTP, we would change only the specified protocol.
However in reality the situation can get more complicated as each protocol may accept additional parameters.
Here you can find examples with more advanced options over all supported protocols.
File System Operations
All kinds of different tasks can be executed on files and folders hosted on local(Test Executor) host or a remote one.
Here is a page dedicated to these features.
Database Operations
When it comes to databases, ATS supports Oracle, MySQL, MSSQL and Cassandra. With some effort, It is also possible to plug-in support for your own database type.
Here are some examples including some specifics for particular database instances.
HTTP Operations
Here you can see how you can run HTTP calls using ATS
REST Operations
Here you can see how you can run HTTP calls using ATS
Basic System Operations
Here you can see how to do some very basic system operations like working with the system time, send some keyboard or mouse events, take a snapshot of the display etc.
Running external process
Here you can see how to run an external process(for example some shell command) and evaluate its result.
Interacting with external process
Here we show the way to "talk" to some external process.
This means you can not only check the process output(it talks to you), but you can also send answers to when asked(you talk to it)
File System Snapshots
Here you can see how to check what changes were made on some file system. Often used when verifying the result of doing upgrade of the Application Under Test
Database Snapshots
Here you can see how to check what changes were made on some database. Often used when verifying the result of doing upgrade of the Application Under Test
Mail and SMTP operations
Here you can see how to create or load a MIME message, modify it and send it over SMTP.
It is also possible to run direct SMTP commands.
SSH Operations
Here you can see how to execute commands over an SSH connection
Windows Registry Operations
Here you can see how to work with the Windows registry.
Test Verifications
Usually in order to understand whether the test completed successfully it is need to make some checks on file system or database or similar.
ATS provides a common way for such cases. Here is how.
Back to parent page
Go to Table of Contents