Set-up script works locally but throws an Script exception when running from pipeline - TestEngine
Hello,
I have a set-up script that reads an auth token from a file and replaces a Project property.
This script work fine locally but throws an exception in Azure pipeline where I'm using ReadyAPI TestEngine to run the tests. The log message isn't helpful.
Not sure where and why the exception is thrown, appreciate any help.
def tokenFromProperties = runner.project.getPropertyValue("AuthToken")
log.info("Current Token from suite properties ---- " + tokenFromProperties )
def projectPath = runner.project.getProject().path
//log.info(projectPath)
def filePath = projectPath + "/SignedJWT.txt"
//log.info(filePath)
def myFile = new File(filePath)
def myScanner = new Scanner(myFile)
def tokenFromFile = myScanner.nextLine()
log.info("Token from the text file ---" + tokenFromFile)
myScanner.close()
//testrunner.testCase.testSuite.setPropertyValue("Token", "test")
runner.project.setPropertyValue("AuthToken", tokenFromFile)
def UpdatedTokenFromProperties = runner.project.getPropertyValue("AuthToken")
log.info("Updated Token from suite properties --- " + UpdatedTokenFromProperties)