Automatically detect units

I have a web tool that, when requested, returns the generated Java classes based on the arguments in the URL.

The classes we retrieve from the web server change daily, and we need to make sure that they can still handle known inputs.

Please note that these classes do not test the web server, they run locally and convert xml to a custom format. I am not testing a web server.

Then these classes should be placed in a specific package structure, compiled and run with a known set of input data and compared with known output data.

I would like to do this automatically every night to make sure that the generated classes are correct.

What is the best way to achieve this?

In particular, what is the best way:

  • get the code from the web server and put it in a file
  • compile the code and then call it

I am sure that a combination of junit and ant can achieve this, but is there a standard solution / approach for this?

+5
source share
4 answers

First of all, to answer your question: No, I do not think that there is a standard approach for this. That sounds pretty unusual :-)

Given what I would do is write my JUnit tests to call the class GeneratedCode, and then as soon as you load the code, rename the class to GeneratedCode, compile and run your unit tests.

+2
source

You have the same goal as continuous integration; -)

, , -, - .

. hudson.

+2

"" -, () () .

- , , .

0

webservice? ?

One idea, if the generated code is not complicated, is to download it through GroovyClassLoader and run your tests against it. See this page for an example .

0
source

All Articles