Forum Discussion

Florian_Hofmann's avatar
Florian_Hofmann
Contributor
8 years ago
Solved

Command line arguments from Visual Studio to TestComplete

Hello everyone,

I used to run my TC tests from command line/batch skripts, passing command line parameters and accessing them with "BuiltIn.ParamStr(X)", which worked just fine.

 

Now I want to change my approach and run them from Visual Studio 2013. I've found a way to pass command line arguments using "Debug|[project] properties", using the field "command line arguments". Unfortunately, I can't find out how to access them now - the above doesn't seem to work any more.

Most of my tests where VBScript scripts, so I thought "Wscript.Arguments" might achieve about the same, but it also doesn't.

 

Where did I go wrong? Did I miss something in my approach? Or is it bad practice in the first place, and I should find a better way of passing arguments?

Thanks in advance,

Florian

  • Rather than running via command-line, since you're using Visual Studio anyways, have you considered using the TestComplete objects directly in visual studio, what's called a "Connected" application? You build your tests and such directly in visual studio, calling TestComplete objects internally.

    I think the problem you're running into, though, has to do with that, previously, you were running TestComplete.exe from a command prompt and then passing parameters. Now, TestComplete.exe is not being run the same way and so, perhaps, may even have security blocks, etc.  Something you can try is to create a WScript.Shell object in your visual studio project and then call the "Run" method from there. That should do, basically, what you had been doing before.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Rather than running via command-line, since you're using Visual Studio anyways, have you considered using the TestComplete objects directly in visual studio, what's called a "Connected" application? You build your tests and such directly in visual studio, calling TestComplete objects internally.

    I think the problem you're running into, though, has to do with that, previously, you were running TestComplete.exe from a command prompt and then passing parameters. Now, TestComplete.exe is not being run the same way and so, perhaps, may even have security blocks, etc.  Something you can try is to create a WScript.Shell object in your visual studio project and then call the "Run" method from there. That should do, basically, what you had been doing before.

    • Florian_Hofmann's avatar
      Florian_Hofmann
      Contributor

      Thanks a lot and no, I had not thought of such a solution...actually I didn't know such an approach was possible.

      First of all: Where can I find out if it's possible with TC 10.50?

       

      And I'm not sure I understand it right: I could not use my existing tests further, but would have to create them again, this time in Visual Studio, using the programming language the tested application was written with, rather than VBScript?

      On the other hand - if I use a WScript.Shell object, would the test results be available to Visual Studio in a way they could be communicated to Team Foundation Server?

       

      Thanks again,

      Florian

       

      Edit: Again, to be sure I got it right: For Visual Studio, an item "TestComplete X test" is much like a black box - it can be executed, but you can't easily pass variables, or organize DDT and such? This I would add to the tests themselves, from within TestComplete?