Lime (test framework)

Last updated
lime
Original author(s) Fabien Potencier
Developer(s) Bernhard Schussek
Initial releaseJanuary 29, 2007;17 years ago (2007-01-29)
Final release
1.0.9 [1] / May 19, 2010;14 years ago (2010-05-19)
Preview release
2.0.0alpha1 / November 9, 2009;14 years ago (2009-11-09)
Repository
Written in PHP
Operating system Cross-platform
Type Test tool
License MIT License
Website www.symfony-project.org

lime is a unit testing and functional testing framework built specifically for the Symfony web application framework based on the Test::More Perl library. [2] The framework is designed to have readable output from tests, including color formatting, by following the Test Anything Protocol which also allows for easy integration with other tools. [2] lime tests are run in a sandbox environment to minimize test executions from influencing each other. [2] Though the lime testing framework is built for testing within Symfony, lime is contained within a single PHP file and has no dependency on Symfony or any other library. [1] [2]

Contents

The alpha version of lime 2.0 was announced on November 10, 2009 [3] and is compatible with Symfony 1.2 and lower. [4] Symfony 2.0 uses PHPUnit for testing instead of lime. [5]

Example

lime unit tests use the lime_test object to make assertions. The following is a basic example lime unit test to test PHP's built-in in_array function.

include(dirname(__FILE__).'/bootstrap/unit.php');// Include lime.// Create the lime_test object for 10 number of assertions and color output.$t=newlime_test(10,newlime_output_color());// The test array.$arr=array('Hello','World',123,);// Output a comment.$t->diag('in_array()');// Test to make sure in_array returns a boolean value for both values// that are in the array and not in the array.$t->isa_ok(in_array('hey',$arr),'bool','\'in_array\' did not return a boolean value.');$t->isa_ok(in_array('Hello',$arr),'bool','\'in_array\' did not return a boolean value.');$t->isa_ok(in_array(5,$arr),'bool','\'in_array\' did not return a boolean value.');$t->isa_ok(in_array(FALSE,$arr),'bool','\'in_array\' did not return a boolean value.');// Test to make sure in_array can find values that are in the array// and doesn't find values that are not in the array.$t->ok(!in_array('hey',$arr),'\'in_array\' found a value not in the array.');$t->ok(!in_array(5,$arr),'\'in_array\' found a value not in the array.');$t->ok(!in_array(FALSE,$arr),'\'in_array\' found a value not in the array.');$t->ok(in_array('Hello',$arr),'\'in_array\' failed to find a value that was in the array.');$t->ok(in_array('World',$arr),'\'in_array\' failed to find a value that was in the array.');$t->ok(in_array(123,$arr),'\'in_array\' failed to find a value that was in the array.');

Version 2.0

The alpha version of lime 2.0 was announced on the Symfony blog on November 10, 2009. [6] The second version of lime was built to be as backward compatible with the first version as was possible - the two parts of lime 2.0 that are not compatible with lime 1.0 are the configuration of the test harness and the LimeCoverage class. [3] lime 2.0 includes support for xUnit output, source code annotations, parallel execution of tests, automatic generation of mock and stub objects, and operator overloading for data within tests. [3] Unlike the first version of lime, lime 2.0 does have some dependencies on Symfony. [5]

See also

Related Research Articles

Generic programming is a style of computer programming in which algorithms are written in terms of data types to-be-specified-later that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by the ML programming language in 1973, permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplicate code.

In computer science, primitive data types are a set of basic data types from which all other data types are constructed. Specifically it often refers to the limited set of data representations in use by a particular processor, which all compiled programs must use. Most processors support a similar set of primitive data types, although the specific representations vary. More generally, "primitive data types" may refer to the standard data types built into a programming language. Data types which are not primitive are referred to as derived or composite.

<span class="mw-page-title-main">ActionScript</span> Object-oriented programming language created for the Flash multimedia platform

ActionScript is an object-oriented programming language originally developed by Macromedia Inc.. It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript, though it originally arose as a sibling, both being influenced by HyperTalk. ActionScript code is usually converted to byte-code format by a compiler.

<span class="mw-page-title-main">Foreach loop</span> Control flow statement for traversing items in a collection

In computer programming, foreach loop is a control flow statement for traversing items in a collection. foreach is usually used in place of a standard for loop statement. Unlike other for loop constructs, however, foreach loops usually maintain no explicit counter: they essentially say "do this to everything in this set", rather than "do this x times". This avoids potential off-by-one errors and makes code simpler to read. In object-oriented languages, an iterator, even if implicit, is often used as the means of traversal.

In computer programming, the ternary conditional operator is a ternary operator that is part of the syntax for basic conditional expressions in several programming languages. It is commonly referred to as the conditional operator, ternary if, or inline if. An expression a ? b : c evaluates to b if the value of a is true, and otherwise to c. One can read it aloud as "if a then b otherwise c". The form a ? b : c is by far and large the most common, but alternative syntaxes do exist; for example, Raku uses the syntax a ?? b !! c to avoid confusion with the infix operators ? and !, whereas in Visual Basic .NET, it instead takes the form If(a, b, c).

<span class="mw-page-title-main">Java syntax</span> Set of rules defining correctly structured program

The syntax of Java is the set of rules defining how a Java program is written and interpreted.

In computer science, the Boolean is a data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false. It is a special case of a more general logical data type—logic does not always need to be Boolean.

A bit array is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level parallelism in hardware to perform operations quickly. A typical bit array stores kw bits, where w is the number of bits in the unit of storage, such as a byte or word, and k is some nonnegative integer. If w does not divide the number of bits to be stored, some space is wasted due to internal fragmentation.

TestNG is a testing framework for the Java programming language created by Cedric_Beust and inspired by JUnit and NUnit. The design goal of TestNG is to cover a wider range of test categories: unit, functional, end-to-end, integration, etc., with more powerful and easy-to-use functionalities.

In software engineering, a plain old Java object (POJO) is an ordinary Java object, not bound by any special restriction. The term was coined by Martin Fowler, Rebecca Parsons and Josh MacKenzie in September 2000:

"We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely."

IP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system. It implements the language "Pascaline", and has passed the Pascal Validation Suite.

<span class="mw-page-title-main">Symfony</span> PHP web application framework for MVC applications

Symfony is a free and open-source PHP web application framework and a set of reusable PHP component libraries. It was published as free software on October 18, 2005, and released under the MIT License.

<span class="mw-page-title-main">JavaScript syntax</span> Set of rules defining correctly structured programs

The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program.

This Comparison of programming languages (associative arrays) compares the features of associative array data structures or array-lookup processing for over 40 computer programming languages.

The syntax and semantics of PHP, a programming language, form a set of rules that define how a PHP program can be written and interpreted.

XPath is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999, and can be used to compute values from the content of an XML document. Support for XPath exists in applications that support XML, such as web browsers, and many programming languages.

<span class="mw-page-title-main">Jasmine (software)</span> Open-source testing framework for JavaScript

Jasmine is an open-source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax. It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.

QUnit is a JavaScript unit testing framework. Originally developed for testing jQuery, jQuery UI and jQuery Mobile, it is a generic framework for testing any JavaScript code. It supports client-side environments in web browsers, and server-side.

In software engineering, the module pattern is a design pattern used to implement the concept of software modules, defined by modular programming, in a programming language with incomplete direct support for the concept.

In computer science, a type family associates data types with other data types, using a type-level function defined by an open-ended collection of valid instances of input types and the corresponding output types.

References

  1. 1 2 "/tools/lime/tags/RELEASE_1_0_9 (log)". symfony - Trac. Archived from the original on 2016-07-30.
  2. 1 2 3 4 Potencier, Fabien; Zaninotto, François. The Definitive Guide to symfony, Apress, January 26, 2007, pp. 317-344. ISBN   1-59059-786-9
  3. 1 2 3 "Lime 2 alpha released (Symfony Blog)".
  4. "Using Symfony's Lime in phpUnderControl". Archived from the original on 2018-02-05.
  5. 1 2 "Can someone post a full working example of Lime 2 annotations?". Archived from the original on 2013-04-06.
  6. SensioLabs. "(Press Release) Lime 2 alpha released" . Retrieved 2017-11-23.