<script language="javascript" src="%PUBURL%/%SYSTEMWEB%/JSUnitContrib/app/jsUnitCore.js"></script>
multiplyAndAddFive(value1, value2)
which multiplies value1
and value2
together, adds five, and returns the result. Also suppose that this function lives in a file called sample_script_to_test. Assume that if non-numeric values are passed in, the function should return null. A suitable Test Page would look like the following:
If installed this will result in: Run test<html> <head> <title>Test Page for multiplyAndAddFive(value1, value2)</title> <script language="javascript" src="%PUBURL%/%SYSTEMWEB%/JSUnitContrib/app/jsUnitCore.js"></script> <script language="javascript" src="%PUBURL%/%SYSTEMWEB%/JSUnitContrib/sample_script_to_test.js"></script> </head> <body> <script language="javascript"> function testWithValidArgs() { assertEquals("2 times 3 plus 5 is 11", 11, multiplyAndAddFive(2, 3)); assertEquals("Should work with negative numbers", -15, multiplyAndAddFive(-4, 5)); } function testWithInvalidArgs() { assertNull("A null argument should result in null", multiplyAndAddFive(2, null)); assertNull("A string argument should result in null", multiplyAndAddFive(2, "a string")); } function testStrictReturnType() { assertNotEquals("Should return a number, not a string", "11", multiplyAndAddFive(2, 3)); } function testWithUndefinedValue() { assertNull("An undefined argument should result in null", multiplyAndAddFive(2, JSUNIT_UNDEFINED_VALUE)); } </script> *[[%PUBURL%/%SYSTEMWEB%/JSUnitContrib/testRunner.html?testpage=%SCRIPTURL{"view"}%/%SYSTEMWEB%/JSUnitContrib][Run test]]* </body> </html>
JSUnitContrib.zip
in your ($TWIKI_ROOT) directory. Content: File: | Description: |
---|---|
data/System/JSUnitContrib.txt | |
lib/Foswiki/Contrib/JSUnitContrib.pm | |
pub/System/JSUnitContrib/sample_script_to_test.js | |
pub/System/JSUnitContrib/app/css/jsUnitStyle.css | |
pub/System/JSUnitContrib/app/css/readme | |
pub/System/JSUnitContrib/app/emptyPage.html | |
pub/System/JSUnitContrib/app/jsUnitCore.js | |
pub/System/JSUnitContrib/app/jsUnitMockTimeout.js | |
pub/System/JSUnitContrib/app/jsUnitTestManager.js | |
pub/System/JSUnitContrib/app/jsUnitTestSuite.js | |
pub/System/JSUnitContrib/app/jsUnitTracer.js | |
pub/System/JSUnitContrib/app/jsUnitVersionCheck.js | |
pub/System/JSUnitContrib/app/main-counts-errors.html | |
pub/System/JSUnitContrib/app/main-counts-failures.html | |
pub/System/JSUnitContrib/app/main-counts-runs.html | |
pub/System/JSUnitContrib/app/main-counts.html | |
pub/System/JSUnitContrib/app/main-data.html | |
pub/System/JSUnitContrib/app/main-errors.html | |
pub/System/JSUnitContrib/app/main-frame.html | |
pub/System/JSUnitContrib/app/main-loader.html | |
pub/System/JSUnitContrib/app/main-progress.html | |
pub/System/JSUnitContrib/app/main-results.html | |
pub/System/JSUnitContrib/app/main-status.html | |
pub/System/JSUnitContrib/app/testContainer.html | |
pub/System/JSUnitContrib/app/testContainerController.html | |
pub/System/JSUnitContrib/app/xbDebug.js | |
pub/System/JSUnitContrib/bin/mac/readme.txt | |
pub/System/JSUnitContrib/bin/mac/start-firefox.scpt | |
pub/System/JSUnitContrib/bin/mac/start-firefox.sh | |
pub/System/JSUnitContrib/bin/mac/start-safari.scpt | |
pub/System/JSUnitContrib/bin/mac/start-safari.sh | |
pub/System/JSUnitContrib/bin/mac/stop-firefox.scpt | |
pub/System/JSUnitContrib/bin/mac/stop-firefox.sh | |
pub/System/JSUnitContrib/bin/mac/stop-safari.scpt | |
pub/System/JSUnitContrib/bin/mac/stop-safari.sh | |
pub/System/JSUnitContrib/bin/unix/start-firefox.sh | |
pub/System/JSUnitContrib/bin/unix/stop-firefox.sh | |
pub/System/JSUnitContrib/build.xml | |
pub/System/JSUnitContrib/changelog.txt | |
pub/System/JSUnitContrib/css/jsUnitStyle.css | |
pub/System/JSUnitContrib/images/green.gif | |
pub/System/JSUnitContrib/images/logo_jsunit.gif | |
pub/System/JSUnitContrib/images/powerby-transparent.gif | |
pub/System/JSUnitContrib/images/red.gif | |
pub/System/JSUnitContrib/index.jsp | |
pub/System/JSUnitContrib/jsunit.properties.sample | |
pub/System/JSUnitContrib/licenses/gpl-2.txt | |
pub/System/JSUnitContrib/licenses/index.html | |
pub/System/JSUnitContrib/licenses/JDOM_license.txt | |
pub/System/JSUnitContrib/licenses/Jetty_license.html | |
pub/System/JSUnitContrib/licenses/lgpl-2.1.txt | |
pub/System/JSUnitContrib/licenses/MPL-1.1.txt | |
pub/System/JSUnitContrib/licenses/mpl-tri-license-c.txt | |
pub/System/JSUnitContrib/licenses/mpl-tri-license-html.txt | |
pub/System/JSUnitContrib/logging.properties | |
pub/System/JSUnitContrib/readme.txt | |
pub/System/JSUnitContrib/testRunner.html | |
pub/System/JSUnitContrib/tests/data/data.html | |
pub/System/JSUnitContrib/tests/data/staff.css | |
pub/System/JSUnitContrib/tests/data/staff.dtd | |
pub/System/JSUnitContrib/tests/data/staff.xml | |
pub/System/JSUnitContrib/tests/jsUnitAssertionTests.html | |
pub/System/JSUnitContrib/tests/jsUnitFrameworkUtilityTests.html | |
pub/System/JSUnitContrib/tests/jsUnitMockTimeoutTest.html | |
pub/System/JSUnitContrib/tests/jsUnitOnLoadTests.html | |
pub/System/JSUnitContrib/tests/jsUnitRestoredHTMLDivTests.html | |
pub/System/JSUnitContrib/tests/jsUnitSetUpTearDownTests.html | |
pub/System/JSUnitContrib/tests/jsUnitTestLoadData.html | |
pub/System/JSUnitContrib/tests/jsUnitTestLoadStaff.html | |
pub/System/JSUnitContrib/tests/jsUnitTestSetUpPages.html | |
pub/System/JSUnitContrib/tests/jsUnitTestSetUpPagesSuite.html | |
pub/System/JSUnitContrib/tests/jsUnitTestSuite.html | |
pub/System/JSUnitContrib/tests/jsUnitUtilityTests.html |
Copyright ©: | Copyright (C) 2001-6 Edward Hieatt, edward@jsunit.net. Packaged for TWiki 2006, Foswiki 2008 by Arthur Clemens. Directory java removed to reduce package size. |
License: | GPL, GNU Library or Lesser General Public License (LGPL), Mozilla Public License 1.1 (MPL 1.1) |
Dependencies: | None |
26 Nov 2008 | Re-packaged for Foswiki |
28 Oct 2006 | Version jsunit2.2alpha11 |
Home: | http://foswiki.org/Extensions/JSUnitContrib |
Feedback: | http://foswiki.org/Extensions/JSUnitContribDev |
Appraisal: | http://foswiki.org/Extensions/JSUnitContribAppraisal |
ExtensionClassification | |
ExtensionType | ContribPackage |
Compatibility | Deprecated: the source code "upstream" is no longer maintained. |
ImageUrl | |
DemoUrl | http:// |
SupportUrl | JSUnitContrib |
ModificationPolicy | PleaseFeelFreeToModify |
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
md5 | JSUnitContrib.md5 | manage | 162 bytes | 11 Aug 2011 - 11:50 | ArthurClemens | |
sha1 | JSUnitContrib.sha1 | manage | 186 bytes | 11 Aug 2011 - 11:50 | ArthurClemens | |
tgz | JSUnitContrib.tgz | manage | 73 K | 11 Aug 2011 - 11:50 | ArthurClemens | |
zip | JSUnitContrib.zip | manage | 106 K | 11 Aug 2011 - 11:50 | ArthurClemens | |
EXT | JSUnitContrib_installer | manage | 7 K | 11 Aug 2011 - 11:50 | ArthurClemens |