Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Calling PowerShell script From External Tool

Speedy993
Speedy993 Posts: 71

I am calling a small PowerShell script from the SOATest External Tool function. I am using this to update the passwords for a large number Active Directory test user accounts. The test will generate a new password, run the PowerShell script, update a SQL Server database table, and then update a KeePass repository. The PowerShell script is working but will occasionally fail. The problem is that when the script fails, I want to stop the test.
I searched the forum for PowerShell suggestions but did not find anything about my situation. I realize this may be more about PowerShell than SOATest but I also tried searching the web for information about return codes from script but did not find them helpful.
Thanks for any ideas.

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭
    edited November 19

    Some quick feedback:

    The External Tool has an "Exit value indicates success" option which can make the test fail on non-zero exit code.

    You can configure a test scenario to automatically abort from "Test Suite > Execution Options > Test Execution > Tests run as group > Abort scenario on > Any error".

  • Speedy993
    Speedy993 Posts: 71

    Thanks benken_parasoft!
    I do have that setting at Any error. I think I need to get my PowerShell script to return a nonzero code when the script fails. This is my first shot at PowerShell so I think I need to refine my code a little.