Forum Discussion

Mr_Bro's avatar
Mr_Bro
Frequent Contributor
2 years ago

fetching the logged in username using groovy

Hello Team,

 

can anyone help me how can i fetch the user profile details using groovy in soap ui,
i have to fetch the user profile name in groovy.

thanks in advance.

 

request you to please help me if you have already worked on such requirments.

 

Thanks and Regards,

Sathish Kumar K

1 Reply

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 1

    Hello Mr_Bro 

     

    I don't have much, but have accessed userprofile in the past...  Here is part of groovy script test step...

     

    .
    .
    .
    def homeProp = System.getProperty("user.home");      // log.info "homeProp: " + homeProp;
    def localOS = homeProp.contains("\\");               // log.info "localOS: " + localOS;
    if (localOS ) {
       def env = System.getenv();
       String tmpDir = '';
       tmpDirStr =  env['USERPROFILE'] + File.separator; // log.info "tmpDirStr: " + tmpDirStr;
    }
    else {
       tmpDirStr = File.separator + 'tmp' + File.separator + 'edi' + File.separator; // log.info "tmpDirStr: " + tmpDirStr;
    };
    testRunner.testCase.testSteps["Properties"].setPropertyValue( "TempDirectory", tmpDirStr);
    
    .
    .
    .

     

    Regards,

    Todd