Defining execution parameters.

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Defining execution parameters.

Post by stapes » Wed Mar 30, 2016 2:26 pm

I have been experimenting with different ways of dealing with parameters.
I need a password for the smtp client which I am adding at run time like this:

http://www.ranorex.com/blog/defining-ex ... r-ui-test/

Basically, I run it with a command line:
Test-365AgilePortal.exe /cc "[email protected]" /pw "password01"
Now, this value appears on the report:
d:\Workspaces\Ranorex>.\Test-365AgilePortal\Test-365AgilePortal\bin\debug\Test-365AgilePortal.exe /cc="[email protected]" /pw "password01"
Ideally, I do not want to see this on the report.

This parameter is used by the Program.cs module before the Test Suite is run. Otherwise, I would have added to an Excel file & masked the column - as I have done with other password type variables that were previously specified as Global Parameters. I already converted these to prevent the values being displayed on the reports.

Is there a simple way I can prevent this value being shown?

If not, I guess my best option would be to encrypt it?
Last edited by stapes on Wed Mar 30, 2016 2:41 pm, edited 1 time in total.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Defining execution parameters.

Post by krstcs » Wed Mar 30, 2016 2:39 pm

No, there is no way to mask Global Parameters. Masking only works with data connectors.

Why are you not connecting to your application during the testing? You could just make that another part of your test and add the data for it (masked of course) and just drop it in another test case before you actual test cases.

In addition, you could use a CI system like Jenkins, Bamboo, or TeamCity to connect you application and then run the test.
Shortcuts usually aren't...

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Defining execution parameters.

Post by stapes » Wed Mar 30, 2016 2:43 pm

I wasn't asking to mask Global Parameters. I have already converted these to Masked columns in an Excel file.
I am talking about command line parameters.
This command line is being run by Jenkins. It is set up in the Configure - Execute Windows batch command.
Why are you not connecting to your application during the testing?
I don't know what you mean? My testing runs 3 applications.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Defining execution parameters.

Post by krstcs » Wed Mar 30, 2016 5:01 pm

Command line parameters are passed in as Global Parameters, that is why they are displayed under Global Parameters in the report.

And, no, there is no way in Ranorex to mask them.


You mentioned starting an SMTP client in Program.cs (at least that's how I read your initial post). This is what I was referring to. Why not just start it in the test suite and wrap it in a test case with masked password data?

If this isn't what you meant could you please explain in more detail what exactly you are trying to accomplish?
Shortcuts usually aren't...

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Defining execution parameters.

Post by stapes » Wed Mar 30, 2016 5:16 pm

I have added a Report Logger that is initialized in the Program.cs before TestSuiteRunner.Run. It is the parameters for this I need.

Code: Select all

        public static void AddReportLogger(string password, string cc, string smtpUser, string to)
        {
        	string from = "[email protected]";		
    		string subject="Ranorex Report for CustomLogging";
    		
            MailLogger mailLogger = new MailLogger(from , to, subject, cc, password, smtpUser    );
            Report.AttachLogger(mailLogger);
        }

Code: Select all

 public MailLogger(string from, string to, string subject, string cc, string password, string smtpUser)
        {
        	
			Password = password ;
			Username = smtpUser ;
			
            mail = new MailMessage(from, to);
            mail.Subject = subject;
            if(cc.Length > 0)
            {
	            MailAddress copy = new MailAddress(cc);
				mail.CC.Add(copy);
            }
        }

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Defining execution parameters.

Post by krstcs » Wed Mar 30, 2016 5:26 pm

Yeah, I would guess that you would probably need to encrypt the password and use that. Either that or try not using a password, but have an SSH key on the system that you point at for SMTP, if possible.
Shortcuts usually aren't...