Forum Discussion

mbensalem's avatar
mbensalem
New Member
2 months ago

Issue with Mounting Network Drive in TestEngine

Hello SmartBear Community,

I'm encountering an issue with running my ReadyAPI tests via TestEngine that involves mounting a network drive. While the same tests run successfully in ReadyAPI, they fail when executed through TestEngine.

Even when the network drive is available in the machine, with Testengine I'm getting an error "FileNotFoundException" when trying to read files from it. But with ReadyApi my script works correctly. This is an example of script :

import groovy.json.JsonSlurper
import groovy.io.FileType
import java.util.logging.Logger

// Définition du chemin du dossier contenant les fichiers JSON
def chemindudossier = "Y:\\Regression\\1_FADETS\\4_COMM\\communication\\"

// Création d'un nouvel objet JsonSlurper pour lire les fichiers JSON
def jsonSlurper = new JsonSlurper()

// Initialisation de trois compteurs pour compter le nombre total d'éléments JSON, le nombre d'éléments qui ont la structure attendue, et le nombre de "Tué"
def totalCount = 0

// Parcourir tous les fichiers JSON dans le répertoire
new File(chemindudossier).eachFileRecurse (FileType.FILES) { file ->
    // Lire le contenu du fichier JSON
    def content = file.text

    // Parser le contenu du fichier JSON
    def data = jsonSlurper.parseText(content)
    // Vérifier que chaque élément a la structure attendue
    totalCount += data.size()
    }
    
log.info("Le nombre de communication est : $totalCount")

//message d'erreur si le totalCount=0
if (totalCount == 0) {
    log.severe("Erreur : Aucun lien entre personne physique et telephone n'a été trouvé.")
}

Based on the documentation of Testengine, I did understand that there is a groovy restrictions on reading/writing files. I tried this 2 solutions that they propose and didn't work : 

1- Added -Dgroovy.allow.all=true in ReadyAPITestEngine.vmoptions file
2- Edited readyapi-testengine.bat to include the -Dgroovy.allow.all=true flag:

"%JAVA%" %JAVA_OPTS% -Dgroovy.allow.all=true -cp "%CLASSPATH%" com.smartbear.ready.testserver.ReadyApiTestServerMain %*

Could you please help me to find a solution to my problem? I'm really stack and cannot progress in my tests!

Thanks!

1 Reply

  • nmrao's avatar
    nmrao
    Champion Level 3

    Does the user(on testengine machine) have read / write privileges to the shared directory?