Forum Discussion

nkuno's avatar
nkuno
New Contributor
7 years ago

java.io.FileNotFoundException on trying to read a text file

import java.io.*;
import java.io.File
import java.io.InputStream
import java.io.OutputStream
import java.io.Reader
import java.io.Writer
import java.nio.file.Path

 

//To read the file path / /
FilePath = context.expand( '${General_Properties#RequestXML_Path}' ).toString();
//FilePath = testRunner.testCase.testSuite.getPropertyValue("FilePath").toString();
log.info(FilePath)
def file1 = new File(FilePath)
def fileContent = file1.getText()
//log.info (fileContent)


//Storing the request before converstion for REquest response storage step
testRunner.testCase.testSteps["General_Properties"].setPropertyValue( "Request_Store", fileContent )

 

in my previous step i get the value of RequestXML_Path from excel as

H:\Naveen\AIA Service\AIA_Automation\Data\Request_XML\NC\NC_Request.txt

 

on executing i am getting below error 

java.io.FileNotFoundException: H:\Naveen\AIA Service\AIA_Automation\Data\Request_XML\NC\NC_Request.txt (The system cannot find the path specified) error at line: 16

 

Could anyone help me out on this