cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

CNDDevelopingUnitTests

How to create unit test

Hyperlink test

  1. browse org.netbeans.modules.cnd.completion.cplusplus.hyperlink package for existing TestCases
  2. if none of them fits well for you create a new TestCase:
    1. create a new class in the package org.netbeans.modules.cnd.completion.cplusplus.hyperlink, name MUST ends with "TestCase"
    2. this class MUST extend HyperlinkBaseTestCase
    3. register this new TestCase in CsmHyperlinkTest class
  3. add a new test to the TestCase:
    1. create a new method in the TestCase class, name MUST begin with "test"
    2. this method can contain one or more performTest calls
    3. first 3 arguments of perfromTest are: file, line, pos where to perform hyperlink
    4. last 3 arguments of perfromTest are: file, line, pos where hyperlink should jump
    5. file for the TestCase should be placed into cnd.completion/test/unit/data/org/netbeans/modules/cnd/completion/cplusplus/hyperlink/ <Name of the TestCase> folder
    6. file for the TestCase should be enclosed into a namespace with the unique name (such as IZ number you were fixing)