script argumet for . "$here\$sut" line

48 views
Skip to first unread message

Semen Gerasimov

unread,
Jul 1, 2015, 10:51:17 AM7/1/15
to pes...@googlegroups.com
Hi all!

Help me please. I create standart code production and test files. My code production file i use parameters, like this:

Param
(
    [parameter(Mandatory=$true)][string]$departmentID,
    [parameter(Mandatory=$true)][string]$domainController,
    [parameter(Mandatory=$true)][string]$departmentOUPath = "OU=departments,DC=ncp,DC=com"
)


In test file 3th line look like

. "$here\$sut"

Then i run Invoke-Pester powershell ask me input parameters departmentID, domainController and departmentOUPath.

How i should modify test file for include value for this arguments?

I try modify 3th line like this:

. "$here\$sut" -departmentID IT -domainController dc1 -departmentOUPat "ou=it,ou=departments,dc=company,dc=com"

. "$here\$sut -departmentID IT -domainController dc1 -departmentOUPat 'ou=it,ou=departments,dc=company,dc=com'"

but it does not solve the problem.

Dave Wyatt

unread,
Jul 1, 2015, 12:11:45 PM7/1/15
to pes...@googlegroups.com
What error do you get when you made those modifications?  It looks like it should be working.

Semen Gerasimov

unread,
Jul 2, 2015, 7:12:25 AM7/2/15
to pes...@googlegroups.com
I get error:

The term 'C:\scripts\ScriptName.ps1 -departmentID IT -domainController dc1 -departmentOUPat 'ou=it,ou=departments,dc=company,dc=com''
is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and 
try again.


среда, 1 июля 2015 г., 19:11:45 UTC+3 пользователь Dave Wyatt написал:

Semen Gerasimov

unread,
Jul 2, 2015, 7:31:18 AM7/2/15
to pes...@googlegroups.com
I find rigth line!

This is work line

"$here\$sut" IT dc1 "ou=it,ou=departments,dc=company,dc=com"
...

 Need use only values of arguments, without names of arguments.
Reply all
Reply to author
Forward
0 new messages