Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Architecture  



1.1  Test case  





1.2  Assertions  





1.3  Test suite  





1.4  Test fixture  





1.5  Test runner  







2 See also  





3 References  





4 External links  














xUnit






Deutsch
Español
Français

Italiano

Português
Русский
Suomi
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


xUnit is a label used for an automated testing software framework that shares significant structure and functionality that is traceable to a common progenitor SUnit.

The SUnit framework was portedtoJava by Kent Beck and Erich GammaasJUnit which gained wide popularity. Adaptations to other languages were also popular which led some to claim that the structured, object-oriented style works well with popular languages including Java and C#.

The name of an adaptation is often a variation of "SUnit" with the "S" replaced with an abbreviation of the target language name. For example, JUnit for Java and RUnit for R. The term "xUnit" refers to any such adaptation where "x" is a placeholder for the language-specific prefix.

The xUnit frameworks are often used for unit testing – testing an isolated unit of code – but can be used for any level of software testing including integration and system.

Architecture[edit]

An xUnit framework has the following general architecture.[1]

Test case[edit]

Atest case is the smallest part of a test that generally encodes a simple path through the software under test. The test case code prepares input data and environmental state, invokes the software under test and verifies expected results.

A programmer writes the code for each test case.

Assertions[edit]

A test case is implemented with one or more assertions that validate expected results.

Generally, the framework provides assertion functionality. A framework may provide a way to use custom assertions.

Test suite[edit]

Atest suite is a collection of related test cases. They share a framework which allows for reuse of environment setup and cleanup code.

Generally, a test runner may run the cases of a suite in any order so the programmer should not depend on top-to-bottom execution order.

Test fixture[edit]

Atest fixture (also known as a test context) provides the environment for each test case of a suite. Generally, a fixture is configured to setup a known, good, runtime environment before tests run, and to cleanup the environment after.

The fixture is configured with one or more functions that setup and cleanup state. The test runner runs each setup function before each case and runs each cleanup function after.

Test runner[edit]

A test runner is a program that runs tests and reports results.[2] The program is often part of a framework.

A test runner may produce results in various formats. Often, a common and default format is human-readable, plain-text. Additionally, the runner may produce structured output. Some xUnit adaptations (i.e. JUnit) can output XML that can be used by a continuous integration system such as Jenkins and Atlassian Bamboo.

See also[edit]

References[edit]

  1. ^ Beck, Kent. "Simple Smalltalk Testing: With Patterns". Archived from the original on 15 March 2015. Retrieved 25 June 2015.
  • ^ Meszaros, Gerard (2007) xUnit Test Patterns, Pearson Education, Inc./Addison Wesley
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=XUnit&oldid=1227058402"

    Category: 
    Unit testing frameworks
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
    Pages displaying wikidata descriptions as a fallback via Module:Annotated link
     



    This page was last edited on 3 June 2024, at 12:42 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki