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

Unit testing?

I only just noticed there was a new editor version.
What is 'Unit Testing'

Comments

  • tools->Unit Testing ???

    also
    File->New->Item->Test Module:

    function Test_{NAME}(@Test)
    does {NAME} imply that you manually change


    Sorry if I am missing something obvious here.

    Is there any post about these new features?
  • @BarryStevens sorry...those of us who can best answer your questions are onsite at a client location for the week so we've been busy. Coincidentally, we spent part of one of our days giving a presentation on this very feature.

    Stay tuned and we'll provide more information as soon as we return and are able to settle in. In the meantime, you can get introduced to the concept of unit testing with this Wikipedia article.
  • I know what unit testing is, just needed to know how your setup is supposed to work.
  • edited April 2019
    @BarryStevens I'm not aware of any posts on the unit testing features that the SRP Editor offers, however I can give a brief introduction of what I know here. Perhaps others with more extensive knowledge can supplement this post.

    To start, yes {NAME} does imply that this is where you will enter the name of your unit test module. Here is an example of a unit test I have named (and compiled), Test_Sample. Note that I have exposed the Unit Test Panel on the right side of the SRP Editor by pressing F10.



    Essentially the idea is that you use the "Assert" keyword at the end of any given test that you write to determine if the result of your code within the test equals what you are expecting it to equal.

    Next, if you scroll down within the Unit Test Panel you will see that the SRP Editor has added a collapsible entry with my new "Sample" test module. If you right click on a given test, you can run that single test and view the results in the status window on the bottom of the SRP Editor. Here we see that our SampleSuccess test passed since we Asserted that Value (which holds the value 1) equals 1.




    You can also run all tests in every compiled test module by right clicking any test in the Unit Test Panel and selecting "Run All."




    Finally, you can alternatively run a test within a test module that you have open and active by pressing the execute button or by pressing F9.



    Let me know if you have additional questions.

    Cheers 🍻



  • Excellent answer @DanielStieber! Thanks for stepping in. Just a minor correction. To run the current unit test you are in, it's Ctrl+F9 rather than simply F9.
  • Ok thanks, that makes sense now.
    Is the code in the ssp new stuff that has been added to the Srp_Precompiler, or has it been there all along?
    Which brings me to - Is there any single place documentation on the commands\format for Srp_PreCompiler
  • Documentation for both Extended BASIC+ and Unit Testing is forthcoming.
  • Ok thanks, so I didn't miss anything, just jumped the gun :)
  • Kevin,

    >>Documentation for both Extended BASIC+
    I came across this and now I cant find it.
    Can you point to where it is please.
  • Ah, knew it was obscure (maybe Srp Editor should have a link to here)
    Yes, I know that it is the srputils that does most of the heavy lifting so that you dont need Srp editor for most of the functions.
  • No, you're right. We plan to document it in SRP Editor as well, especially since the SRP Editor has some unique interactions with the precompiler.
Sign In or Register to comment.