Forum Discussion

Manoj0516's avatar
Manoj0516
Occasional Contributor
8 years ago

How to access xls files under resources folder in a Maven Project that's integrated with SOAPUI

I have integrated Maven Project with SOAPUI and there are some excel sheets present in a resources folder in my MAVEN project. How can I access or read the file from my SOAPUI groovy step?

  • Created a new folder under base directory as DataSource and moved my input XLS file.

     

     

     

    Added following to my pom.xml and corresponding groovy statements in my groovy test step.

    <projectProperties>
    <value>mytestproperty=${basedir}\DataSource\TestMyFile.xls</value>
    </projectProperties>

     

     

    def projProp = testRunner.testCase.testSuite.project.getPropertyValue("mytestproperty")
    log.info "$projProp"

    Workbook wb = Workbook.getWorkbook(new File("$projProp"))
    Sheet Sh = wb.getSheet("Sheet1")

     

  • Manoj0516's avatar
    Manoj0516
    Occasional Contributor

    Created a new folder under base directory as DataSource and moved my input XLS file.

     

     

     

    Added following to my pom.xml and corresponding groovy statements in my groovy test step.

    <projectProperties>
    <value>mytestproperty=${basedir}\DataSource\TestMyFile.xls</value>
    </projectProperties>

     

     

    def projProp = testRunner.testCase.testSuite.project.getPropertyValue("mytestproperty")
    log.info "$projProp"

    Workbook wb = Workbook.getWorkbook(new File("$projProp"))
    Sheet Sh = wb.getSheet("Sheet1")