The Welkin Suite Forum

Class template for test classes



Class template for test classes

  • Please log in to reply

#1

logan.moore

    Posted 20 Jul 2015

    I know it's not that hard to add the @IsTest annotation to a new class, but have a template that creates a test class is something I miss. I have a custom template that creates a test method which always asserts false with the message "test method not implemented" which reminds me that I need to write the tests before deploying. That's not for everyone mind you.

    Am I able to add my own templates for making new classes?



    9 replies to this topic

    #2

    vlgubanovich

      Posted 20 Jul 2015

      Hi logan.moore,


      I'm not sure that our current implementation supports comparable easy templates addition, however as a workaround you can create your own snippet, then a class and use that snippet to populate it with test methods or with the whole class body.


      We'll post an article in some days with detailed description on how to modify existing or create new snippets.


      I hope that this may help you until we adjust our implementation to be flexible and customizable as we'd like it to be.


      Thanks,

      Vladimir


      Vladimir Gubanovich
      Head of Product
       
      The Welkin Suite
      skype id: vladimir.gubanovich
      e-mail: vladimir.gubanovich@welkinsuite.com


      #3

      vlgubanovich

        Posted 21 Jul 2015

        Hi logan.moore,


        We've just posted a small tutorial how to add your own custom snippets - http://welkinsuite.com/using-editing-and-modifying-apex-code-snippets/

        This may help you a bit I think.


        Thanks,

        Vladimir


        Vladimir Gubanovich
        Head of Product
         
        The Welkin Suite
        skype id: vladimir.gubanovich
        e-mail: vladimir.gubanovich@welkinsuite.com


        #4

        logan.moore

          Posted 23 Jul 2015

          I can make that work :). Something along the lines of Ctrl+A -> Delete -> Use snippet. That will save many minutes of development over writing the classes from scratch.



          #5

          vlgubanovich

            Posted 23 Jul 2015

            Hi logan.moore,


            But please take into account one existing issue - if you'll rename class in editor itself (e.g. change "public class TestClass1" to "public class TestClass2") project won't be built. So if you'll use snippet for full body replacement - don't forget to name it the same as initial class was named.


            Vladimir


            Vladimir Gubanovich
            Head of Product
             
            The Welkin Suite
            skype id: vladimir.gubanovich
            e-mail: vladimir.gubanovich@welkinsuite.com


            #6

            oleksiy

              Posted 04 Jan 2016

              But please take into account one existing issue - if you'll rename class in editor itself (e.g. change "public class TestClass1" to "public class TestClass2") project won't be built. So if you'll use snippet for full body replacement - don't forget to name it the same as initial class was named.

              How do we rename the class then?



              #7

              kate.dulko

                Posted 05 Jan 2016

                Hi Oleksiy,

                Thank you for contacting us with this question.


                You can rename your class on Salesforce and then make the Pull of your project in the IDE.


                Regards,

                Kate


                Kate Dulko
                Customer Relations

                The Welkin Suite

                twitter: @KateDulko
                skype id: d_katerina
                e-mail: kate.dulko@welkinsuite.com

                 

                  


                #8

                oleksiy

                  Posted 07 Jan 2016

                  Kate, it works with one exception when name is kept the same and only letter(s) registry is changed, TWS deletes the old file and do not create a new one like it does for the actually renamed. I had to initiate another pull request to get the missing class (and considering that I subscribed for the Apex classes, otherwise  believe I won't be able to pull the missing renamed class)



                  #9

                  kate.dulko

                    Posted 08 Jan 2016

                    Hi Oleksiy,


                    Thank you that you brought this issue to our attention.

                    We have already added this case to our current sprint.

                    The new version of the IDE with its fix will be released next week.


                    Regards,

                    Kate.


                    Kate Dulko
                    Customer Relations

                    The Welkin Suite

                    twitter: @KateDulko
                    skype id: d_katerina
                    e-mail: kate.dulko@welkinsuite.com

                     

                      


                    #10

                    kate.dulko

                      Posted 18 Jan 2016

                      Hi Oleksiy,


                      I want to inform you that the fix of the issue related to the renaming of a class is included to the newly released version 0.26.7 of the IDE.

                      Please let us know if it is solved for you.


                      Thank you,

                      Kate


                      Kate Dulko
                      Customer Relations

                      The Welkin Suite

                      twitter: @KateDulko
                      skype id: d_katerina
                      e-mail: kate.dulko@welkinsuite.com

                       

                        





                      Boost Your Productivity. Get Started Today

                      Try Free Trial