Page 1 of 1

Is anyone using CSE with a code test framework

Posted: Tue Jun 07, 2005 5:31 pm
by MikeGale
To me CSE is part of a bigger process that might involve unit and integration tests. (MBUnit or NUnit etc.)

Are any people here integrating CSE output into their testing? (This will often not be unit testing but more like integration testing.)

If so how are you doing it? How could it be improved?

Posted: Thu Apr 13, 2006 10:25 am
by arneevertsson
I'm not doing it, but wish I could. In a Java environment I suppose an Ant task would be the most appropriate way of doing it.

Even better, though, would be a IntelliJ/Ecplise plugin, that would put you right on the code line where the erronoeus html is produced.

I haven't really looked around, but there are perhaps Ant-able validators around.

Posted: Thu Apr 13, 2006 5:14 pm
by MikeGale
I don't know the Java way of using non-COM DLL's but that's one approach.

Another is to invoke the program, persist analysis to file and read that.

I currently have something that seems stable in .NET. It's part machine generated translation. I've eliminated the dependencies on two COM components. (They worked great but didn't seem like a good long term implementation.)

If you have an example of the Java way of doing what I call P/Invoke using DllImport, post it. I'll have a look and see how it corresponds to my code. If it's close the .NET might be translatable. (The marshalling may be different but with luck that won't impact the code too much.)

The .NET code in VB.NET looks like this:
<DllImport("csevalidatorV70.dll")> Public Shared Function CSEFreeHandle(ByVal handle As Integer, ByVal flags As Integer) As Integer
End Function

in C#:
public static extern int CSEFreeHandle(int handle, int flags);

(The <...> ([...]) bits are attributes, in the namespace System.Runtime.InteropServices, not sure what Java might use.)

If it looks sensible I'll try to help.

Posted: Fri Apr 14, 2006 4:51 am
by arneevertsson
>Another is to invoke the program, persist analysis to file and read that.

This would probably be the easiest path.

I'm not going to put all this into practice right now, but I have at least thought about it a little. In my current project I would like to add unit testing from a http perspective. And when I do that, it would be natural to add html validation as part of it. When you test a web app, many pages will only be produced as part of a flow, with user input and so on. That is why the validation needs to be part of this kind of unit testing.

You would probably have your current page as a Java String object. Then, I guess, it could be written to a file, the validator invoked, and the result parsed. The test would fail if at least one validation error occurred. Something like that.

Posted: Fri Apr 14, 2006 2:15 pm
by MikeGale
That sort of testing (technically it's probably not unit testing) can be done fairly easily with the right framework.

There are tools out there that enable some fairly sophisticated scenarios. Like navigating to a page with logon, entering data, checking response screen...

I've used this technique. The setup time (as usual) is annoying but after that it just happens every time.

Can save days of work!!

Posted: Fri Apr 14, 2006 2:44 pm
by Albert Wiersch
We have a Firefox extension that can check pages as you browse the web in Firefox. This lets you log in, goto forms, enter data, get results, etc. while letting you easily check all the pages.

More info:

Also, here's a useful Firefox Web Developer extension as well: