What is an "assertion framework"?
-
I was reading about the js-test-driver unit-testing framework, when I found out that the guys behind the framework intend it to be http://code.google.com/p/js-test-driver/wiki/XUnitCompatibility. What is an assertion framework? Is it a kind of unit-testing framework? If it is the case what is specific to such frameworks?
-
Answer:
An example of an Assertion Framework would be http://code.google.com/p/hamcrest/ which was integrated into JUnit 4. Hamcrest does not run tests, it merely provides an expressive way to write assertions. Old JUnit style equality assertion: assertEquals(constant, underTest); // or for doubles assertEquals(3.5, underTest, .001); // within 1/1000th Hamcrest style equality assertions: assertThat(underTest, Is.EqualTo(constant)); // or for doubles assertThat(underTest, Is.EqualTo(3.5).Within(.001)); Essentially, an assertion framework allows you to perform your assertions in an easily extensible manner. Because the assertion framework focuses on assertions alone, it can do the job much better than a tool that has to collect and run tests as well. NUnit has also adopted the Hamcrest approach to assertions. You would not use Hamcrest to run your tests, merely to write the assertions.
Eldros at Programmers Visit the source
Other answers
JsTestDriver is primarily concerned with providing a test-runner, i.e. the way that you execute the tests. It provides a built in assertion framework, which is xUnit in style. This is used to actually write the tests (e.g. assertTrue, assertEquals, etc). However, it also allows you to plugin in alternative assertion frameworks. There are currently plugins available for Unit and Jasmine, which offers BDD style assertions.
rlayte
Related Q & A:
- What do you code first to learn a new language, library, or framework?Best solution by Programmers
- What framework must I use to develop mobile native application?Best solution by Stack Overflow
- What is the best Unit testing framework for iPhone?Best solution by quora.com
- What are different types of Entities in Entity Framework?Best solution by entityframeworktutorial.net
- How to encrypt the SAML Assertion?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.