Ask a Question

Reading files from smb shared drive from Groovy test step?

Occasional Contributor

Reading files from smb shared drive from Groovy test step?

I need to read files from a shared smb file location via a Groovy test step in SoapUI. Any suggestions on how I might implement this?



SmartBear Alumni (Retired)

Hi Markgholland,



Could you please clarify if you want to read files from your network location or from the Internet?

Tanya Yatskovskaya
SmartBear Community and Education Manager

It's a network location.


I've tried the following and it appears that I can connect to the drive(getPath() for example), but for some reason I can't call certain methods(isFile() for example):


import jcifs.smb.NtlmPasswordAuthentication
import jcifs.smb.SmbFile

String url = "smb://"
String fullPath = ( url + "/path/to/file.txt" )

smbAuth = new NtlmPasswordAuthentication( url, context.expand( '${#TestCase#username}' ), context.expand( '${#TestCase#password}' ) )

dir = new SmbFile( fullPath, smbAuth )

//works dir.getPath()

//doesn't work dir.isFile()

Getting this error:

jcifs.smb.SmbException: jcifs.util.transport.TransportException Connection reset at at at jcifs.util.transport.Transport.readn( at jcifs.smb.SmbTransport.peekKey( at jcifs.smb.SmbTransport.negotiate( at jcifs.smb.SmbTransport.doConnect( at at at at error at line: 15

I appreciate any assistance!


Showing results for 
Search instead for 
Did you mean: