Ask a Question

Invalid Command Line to Run Test Item

SOLVED
Josh_147
Contributor

Invalid Command Line to Run Test Item

Hi all,

 

I'm trying to use the command line to run individual test items by using .bat file. I created a project suite and tried the examples provided at here . 

 

This is the project I created.

project-hierarchy.png

 

These 2 examples work fine,

TestComplete.exe "C:\My Projects\MySuite.pjs" /r /p:MyProj

TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /r /e

 

but for the example to run test items, it always show 'Invalid command line' error.

TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"ProjectTestItem1|ProjectTestItem2|ProjectTestItem3"

test-item-not-found.png

 

 

I went through the discussion but it looks like the accepted solutions are not the same as the examples provided in the documentation.

 

For example, I want to run ProjectTestItem1 and ProjectTestItem4 only. So, is there any solution to run these 2 test items only by using the method provided in documentation instead of this method?

1 ACCEPTED SOLUTION

Accepted Solutions
sonya_m
Community Manager

Re: Invalid Command Line to Run Test Item

Thank you for helping Wamboo!

 

@Josh_147 could you let me know if there's a reason why you are staying on the older TestComplete version? (v.11)? I apologize if I missed that. However, I strongly recommend using the latest one, since our team keeps adding new features and improving the tool. Please try updating the tool and let us know if this helps. 

If it doesn't, please try contacting the Support Team.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

9 REPLIES 9
Wamboo
Community Hero

Re: Invalid Command Line to Run Test Item

Hi, With these pipes "|" you tell TextComplete to look like a nested testItems, i.e. TestComplete thinks you want to run something like this:

 

ProjectTestItem1|

      ProjectTestItem2|

            ProjectTestItem3

not on one list.

 

In my opinion there is no possibility to run for example two testItems out of 5 available. What you can do is to group it into folders or nested testItem's.

Another consideration is to run the whole project and leave on the testItems list only the active ones we want to run.

Josh_147
Contributor

Re: Invalid Command Line to Run Test Item

I think the method that grouping or nested the TestItems had tried before at here . But I also try again to grouping or nested them, the results are the same, failed.

 

The purpose is to allow those users that who are not familiar with TC can run the individual TestItems without running TC and making any changes in the workspace (check or uncheck the TestItems' checkbox).

 

Seems like Run an individual test item via command line is the only way to achieve the goal? But I have tried to run the command (paths edited accordingly), it always prompt out the error message: Cannot start TestComplete. Exiting...

 

C:\ATR.js TestComplete "C:\Users\<Your_User_Name>\Documents\TestComplete 9 Projects\TestProjectTestForRunFromCommandLine\TestProjectTestForRunFromCommandLine.pjs" /p:TestProjectTestForRunFromCommandLine /t:ProjectTestItem1

 

Anything that I missed out or need to edit something before using the ATR.js?

Josh_147
Contributor

Re: Invalid Command Line to Run Test Item

I found this discussion and it is what I'm really looking for. But the latest update stated that: This functionality has been implemented in TestComplete 12.40.

 

Since I'm using TC 11, is it the reason that I failed to use the command line to run the testing?

Wamboo
Community Hero

Re: Invalid Command Line to Run Test Item

Josh, in my opinion, if you want to share your test runs with other users, it's high time to install the CI environment and connect it to TestComplete.

 

In Jenkins you can pass parameters through command lines and then read them in TestComplete.

Choosing the right tests is done in Jenkins by building an appropriate "Job" (pipline).

 

All TestComplete reports are placed exactly while Jenkins is working with TestComplete.

Integrating TestComplete with Jenkins is very easy.

 

Use the VM to run tests using the testExecute installation on the VM.

This was the first way.

 

The second way is to pass some parameters in cmd to decide which tests should be run e.g:

C:\...TestComplete.exe" "C:\work\...project.pjs" /r /p:IProjectName/CustomParam1:value1 /CustomParam2:value2

You can read these parameters using a class called "BuiltIn". In this case you can decide what to run by creating a function and inside it to call the desired test functions.

 

The third way is:

Starting this by the CMD. You can also do it in an older version:

I have a command in CMD:

"C:\n-TestComplete.exe" "C:\nImpuls_trunk.pjs" /r:\nProjectName /testName

In the parameter "test" you can specify the full path of the function call, that is: Folder|Folder|Name of the NaTestItem (the green one in the list)

 

Josh_147
Contributor

Re: Invalid Command Line to Run Test Item

Hi Wamboo,

 

I tried to use Jenkins to run my testing but I found that there is an issue that not allow me to do so. The main reason is the command line argument (running individual test item) doesn't support for TC11. I also try to run the command line by using batch file and Jenkins on TC14, it works.

 

Also, appreciate the suggestions but I'm not sure the second way or third way that you suggested works fine on TC11 or not...Sorry that I'm not familiar with passing parameters and creating functions, I couldn't implement them properly.

 

Is it possible to show the command based on the hierarchy of the project that I created?

 

Best Regards,

Josh

 

Wamboo
Community Hero

Re: Invalid Command Line to Run Test Item

Hey, look at the changelog:


https://plugins.jenkins.io/TestComplete/


The mines version on this page is 10.6, so I think you can use 11.* to test the Jenkins slave nodes.


Can you give me the source you mentioned earlier (about the command line and not supporting TC11?).


because I didn't find any of that information in this tip:


https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...


https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...


and this is the way you can work with the cmd arguments inside Jenkins.

Josh_147
Contributor

Re: Invalid Command Line to Run Test Item

These are the commands that I run by using .bat file. I have to create two projects with the same structure because TC11 unable to run the project created/updated by TC14.

 

"C:\Program Files (x86)\SmartBear\TestComplete 11\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /p:MyProj /t:"ProjectTestItem3" /r /e

 

"C:\Program Files (x86)\SmartBear\TestComplete 14\x64\Bin\TestComplete.exe" "C:\Work1\My Projects\MySuite.pjs" /p:MyProj /t:"ProjectTestItem3" /r /e

 

- For TC11, it comes out with the error: Invalid command line. In Jenkins, the console output also show the same error.

- For TC14, it works fine.

 

 

 

The command line that not support by TC11 can be found at here 

 

doc1.png

 

and the examples.

 

doc.png

 

 

Wamboo
Community Hero

Re: Invalid Command Line to Run Test Item

I cannot undo my TestComplete version at this time to 11.

Does anyone have any idea how to solve this problem?

 

@AlexKaras , @tristaanogre , @nmrao , @HimanshuTayal ?

sonya_m
Community Manager

Re: Invalid Command Line to Run Test Item

Thank you for helping Wamboo!

 

@Josh_147 could you let me know if there's a reason why you are staying on the older TestComplete version? (v.11)? I apologize if I missed that. However, I strongly recommend using the latest one, since our team keeps adding new features and improving the tool. Please try updating the tool and let us know if this helps. 

If it doesn't, please try contacting the Support Team.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: