Forum Discussion

Buschfunk's avatar
Buschfunk
Frequent Contributor
14 years ago

Passing command line parameters from TestComplete

Hello,



I have to test the functionality of a Windows DLL. For this a test tool is available which calls routines of the DLL. Unfortunately this test tool is a command line application so there is no GUI available which I could use with TestComplete. The test tool requires several parameters to be passed.



Example:

createOrder.exe param1 value1 param2 value2 ...



Is there a way I can run this command line tool and pass the parameter values from TestComplete?



Thanks,

Robert

1 Reply


  • Hi Robert,





    You can accomplish your task by using the Tested Applications project item. You need to add your application to your project's Tested Applications collection. Then, you will be able to specify your application's command-line parameters by using the "Parameters" property. To learn about this property, see the "TestedApps Editor" help topic.





    Another approach is using a script similar to the following one:

    Sub ExecuteCommandLineApplication()

      Dim WshShell, oExec, output, commandLine

      

      commandLine = "ipconfig /all"

      

      Set WshShell = CreateObject("WScript.Shell")

      Set oExec = WshShell.Exec(commandLine)

      While Not oExec.StdOut.AtEndOfStream 

        output = output & oExec.StdOut.Read(1)

      Wend





      Do While oExec.Status = 0

           Delay(100)

      Loop





      Call Log.Message("Completed with the " & oExec.ExitCode, output)

    End Sub