对于web接口测试,做一下总结。
代码如下(本地文件名为iUriTest.ps1):
chcp 936 Write-Host "请输入以下接口信息" -ForegroundColor Yellow $iUri = Read-Host "接口uri" $i1Name = Read-Host "接口参数名1" $i2Name = Read-Host "接口参数名2" while($true){ $tip1 = "输入接口参数"+$i1Name+"的值:" Write-Host $tip1 -ForegroundColor Cyan $i1Value = Read-Host $tip2 = "输入接口参数 "+$i2Name+"的值:" Write-Host $tip2 -ForegroundColor Cyan $i2Value = Read-Host $uri = $iUri+"?"+$i1Name+"="+$i1Value+"&"+$i2Name+"="+$i2Value $back = Invoke-WebRequest -Uri $uri $back.Content }
在iUriTest.ps1文件上右键用PowerShell运行,如下:
原文:http://www.cnblogs.com/LanTianYou/p/5328893.html