Please use the Apache issue tracking system for new NetBeans issues ( !!

Bug 251158

Summary: Code Templates for JUnit and TestNG
Product: editor Reporter: rjdkolb
Component: Completion & TemplatesAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED QA Contact: issues <>
Priority: P3 CC: jkovalsky
Version: 8.0.2   
Target Milestone: 8.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Report:
Attachments: Proposed patch

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' ?
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo