All Projects → bennadel → Tinytest

bennadel / Tinytest

Licence: other
A tiny unit testing framework built as a means to learn more about unit testing in ColdFusion.

Projects that are alternatives of or similar to Tinytest

TestBox
TestBox is a next generation testing framework for ColdFusion (CFML) that is based on BDD (Behavior Driven Development) for providing a clean obvious syntax for writing tests. It also includes MockBox, our mocking and stubbing framework.
Stars: ✭ 54 (+315.38%)
Mutual labels:  coldfusion
Db Dot Cfc
Enhances cfquery by analyzing SQL to enforce security & framework conventions.
Stars: ✭ 5 (-61.54%)
Mutual labels:  coldfusion
Introtogit
Intro to Git presentation materials
Stars: ✭ 9 (-30.77%)
Mutual labels:  coldfusion
lucee-docs
Source and build scripts for Lucee's documentation.
Stars: ✭ 39 (+200%)
Mutual labels:  coldfusion
Cfmessenger v0.2.0
Stars: ✭ 5 (-61.54%)
Mutual labels:  coldfusion
Bernoutjethol
Stars: ✭ 8 (-38.46%)
Mutual labels:  coldfusion
core
FarCry Core: a web app framework for the ColdFusion language (supporting Lucee & Adobe ColdFusion engines). An ideal platform for building bespoke or tailor made solutions.
Stars: ✭ 34 (+161.54%)
Mutual labels:  coldfusion
Combine
Serves Combined & compressed js & css with caching, using ColdFusion
Stars: ✭ 11 (-15.38%)
Mutual labels:  coldfusion
Birthdayreminder v0.2.0
Stars: ✭ 5 (-61.54%)
Mutual labels:  coldfusion
Docker Lucee Mysql
Starter project for running CFML Applications in Dev & Production on Lucee & MySQL.
Stars: ✭ 9 (-30.77%)
Mutual labels:  coldfusion
Muracms
Mura | Digital Experience Platform | Headless CMS
Stars: ✭ 267 (+1953.85%)
Mutual labels:  coldfusion
Lucee
Lucee Server is a dynamic, Java based (JSR-223), tag and scripting language used for rapid web application development. Lucee simplifies technologies like webservices (REST, SOAP, HTTP), ORM (Hibernate), searching (Lucene), datasources (MSSQL, Oracle, MySQL and others), caching (infinispan, ehcache, and memcached) and many more. Lucee provides a compatibility layer for Adobe ColdFusion © CFML using less resources and delivering better performance.
Stars: ✭ 719 (+5430.77%)
Mutual labels:  coldfusion
Cfeosocial
cfeoSocial is a set of gateways/test pages to integrate with Social Media APIs (Google,LinkedIn,Facebook).
Stars: ✭ 8 (-38.46%)
Mutual labels:  coldfusion
UnderscoreCF
An UnderscoreJS port for Coldfusion. Functional programming library.
Stars: ✭ 89 (+584.62%)
Mutual labels:  coldfusion
Mobilemura
MobileMura is a plugin that adds advanced mobile features to Mura CMS.
Stars: ✭ 9 (-30.77%)
Mutual labels:  coldfusion
monkehTweets
A ColdFusion wrapper to interact with the Twitter API (with OAuth integration)
Stars: ✭ 52 (+300%)
Mutual labels:  coldfusion
Lucee Aws
Lucee extension to provide simpler access to common AWS commands through the AWS SDK
Stars: ✭ 24 (+84.62%)
Mutual labels:  coldfusion
Toscript
Converts Tag based CFML to CFML Script
Stars: ✭ 12 (-7.69%)
Mutual labels:  coldfusion
Cfmlstats
Parses your CFML code base and gives you stats
Stars: ✭ 10 (-23.08%)
Mutual labels:  coldfusion
Forecastcfml
a cfml wrapper for Forecast.io api
Stars: ✭ 8 (-38.46%)
Mutual labels:  coldfusion

Tiny Test - ColdFusion Unit Testing Framework

by Ben Nadel

Tiny Test is a ColdFusion unit testing framework that I built for personal use as a means to become more comfortable with the idea of unit testing and TDD (Test Drive Development). The feature is set is intended to be incredibly limited; and, it's meant to work with an HTML page that comes pre-packaged with the framework. You just drop it in, point it at the test specifications, and open it up in the browser.

If you want a more full-featured unit testing framework, I would suggest looking into MXUnit; it's a robust unit testing framework that has been battle-hardened for years by the ColdFusion community.

Railo Compatibility

Railo's ColdFusion engine has some settings that require you to use explicit Arguments and Variables scope references. Since I am doubtful that I can be mindful of this, I have created a separate Railo branch branch. As features are added here, they will be cherry-picked into the Railo branch to keep the two in sync.

Specs Directory

Tiny Test will look in the "specs" directory for your test cases. It will attempt to run any ColdFusion component whose name ends with, "Test.cfc". For example, the following are all valid test case file names:

  • AccountTest.cfc
  • PrimeNumberGeneratorTest.cfc
  • UserServiceTest.cfc

While Tiny Test will examine all of these ColdFusion components, it will only invoke the ones that you specify in the HTML web page served up by the Tiny Test framework.

Test Cases

Inside of your test cases, Tiny Test will attempt to invoke every public method that starts with, "test". For example, the following are all valid test method names:

  • testThatThatWorks();
  • testThatThisWorks();

Within each test case can define optional methods that run before and / or after each test method:

  • beforeTests()
  • setup()
  • teardown()
  • afterTests()

In these methods, you can reset the private variables of your test case to be "pristine" for each invocation of the provided test methods.

Each of your test cases should extend the TestCase.cfc component that ships in the specs directory. This is your bridge into the core functionality provided by Tiny Test.

  • The 'beforeTests()' method executes once before all tests
  • The 'setup()' method executes before any test case
  • The 'teardown' method executes after any test case
  • The 'afterTests()' method executes once after all tests execute, even if they produced failures or exceptions.

Assertions

Each of your test methods will probably make some assertion based on the state of your components. Out of the box, Tiny Test provide only the most basic assertions:

  • assert( truthy )
  • assertTrue( truthy )
  • assertFalse( falsey )
  • assertEquals( simpleValue, simpleValue )
  • assertNotEquals( simpleValue, simpleValue )

If you want to add your own custom assertions, feel free to add them to the TestCase.cfc provided in the specs directory. Since each of your test cases extends this base component, each of your test cases will have access to the custom methods that you define within TestCase.cfc.

Inside of your custom assertions, you can make use of the private method, fail(), which is how the Tiny Test tracks exceptions:

  • fail( errorMessage )

Hopefully you've found some of this vaguely interesting.

JavaScript Version - Tiny Test JS

I have ported the Tiny Test unit testing framework (as best as possible) over to JavaScript. I call it (no surprise) Tiny Test JS. It is an AngularJS application that is loaded by RequireJS and then, subsequently, uses RequireJS to load all of the test case modules.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].