Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

My team deploys code to production every week or so. We have a large set of post-deployment validations, e.g.:

  • New log lines are appended to Tomcat log (ssh to machine, tail -f the log)
  • Database table has more than 100 new rows in a minute (ssh to machine, run some sql commands)
  • A GET call with a given parameter returns the right value (browser or wget)

The tests are done manually, and takes 2-4 agonizing hours.

Since we have a Jenkins CI system, I would like to automate these tests to small units which produce JUnit XMLS which can be analyzed by the Jenkins web UI.

Is there a test suite capable of easily ssh-ing servers with JUnit output?

share|improve this question
3  
You're looking for something that wraps it all? I mean, there's open source SSH libraries you could use, and you could use them inside a JUnit test. –  corsiKa Jun 26 '13 at 15:25
    
I can build my own framework, but I'd rather use a ready-made, all-included open source solution. –  Adam Matan Jun 27 '13 at 7:06

2 Answers 2

up vote 3 down vote accepted
  1. Use JUnit to handle the running of the tests from the Jenkins server.
  2. Use JDBC to query the DB for new rows.
  3. Change up the Tomcat servers so they send logging events back to the Jenkins serverJUnit test. You'll need to write a little socket listener for the JUnit test to gather the Tomcat events (Writing an LoggingEvent listener isn't hard. I'm not brilliant coder and I got the event listener with Observer-Observables working in less than a day.)
  4. Java has tons of http(s) GET/POST capabilities so wget shouldn't be hard to implement either.

I don't know of a testing framework that will let you abstract away all the boilerplate code of building JDBC connections, SSH output, etc. Maybe Spring does that kind of abstraction.

Have you looked at JBehave? It's an acceptance testing framework that sits on top of JUnit.

share|improve this answer
    
+1 for listing simple and doable solutions for each aspect. Just one question. How JBehave is going to help here? –  dzieciou Sep 12 '13 at 20:16
    
And... I was completely surprised Spring can be used for something else than just Inversion of Control (IoC). Thanks for opening my eyes on that :-) –  dzieciou Sep 12 '13 at 20:17
    
Spring is incredibly powerful because it allows you to wrap a ton of boilerplate code into a few snippets. Oh, and it does IoC too :) –  Green Sep 13 '13 at 13:58
    
JBehave is an acceptance testing framework. The distinction is that acceptance testing is the kind of testing you do after all the parts are put together; after the final product has been created. The degree of granularity from least to greatest is unit testing, integration testing then acceptance testing. JUnit addresses unit testing. Don't know of a product that handles integration testing specifically (though there probably is one) and JBehave is focused on acceptance testing. –  Green Sep 13 '13 at 14:01

Using the Jenkins server is a great idea. You just need to create Maven projects that run basic JUnit or TestNG tests. The JUnit or TestNG tests should accomplish your tasks and provide assertions. At least, that is how I would do it. You just use the post-build action in Jenkins to find your JUnit output .xml files (requires a special plugin to do that).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.