Choose a Product Community
Resources

SOLVED
Contributor

## Test Execute, unable to open the file

Hi guys,

I try to run test execute using the icon and option run.

But after a bite, I have the following error :"unable to open the file".

File is present in the folder and is not read only.

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

## Re: Test Execute, unable to open the file

hmmm

If You want to work with Project Script files You need to use an absolute path.

You can get path to You to project with this method: aqFileSystem.GetCurrentFolder();

let pathToFile = aqFileSystem.GetCurrentFolder();
let writeToFile = aqFile.WriteToTextFile(
pathToFile + "\\script\\" + fileName + ".js",
str,
aqFile.ctUTF8, true
);
7 REPLIES 7
Community Hero

## Re: Test Execute, unable to open the file

Hi,

Can You show Your "Test Items" project explorer?

Contributor

## Re: Test Execute, unable to open the file

I don't understand what you need.

Community Hero

Contributor

Community Hero

## Re: Test Execute, unable to open the file

Alright, so what I can see from screens the error occurs on the first TestItem with the name "ProjectTestItem2".

Question is, what do You have inside this function?

Contributor

## Re: Test Execute, unable to open the file

function Get_Translate_Mgs_Dinamic_File() // Get dinamic file
{
if (Const_lib.Language == "it")
return "c:\\DL Console\\it.json"
else if (Const_lib.Language== "en-US")
return "c:\\DL Console\\en-US.json"
}

Could be that I have to put the absolute path?

Community Hero

## Re: Test Execute, unable to open the file

hmmm

If You want to work with Project Script files You need to use an absolute path.

You can get path to You to project with this method: aqFileSystem.GetCurrentFolder();

let pathToFile = aqFileSystem.GetCurrentFolder();
let writeToFile = aqFile.WriteToTextFile(
pathToFile + "\\script\\" + fileName + ".js",
str,
aqFile.ctUTF8, true
);
cancel
Showing results for