This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251158 - Code Templates for JUnit and TestNG
Summary: Code Templates for JUnit and TestNG
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
Depends on:
Reported: 2015-03-13 12:21 UTC by rjdkolb
Modified: 2015-05-26 06:03 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Proposed patch (1.18 KB, patch)
2015-03-26 22:55 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rjdkolb 2015-03-13 12:21:29 UTC
To make testing in Netbeans TDD easier, can you please add the following 'Code Templates'

junit :
@${baseType type="org.junit.Test" default="Test" editable="false"}
public void ${cursor}() {

testng :
@${baseType type="org.testng.annotations.Test" default="Test" editable="false"}
public void ${cursor}() {
Comment 2 rjdkolb 2015-03-13 16:25:29 UTC
Correct, please can you credit the author.  
Comment 3 gualtiero65 2015-03-17 06:54:40 UTC
(In reply to markiewb from comment #1)
> FYI: Code seems to be taken from
> junit-test-method-template-in-netbeans/

I agree and also voted for this issue.

Gualtiero Testa
Comment 4 markiewb 2015-03-26 22:55:17 UTC
Created attachment 152870 [details]
Proposed patch

@Dusan: Please review the patch and apply it. Thank you
Comment 5 Dusan Balek 2015-03-27 09:25:15 UTC
Patch integrated. Thanks.
Comment 6 rjdkolb 2015-03-27 09:31:27 UTC
Thanks :)
Comment 7 Quality Engineering 2015-03-28 08:20:19 UTC
Integrated into 'main-silver', will be available in build *201503280001* on (upload may still be in progress)

User: Dusan Balek <>
Log: Issue #251158: Code Templates for JUnit and TestNG - fixed.
Comment 8 Jiri Kovalsky 2015-04-17 12:17:38 UTC
Product Version: NetBeans IDE Dev (Build 201504170001)
Java: 1.8.0_40; Java HotSpot(TM) 64-Bit Server VM 25.40-b25
Runtime: Java(TM) SE Runtime Environment 1.8.0_40-b25
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb)

Thanks Gualtiero for the idea, thanks Benno for the patch and thanks Dusane for the integration! Verified.
Comment 9 rjdkolb 2015-05-26 06:03:31 UTC
The feature works great for JUnit and TestNG.

Apologies, but the keyword 'testng' seems natural , but the 'junit' keyword does not since it auto completes to @Test. (My fault)

Is it possible to change 'junit' to 'test' ?