assertions

How to assert link href value using Zend_Test without an DOMXPath error

Hi, What is the best way to verify that a link with a specific url and content exists on a tested page? I'm using Zend_Test and the following simplified example works fine until there is a dot (".") in the url, which obviously can happen very often... This is OK: $this->assertQueryContentContains('a[href="/index"]', 'Home'); Now if...

Getting access to assertion methods from a Shoulda should method

I have a shoulda macro/method that tests controller responses for XPath conditions like so: def self.should_have_xpath(path, &block) should "have an element matching the path: #{path}" do xml = REXML::Document.new @response.body match = XPath.match(xml, path) if block_given? yield match else assert match.si...

How can I turn off ASSERT( x ) in C++?

I suspect some ASSERTION code is having side effects. I'd like to switch off ASSERT without making any other changes to how my code is compiled. I'm using MSVS2008. Switching from debug to release won't do as that will alter how memory is initialised. ...

assert conditions in eclipse

hello I've write a junit test with eclipse , to check the Gui component status ,I use assert : textfield.assert("expected message") i'm searching how to get the error message printed by assert the message saying that the expected text doesn't match th typed text is printed in the eclipse console I like to get this message to generate a...

popToViewController raises "Assertion failure" message, how to solve it?

In CoreData, I have the data graph with some entities, and each object is populated in a view controller, at a defined screen, I want to pop out some (>1) objects to return to a define screen. I tried to pop the view controllers out of the navigation stack with these lines of code: ObjectA *objectA = objectD.objectC.objectA; NSLog(@"ob...

what is the difference between triggers, assertions and checks (in database)

Can anybody explain (or suggest a site or paper) the exact difference between triggers, assertions and checks, and also describe where I should use them? EDIT: I mean in database, not in any other system or language. ...

Debug assertion does not prompt in IIS 7

Hi, since moving to Windows 7 (IIS 7.5), the debug assertions do not prompt a pop up dialog anymore. I have tested this in a separate project, and noticed that they do work when using the integrated Visual Studio Developer server (Cassini) but they do not work when using IIS Web Server. This is a big issue for us since we are counting ...

Grails Unit Tests: Why does this statement fail?

I've developed in Java in the past, and now I'm trying to learn Grails/Groovy using this slightly dated tutorial. import grails.test.* class DateTagLibTests extends TagLibUnitTestCase { def dateTagLib protected void setUp() { super.setUp() dateTagLib = new DateTagLib() } protected void tearDown() { ...

Can we use assertion for testing purpose in web application ? Give example also.

Since we can easily disable and enable assertion as per our requirement. So I want to use assertion in struts action class for unit testing. Pls provide example also. ...

Which are Java's system classes?

When reading some documentation about assertions, I found: java -ea -dsa "Enables assertions in general, but disables assertions in system classes." Which are the system classes? ...

How to regex match a string of alnums and hyphens, but which doesn't begin or end with a hyphen?

I have some code validating a string of 1 to 32 characters, which may contain only alpha-numerics and hyphens ('-') but may not begin or end with a hyphen. I'm using PCRE regular expressions & PHP (albeit the PHP part is not really important in this case). Right now the pseudo-code looks like this: if (match("/^[\p{L}0-9][\p{L}0-9-]{...

The "is" in JUnit 4 assertions

Is there any semantic difference between writing assertThat(object1, is(equalTo(object2))); and writing assertThat(object1, equalTo(object2))); ? If not, I would prefer the first version, because it reads better. Are there any other considerations here? ...

what "Debug Assertion Failed" mean and how to fix it, c++?

hi, why this program gives me a "Debug Assertion Failed" Error Message while running #include "stdafx.h" #include "iostream" #include "fstream" #include "string" using namespace std; int conv_ch(char b) { int f; f=b; b=b+0; switch(b) { case 48: f=0; break; case 49: f=1; break;...

Assertion in Java?

What is the assert keyword in Java? Please tell me some real life examples to understand the key role of assertions? ...

Writing fortran robust and "modern" code

In some scientific environments, you often cannot go without FORTRAN as most of the developers only know that idiom, and there is lot of legacy code and related experience. And frankly, there are not many other cross-platform options for high performance programming ( C++ would do the task, but the syntax, zero-starting arrays, and point...

use of assertions for type checking in php?

I do some checking of arguments in my classes in php using exception-throwing functions. I have functions that do a basic check ( ===, in_array etc ) and throw an exception on false. So I can do assertNumeric($argument, "\$argument is not numeric."); instead of if ( ! is_numeric($argument) ) { throw new Exception("\$argument is not ...

assert vs. JUnit Assertions

Today I saw a JUnit test case with a java assertion instead of the JUnit assertions - What are the best practices in this respect? ...

Python - Why the use of assert(required_param)?

I found this today while looking at a library for an API . def my_function(self, required_param=None): assert(required_param) ... Do cool function stuff Wouldn't it be easier to do this: def my_function(self, required_param): ... Do cool function stuff Or, am I missing something? The assert() of course gives you one un...

How do I get NSAssert to either crash the application or at least bring up an error dialog?

Hi, I use asserts quite a bit in my code since they are useful in debugging, but the standard behaviour of Cocoa applications is to interrupt processing and logging the assertion failure to the console.. the UI stays up neither crashing, nor bringing up an error dialog and it's often not obvious what has happened. What's the easiest wa...

Java/ JUnit - AssertTrue vs AssertFalse

Hello all, I'm pretty new to Java and am following the Eclipse Total Beginner's Tutorials. They are all very helpful, but in Lesson 12, he uses assertTrue for one test case and assertFalse for another. Here's the code: // Check the book out to p1 (Thomas) // Check to see that the book was successfully checked out to p1 (Thomas) assertT...