0
我试图从powershell运行nuint控制台在我的应用程序上运行一些Selenium测试。试图获取Powershell中的最新文件夹名称
在PowerShell中条命令是如下:
$command = 'D:\tools\NUnitTestRunner\nunit3-console.exe "\\myserver\Drops\MyProj\MyApp_20170214.1\App.Selenium.Tests.dll"'
iex $command
可正常工作。但是,我想要改变的是双“”。我想运行我的回归测试,当一个版本被删除到一个新的App.Selenium.Test.dll将被删除的文件夹 - 与文件夹MyApp_DATE.DropNumber将改变。
所以我可能会安装路径下的\ MYSERVER \滴眼液\的Myproj \像下面的文件夹:
MyApp_20170214.1
MyApp_20170214.2
MyApp_20170214.3
MyApp_20170214.4
我要动态地获取最新的文件夹,并把它放到命令,而不是在每个去时间和硬编码。这是我曾尝试:
$logFile = "$PSScriptRoot\NunitLog.txt"
$dir = "\\myserver\Drops\MyProj\"
#Go get the latest Folder Name
$latest = Get-ChildItem $dir Where { $_.PSIsContainer } | Sort CreationTime -Descending | Select -First 1
#remove old log file
if(Test-Path $logFile) { Remove-Item $logFile }
"Starting Selenium Tests" | Out-File $logFile -Append
$latest.name | Out-File $logFile -Append
#Start nUnit Console and pass argument which is the latest path to the dll of the tests
#$command = 'D:\tools\NUnitTestRunner\nunit3-console.exe "$latest.name"'
但是,它不输出文件夹名,日志文件或命令运行它
这正是我所需要的 - 欢呼 –
很酷。乐意效劳 :) – TechSpud