Is anyone using CSE with a code test framework

For topics about current BETA or future releases, including feature requests.
Post Reply
User avatar
MikeGale
Rank VI - Professional
Posts: 726
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Is anyone using CSE with a code test framework

Post 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?
arneevertsson
Rank 0 - Newcomer
Posts: 5
Joined: Mon Apr 10, 2006 10:56 am

Post 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.
User avatar
MikeGale
Rank VI - Professional
Posts: 726
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Post 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#:
[DllImport("csevalidatorV70.dll")]
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.
arneevertsson
Rank 0 - Newcomer
Posts: 5
Joined: Mon Apr 10, 2006 10:56 am

Post 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.
User avatar
MikeGale
Rank VI - Professional
Posts: 726
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Post 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!!
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post 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:
http://www.htmlvalidator.com/firefoxext.php

Also, here's a useful Firefox Web Developer extension as well:
http://chrispederick.com/work/webdeveloper/
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply