Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p><a href="http://testng.org">TestNG</a> is a testing framework inspired from JUnit and NUnit but with new functionality to make it more powerful and easier to use. Features include:</p> <ul> <li>JDK 5 Annotations (JDK 1.4 is also supported with JavaDoc annotations)</li> <li>Flexible test configuration</li> <li>Support for data-driven testing (with @DataProvider)</li> <li>Support for parameters</li> <li>Allows distribution of tests on slave machines</li> <li>Powerful execution model (no more TestSuite)</li> <li>Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...)</li> <li>Embeds BeanShell for further flexibility</li> <li>Default JDK functions for runtime and logging (no dependencies)</li> <li>Dependent methods for application server testing</li> </ul> <p>TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc...</p> <p>The sections below illustrate using TestNG for the examples from <a class="confluence-link" href="/display/GROOVY/Using+Testing+Frameworks+with+Groovy" data-linked-resource-id="67695" data-linked-resource-type="page" data-linked-resource-default-alias="Using Testing Frameworks with Groovy" data-base-url="http://docs.codehaus.org">Using Testing Frameworks with Groovy</a>.</p> <h2>The Item Storer Example</h2> <p>Here is how you might use TestNG to integration test the <a class="confluence-link" href="/display/GROOVY/Using+Testing+Frameworks+with+Groovy#UsingTestingFrameworkswithGroovy-AnItemStorerExample" data-anchor="AnItemStorerExample" data-linked-resource-id="67695" data-linked-resource-type="page" data-linked-resource-default-alias="Using Testing Frameworks with Groovy#AnItemStorerExample" data-base-url="http://docs.codehaus.org">Item Storer Example</a>:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> // require(groupId:'org.testng', artifactId:'testng', version='5.6') import org.testng.annotations.* import org.testng.TestNG import org.testng.TestListenerAdapter class StorerIntegrationTest { private storer @BeforeClass def setUp() { storer = new Storer() } private checkPersistAndReverse(value, reverseValue) { storer.put(value) assert value == storer.get() assert reverseValue == storer.getReverse() } @Test void shouldPersistAndReverseStrings() { checkPersistAndReverse 'hello', 'olleh' } @Test void shouldPersistAndReverseNumbers() { checkPersistAndReverse 123.456, -123.456 } @Test void shouldPersistAndReverseLists() { checkPersistAndReverse([1, 3, 5], [5, 3, 1]) } } def testng = new TestNG() testng.setTestClasses(StorerIntegrationTest) testng.addListener(new TestListenerAdapter()) testng.run() </pre></td></tr></table> <p>You might also like to consider the special Groovy integration from the <a href="http://code.google.com/p/testngroove/">Test'N'Groove</a> project which provides command-line runners and ant tasks for using TestNG with Groovy.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced