Forum Discussion

Bouzouki's avatar
Bouzouki
Occasional Contributor
3 years ago
Solved

Variables Not Passed From Batch File

CD "C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin"
TestExecute.exe "C:\dev\TestComplete\PDFCompare_DiffPdf\PDFCompare_DiffPdf.pjs" /r /p:PDFCompare_DiffPdf /pv:p_FilesStoreDirectory="I:\QC\3E Generate\2201\220101_21Q4\Archived MSS PDFs\" /pv:p_FilesNewDrectory="I:\QC\3E Generate\7.07\Optimize 2021Q3\Archived MSS PDFs\"

 

I have a user with a TestExecute license that is attempting to launch a project using the above .bat file. Looking in the log, the paths don't get assigned to the variables. I thought maybe I had the wrong syntax for variables. Would someone be so kind as to look at that and tell me if it's correct or not?

  • Hi Bouzouki,

     

    The syntax for your concatenation looks correct and verified on my machine. I know it seems obvious, but in the error message screenshots there is an extra directory that is missing between the 2, 'MSS'. 

    If this is supplied do you still see the same error with locating the file?

7 Replies

  • Bouzouki's avatar
    Bouzouki
    Occasional Contributor
    Hey! Thanks for being on top of this.

    I apologize for not answering sooner. It's crazy here and I get pulled in a lot of different directions so I usually don't get the time I'd like on any given topic. Pretty sure that's the same for a lot of us.

    I did confirm my variable names matched in response to the second question. I copied and pasted them to be certain.

    How I got around it was to take the variables out of the .bat file and simply modified the .mds file to set the values of the parameters prior to launching TE. That worked perfectly for the testers.

    That being said I have the email flagged and when I can get back to this I will try passing simplified values (for the first question) instead of paths and see if maybe the value is causing a problem.


    Best Regards,

    Joe


    [Logo, icon Description automatically generated with medium confidence]<>
    Joseph Rogers
    Senior QA Analyst
    P +1.330.236.4863
    E joseph.rogers@3eco.com
    LinkedIn<> | Twitter <> | YouTube<>



    ________________________________

    This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.
  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Let's try with something simple first. Change your variable values in the batch file to just be a small string like "abc" and "123". If those get assigned, then we know it's something with the path and we can try something else.

  • Hi Bouzouki!

     

    The syntax in your .bat file for the variable update is indeed correct. I wonder if it's down to the variable names themselves. As errors in those names will not return any errors.

     

    For instance, one of your variable names according to the file above is = 'p_FilesStoreDirectory'

    Is this correct? Or is the variable name 'FilesStoreDirectory'? 

     

    Would it be possible for you to post a screenshot of the variables within TC?

  • Bouzouki's avatar
    Bouzouki
    Occasional Contributor

    Finally. I got a chance to look at this again.

    What I am showing in this screen shot is that I have a variable called fileListPath

    I am hard coding the path, and the following if block is able to find the file and verify that it exists.

    in the Watch List, I show the values of the suite variable, as well as the fileListPath variable.

    It works and finds the file.

     



    In this attempt I concatenate the suite variable to fileslist.txt 

    It doesn't find the file and fails, although the Watch List shows what appears to be the same values



    I am assuming that I need to do something to the variable when I am concatenation. Is this enough for an expert to see why it is failing?

     

    // Batch File command
    TestComplete.exe "C:\dev\TestComplete\PDFCompare_DiffPdf\PDFCompare_DiffPdf.pjs" /r /p:PDFCompare_DiffPdf /psv:p_FilesStoreDirectory="I:\QC\3E Optimize\707\" /psv:p_FilesNewDirectory="I:\QC\3E Optimize\2021\mss\"


     

  • Hi Bouzouki,

     

    The syntax for your concatenation looks correct and verified on my machine. I know it seems obvious, but in the error message screenshots there is an extra directory that is missing between the 2, 'MSS'. 

    If this is supplied do you still see the same error with locating the file?

  • Bouzouki's avatar
    Bouzouki
    Occasional Contributor

    Oh, my goodness. /facepalm

     

    Yes. It does help if I actually point to the right directory.
    Once that was fixed I was able to solve the OpenTextFile error I was trying to get to. I needed to have ctANSI as the third parameter. I think I am working!

    Thank you so much.

     

  • Hey Bouzouki!

     

    Absolutely! Glad to hear it was something simple. Sometimes an extra set of eyes makes all the difference.

     

    Thanks for letting us know things are working now, happy testing!