Forum Discussion

aamonto's avatar
aamonto
Occasional Contributor
4 years ago
Solved

Execute scripts by command line is not working for TestExecute 15

Hello,

 

Can someone help me with the following issue? Previously I created a bat file to execute some scripts with TestExecute, this worked for a year but then stopped working when I update TestComplete and TestExecute to the 15 version, when I execute the same bat file I am getting the following error message:

 

"Windows cannot find 'TestExecute.exe'. Make sure you typed the name correctly, and then try again"

 

I already tried to open first TestExecute with the following command line "START /I TestExecute.exe" but I am just getting the following message "The system cannot find the file TestExecute.exe". For now I am doing the following workaround:

 

1) Open manually (double click) TestExecute

2) Exit the software from the toolbar so it gets closed

3) Running again the same bat file with this command line:

                 "start /wait "TestExecute" TestExecute.exe "C:\Users\user\Testing.pjs" /r /p:Testing /t:"KeywordTests|Test" /run /exit /SilentMode

4) Following the previous steps the bat file works and all the scripts are executed, even if I execute the same bat file multiple times, the issue is just the first time that I want to execute the scripts because it doesn't find TestExecute

 

Could you please help me with this issue? for now I am fine with the workaround but eventually we will execute the scripts using TaskScheduler  and the bat file, thank you and please let me know any comment or question.

  • Cucumber step definitions take a matcher, (some options - which we'll ignore for now) and a function. This example defines an anonymous function inline with the step definition:

     

     

    When('step matcher', () => {
      // function to run when the step matches
    });

     

     

    It is also possible to use a named function and pass the function to the step definition, e.g.:

     

    function stepFunction() {
     // function to run when the step matches
    }
    
    When('step matcher', stepFunction);

     

    You can define steps so that they will extract part of the step text and pass it as an argument to the function that Cucumber executes when it runs, e.g.

     

     

    When('step matches {string}', (theMatchedString) => {
    // function to run when the step matches
    });

     

     

    You can of course extract a named function which takes an argument and pass that to Cucumber:

    stepFunctionWithArgument(theMatchedString) {
    // function to run when the step matches
    }
    
    When('step matches {string}', stepFunctionWithArgument);

     

    If we look at your example you are calling the confirmSheetCreated function when you are creating the step definition, not when you are executing your Gherkin specification.

    You probably need to capture the arguments you want to pass to the function in the step matcher, something like:

    async function confirmSheetCreated(folderName,sheetName) {
        await this.page.waitFor(1500);
        let sheetExists=await this.sheetExists(folderName,sheetName)
        await this.page.isTrue(sheetExists);
    }
    
    // this will match: I confirm in folder: "Revenue" new sheet created: "Test Sheet 1"
    // and pass the folderName and sheetName parameters at runtime
    Then( 'I confirm in folder: {string} new sheet created: {string}',{ timeout: 5*1000 },  confirmSheetCreated);


    Alternatively, if those folder and sheet details are always the same you could push them into the function:

    async function confirmSheetCreated() {
        await this.page.waitFor(1500);
        let sheetExists=await this.sheetExists('Revenue','Test Sheet 1')
        await this.page.isTrue(sheetExists);
    }
    Then( 'I confirm new sheet created',{ timeout: 5*1000 },  confirmSheetCreated);

     

7 Replies

  • Sounds like you need to add the path to TestExecute to your PATH environmental variable.

    • aamonto's avatar
      aamonto
      Occasional Contributor

      After adding the path of "Test Execute 15" to the PATH environment variable I was able to execute the scripts using the bat file, thank you for all your help

       

      Note: For the people that has the same issue, I added the following path "C:\Program Files (x86)\SmartBear\TestExecute 15\Bin" into the PATH environment variable

      • Egg's avatar
        Egg
        Frequent Contributor

        Hello, I wonder, What is the 'PATH environment variable' ?? 

    • aamonto's avatar
      aamonto
      Occasional Contributor

      Ok, unfortunately I don't have permissions to do it, let me ask the support team to add it to the PATH environment variable and see if this fix the issue, thank you for your response, I will get back with the results