i am using parasoft test tool to automate my webservices testing .basically i hit a wsdl and run the operations related to that wsdl . i do see the logs for the particular operation by connecting to a server running on unix using putty . i wish to automate this task too as basically parasoft supports java and jython extension tools ... i dono how to connect to this server since my coding knowledge is nil and how to grep the logs from a particular file ..can anyone share me the code and help me please
2 Answers
Here is a link to create a ftpClient in Java
http://commons.apache.org/proper/commons-net/examples/ftp/FTPClientExample.java

- 44,617
- 6
- 35
- 64
This question lists a couple of libraries to use SSH from Java: SSH library for Java
A simple solution would be to create an SSH connection and run tail -f
+ path to the logfile on the remote side.
You can then read the command's stdout to get the log in your test.
Note that the remote command doesn't terminate. You have to close the connection to kill it.
You may find this to be too brittle. In my own projects, I start the server locally from the tests with a local database that I set up from the tests as well. That way, I have full control over the environment.
If that doesn't work well for you, the next step would be to write proper unit tests. You can use an appender in your logging framework to collect the log messages that you're interested in. Those tests will be much more stable, reliable, easier to maintain than what you have now.

- 1
- 1

- 321,842
- 108
- 597
- 820
-
why the `-f ` parameter if you are going to kill the connection? Basically `cat file` the log of `tail -100 file` would be better. – Scary Wombat Jan 30 '14 at 08:50
-
@user2310289: He just wants the log entries written **while** he runs the test. – Aaron Digulla Jan 30 '14 at 09:44