question

ksuruliv avatar image
ksuruliv asked ericnute edited

Want to execute with CLI username

Hi ,

 

We have created a testcase which will be doing many file copy operations. we are using session profile and executing all these commands.

As installation is done with common user name, all the files are getting copied in common user name.

 

This currently gives trouble to identify the files copied by which user.

 

Is there any way to get the user details/previlege from the login session?

 

Thanks in Advance

iTestitestcli
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
VidyaH avatar image
VidyaH answered VidyaH posted

Hi,

You can use the "user" command step before the step which does copy of files. user command gives the user name.

Right click on the Step Description section in test case, Insert-> Information->user .

Hope this helps.

 

THnaks,

Vidya

5 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KumarS avatar image KumarS commented ·

I am assuming you are using telnet or ssh session. In such sessions, you are going to create files with the user you logged in.

 

If you are using "Command prompt" session, all the files will be created using the user you are logged in your windows machine.

 

iTest does not control what user your files get created as - it is the underlying operating system which decides this. You will have to learn how your operating system's user management works and tweak your iTest testcase appropriately. Many operating systems allow you to run commands as a different user than the one you are logged in as.

0 Likes 0 ·
gte312u avatar image gte312u KumarS commented ·

Hello,

 

I'm working on this problem with Kannan. The system that iTest is being run on is a Linux system. iTest was installed and all files are owned by a user who we'll call itestusr.

 

When I execute the test suite as myself using the iTest CLI, the test is attempting to create directories and move files using a "Process" session. The commands are failing because script is attempting to create and copy files into directories that I have permissions to write but itestusr does not.

 

I've confirmed that commands run by the process session type are run by itestusr instead of the user kicking off the CLI by executing the command "run whoami" in the process session. When I kicked off the script as myself, the response to "whoami" was "itestusr" and not my username.

 

Am I missing something here? Does this tool work in an environment where multiple users will be executing the script from the CLI as themselves?

 

Thanks,

Chris

0 Likes 0 ·
gte312u avatar image gte312u gte312u commented ·

I found the solution. In our case, there is an iTest GUI process running in our workspace as the itestusr user. Whenever I run the itestcli as a different user in that workspace, it still connects to the same iTest process for execution which results in the test being run as itestusr because that is who is running the iTest process.

0 Likes 0 ·
PaulD avatar image PaulD gte312u commented ·

Yes.  That's exactly right.  itestcli is a utility that makes requests (via a socket) to an iTest process.  If there isn't already a suitable iTest process running, it will start one.  (That may add to the confusion because in that case, it will, therefore, adopt the credentials of the itestcli originator.)

 

You should probably be aware of itestrt as well.  It is much easier to understand because it does not require any workspace.  It can run tests and does all of that work in the process itself.  Unfortunately, at this point, itestrt is unable to run GUI tests (like web and swing) and that is the main reason that itestcli still exists.  (We're hoping to remove this limitation, but haven't gotten there yet.)

0 Likes 0 ·
KumarS avatar image KumarS PaulD commented ·

To add to Paul's comment, there are two modes of execution:

1. one using workspace using itestcli or itest gui

2. one using itar files using "itestrt"

 

For #1, at a given time only one iTest process can bind to a workspace. So if an iTest GUI is already running on a workspace, itestcli will request that iTest GUI process to execute the test. If there are no iTest processes running on a workspace, itestcli will start a new iTest process (either in headless mode or in gui mode using -g option of itestcli) to execute tests. So all you have to do solve the problem is to quit your iTest GUI process and then start itestcli again. This time all the processes will be created with right user permissions (because itestcli will have to start a new iTest process which will start a Process using Process session type).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.