<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Self-testing_code</id>
	<title>Self-testing code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Self-testing_code"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Self-testing_code&amp;action=history"/>
	<updated>2026-10-25T03:02:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Self-testing_code&amp;diff=4186831&amp;oldid=prev</id>
		<title>imported&gt;Rich Farmbrough: Copyedit.</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Self-testing_code&amp;diff=4186831&amp;oldid=prev"/>
		<updated>2025-04-23T19:05:25Z</updated>

		<summary type="html">&lt;p&gt;Copyedit.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Self-testing code&amp;#039;&amp;#039;&amp;#039; is software that incorporates built-in tests (see [[test-first development]]).&amp;lt;ref&amp;gt;{{Cite web |title=Self-testing infrastructure-as-code |url=https://opencredo.com/blogs/self-testing-infrastructure-as-code/ |access-date=2022-12-05 |website=OpenCredo |language=en-US}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web |title=Self Testing Code |url=https://martinfowler.com/bliki/SelfTestingCode.html |access-date=2022-12-05 |website=martinfowler.com}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Perl]] packages will run their self tests when they are installed using [[CPAN]].  This ensures that they run successfully in the local environment.  (There is also a testing community that tests new packages and updated packages on many different platforms.)&lt;br /&gt;
&lt;br /&gt;
In [[Java (programming)|Java]], to execute a [[unit test]] from the [[command line]], a [[class (computer science)|class]] can have methods like the following.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
// Executing &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; runs the unit test.&lt;br /&gt;
public static void main(String[] args) {&lt;br /&gt;
    test();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void test() {&lt;br /&gt;
    assert foo == bar;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To invoke a full [[system test]], a class can incorporate a method call.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public static void main(String[] args) {&lt;br /&gt;
    test();&lt;br /&gt;
    TestSuite.test();    // invokes full system test&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In addition, Java has some Jupiter API libraries for self-testing code. assert can be used in various ways such as assert equals, which checks if the given variable is equal to the value given.&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@Test&lt;br /&gt;
void checkplayer() {&lt;br /&gt;
        Board board = new Board(10);&lt;br /&gt;
        board.addplayer(1);&lt;br /&gt;
        int check = board.getCurrentPlayer(1);&lt;br /&gt;
        assertEquals(1, check);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Software development]]&lt;br /&gt;
*[[Extreme programming]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
{{Authority control}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Articles with example Java code]]&lt;br /&gt;
[[Category:Unit testing]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Soft-eng-stub}}&lt;/div&gt;</summary>
		<author><name>imported&gt;Rich Farmbrough</name></author>
	</entry>
</feed>