mercredi 20 janvier 2016

How can I use javac to cross compile my old tests to be compatible with java 8?

I work for a company that is currently developing a server software and it is my job to run automated tests for this software. The newest version of the server is built using Java 8, and this is causing problems because our old testing framework is made to accommodate Java 7. We use the TestNG plugin for java to run all our tests, but as far as I can tell, every single version of TestNG is compiled with java 7, so if I compile the tests with java 8, the plugin will throw a major.minor unsupported 52.0 error if I try to run them with the plugin. On the other hand, compiling the tests with Java 7 causes the same error to occur when the tests try to send requests to the server.

How can I cross-compile these tests so that they work with both TestNG and the server? The interaction works like: TestNG calls the tests, and then the tests call the server.

I've read up on this a little and I think I need something like:

javac -source 1.7 -target 1.8 projectName

Is this a viable approach?

Aucun commentaire:

Enregistrer un commentaire