Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Powershell script to get custom steps_separated


#1

Hi!

I’m very new with Powershell and even programming. I am a tester and trying to create a powershell script that will automatically get all the custom steps and expected result.

Can anybody help me with this script:

testCases = Get-TestProject | Where {_.name -like ‘Mock Automation Test’} | Get-TestSuite | Get-TestCase
$testCases
foreach ($testCase in $testCases)
{
if (-not (Test-Path “C:\Testing\Tests$($testCase.id).ps1”))
{
$contents = @()
contents += ,"# ($testCase.title)"
contents += ,"# https://xxxxxx.testrail.com/index.php?/cases/view/($testCase.id)"
$contents += ,""
$contents += ,"# Pre Condition"
$contents += ,"#-------------"
contents += ,"# ($testCase.custom_preconds)"
$contents += ,""
$contents += ,"# Step 1"
$contents += ,"#-------------"
contents += ,"($testCase.custom_steps_separated)"

    $contents += ,"