Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SRP Editor Unit Test Feature

edited November 2022 in SRP Editor Control

I noticed there is a Unit Test Feature in SRP editor. But I don't understand how to use it.

We are looking into creating integration tests for our web APIs...I was planning onmaking my own test framework for OI, but if you have already created one, I might as well use it.



  • In the SRP Editor, press Ctrl+N to bring up a window giving you some templates. Choose Test Module. When you save and compile, the tests should appear in the Test pane (press F10 to make it visible). In your tests, you can do any number of "Assert X equals Y" statements, where X is what you are testing and Y is what you are expecting.

    When you are ready to run tests, select tests in the pane you want to run (you can Shift and Ctrl click). Right click and select Run These to run them. Or, just right click anywhere in the pane and Run All. You'll see pass fail icons next to each test you ran. Click on a failed test to see what went wrong, the status pane at the bottom will show the Actual value next to the Expected value.

    You can double click on a test to jump to the code. If you want to debug a test, put a debug in it and while the cursor is inside the test, press Ctrl+F9. This will tell SRP Editor to just run that test. Even if you don't put in a debug, Ctrl+F9 is handy way to run the test you're currently in to see if it passes.

    Here's a sample test I made to test the SRP_Array "Clean" service in our SRP Utilities:

    Test Clean Array = "Don":@FM:@FM:@FM:"Don":@FM:@FM:@FM:"Paul":@FM:@FM:@FM:"Frank":@FM:@FM:@FM:"Bob":@FM:@FM:@FM Cleaned = SRP_Array("Clean", Array) Assert Cleaned equals "Don":@FM:"Don":@FM:"Paul":@FM:"Frank":@FM:"Bob" Recleaned = SRP_Array("Clean", Cleaned) Assert Recleaned equals Cleaned End Test
  • That's really good

Sign In or Register to comment.