Written by

Question Gautam Rishi · Jun 29, 2023

Unable to create directory while working on unit test

Hi All,
I was creating a unit test directory with the below script. But it not creating any directory as mentioned in code. I am working on MacBook with irisusr User as standard installation process.

if '$data(^UnitTestRoot) {

set mainFolder = "UnitTest\NewDir\"

set st = ##class(%File).CreateDirectoryChain(mainFolder _ testSuite)

if $$$ISOK(st) { set ^UnitTestRoot = mainFolder }

else {

write !, "UnitTestRoot folder could not be created. Consult with instructor."

do $system.Status.DisplayError(st)

}

}

Product version: IRIS 2023.1

Comments

David Hockenbroch · Jun 29, 2023

What is the error message telling you? I'm not as familiar with working on a Mac as with Windows or Linux, but you need to make sure that the irisusr account has permission to create that folder at the operating system level.

0
Evgeny Shvarov · Jun 29, 2023

Hi Gautam!

It's not an answer for your question, but I encourage you to try manage tests via Package manager - in this case you don't need to create any directories and globals.

this will be:

USER>zpm "test your-package-name"

that will run all the tests. And you'll be able to introduce tests in a CI pipeline.

See the related article.

0