We are planning to automate the build system using Hudson. We are new to Hudson or it would be better to say this way that we are new to build automation process. Our application is on Java platform and the database is on MS SQL. This (automation) milestone is break down into different goals. The first step which we have is to automate database changes (DDL/DML) and during updating database if anything goes wrong it should be able to roll back the changes and send an e-mail to a group to notify the failure (with reasons). Otherwise, if succeed then allow to move on to the next step which is make the build and deploy with LiveRebel.
I think we should have a centric mechanism on build failure on any instance if a build fail it should be able roll back changes what it would have had done. For instance, if database changes failed as I said it should notified and don't proceed further. And, if database succeed and build making process failed (e.g because of Unit Tests) it should be able to roll-back the database changes. If notification can have failure details (like exception details with person responsible for this) it would be very helpful to diagnose and inquire appropriately. How can (should) I do this?
We are also interested to use LiquidBase with Hudson.
I would like to ask for your opinion and suggestions how should I plan this and what should be a good way to achieve this.
First of all you shouldn't mix up building and deploying. The database update would be part of your deploy process, not of your build process. Even if using continuous integration this should be kept separate. This means you do your database changes after the project was build and all your JUnit tests were run. If it fails before that it shouldn't perform the changes, so there would be no need for rollback.
As for your actual problem: I don't know any plugin that does what you want to do. In Hudson/Jenkins you always have the possibility to execute a batch/shell script. Write a script that performs your changes. The build should fail if your script exits with an error return code.
For sending notifications on build failure there are various plugins, including E-Mail.
Related
Sometimes, I want to be away from keyboard for a while and before I go away I start my maven build, hoping that I can come back to see that the build has been successful.
But sometimes I come back and it says "build failed" then I build my project again and get "build successful", there are various reasons for this, maybe your antivirus was running and blocking access to a certain folder at the time of build or something like that.
Is it possible to make maven retry build command until you get "build successful"?
You can write your own script to launch the command for the build process but there are some considerations to do before doing it:
Does it makes sense to expect that a failed build may succed without a code modification?
How frequent the retry should be? If it is too much than you can potentially cause problems on the machine that you are running the script.
If you expect that 1) is possible than for 2) you can implement a non linear pollicy; for instance you can use exponential retry; similar to the policy done in Spring for the annotation #Retryable.
I'm pretty new to TestNG hailing from a cucumber background.
In my current project, the jenkins jobs are configured with Maven and TestNG, using java and Selenium for the scripting.
Any job, say with 30 tests, if takes 2hrs to complete, when abruptly terminated due to some reason on the last minute, I do not get results of any tests that were run successfully. Hence forced to run again the entire job.
All I see is the error stack trace and result as:
Results :Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
I am sure there is a better way of designing this, hoping for better approaches.
How can I make sure I do not lose results of the tests that did run successfully(though passed/failed)?
Is a test management tool or some entity to store the run time results , a mandatory requirement or TestNG has some provision built-in?
How can I make sure I do not lose results of the tests that did run successfully(though passed/failed)?
There are usually two ways in which you can build reporting into your TestNG driven tests.
Batched mode - This is usually how all the TestNG reports are built. A listener which implements org.testng.IReporter interface is built and within its generateReport(), all the logic of consolidating the test results into a report is carried out.
Realtime mode - This is usually done by implementing the TestNG listener org.testng.IInvokedMethodListener and then within its afterInvocation() do the following :
Check the type of the incoming org.testng.IInvokedMethod (to see if its a configuration method (or) a #Test method ) and handle these types of methods differently (if the report needs to show them separately). Then test the status of org.testng.ITestResult and based on the status, show them as PASS/FAIL/SKIPPED
IReporter implementations are run at the end after all the tests have run (which is why i call them as batched mode). So if something crashes towards the end but before the reporting phase is executed, you lose all execution data.
So you might want to try and build a realtime reporting model. You can take a look at the RuntimeReporter report that SeLion uses. Its built on the realtime model.
Is a test management tool or some entity to store the run time results , a mandatory requirement or TestNG has some provision built-in?
There are no such mandatory requirements that TestNG places. As I explained above, it all boils down to how you are constructing your reports. If you are constructing the reports in a realtime fashion (you can leverage templating engines such as Velocity/Freemarker/Thymeleaf) to build your reporting template and then use the IInvokedMethodListener to inject values into the template, so that it can be rendered easily.
Read more here for a comparison on the templating engines so that you can choose what fits your need.
We're working on an app where we share the UI developments with another team while "hiding" the server code from them. They'd get daily builds and deploy their server with these jars.
What's happening is:
Early in the morning, there is a build
Update their jars
They get the jars and deploy their to start their server
What would happen (and shouldn't) is that the build fails in the morning and they don't get their update. We'll have to fix it, rebuild everything and update them which can get frustrating for both teams.
Even if this didn't happen, it's still a drag to wait until the next day to get all modifications.
My question is : is there any possibility to update them constantly without having to install the servers locally on their machines and let them get svn updates?
Note: I'm not the one handeling deployement so I might have missed some points.
Our build takes a long time, even when nothing has changed. When I run mvn appengine:set_default_version it does a full build, which takes a few minutes.
Is there an easier way to call set_default_version, bypassing the build?
As requested by #Alex :)
I do believe you could build a custom flow to just to call set version. But seems like a complete overkill.
Since you should be changing the default version every once in a while and not on every build (I hope), would't the UI on the cloud Console suffice? You just go to Compute > App Engine > versions and setup the default.
Be advised some people reported issues with the new UI where default version was not changed, so if that fails you might need to use the old app engine console.
i am trying to automate manual testing of modules in my project. We are dealing with IBM Websphere Message queue software. We have a trigger component written in core java which when executed polls for availability of message in the configured queue. Its an indefinite while loop that keeps the trigger component running. I have written test cases in JUnit to put message in the queue and now will i be able to start/stop the trigger component on demand? Invoking the trigger component keeps it running and i am not getting the control back to check the expected output. If i start it in thread then the log files to which the trigger component is supposed to update when processing the message is not getting updated. How can i resolve this situation.
Your suggestion and directions is highly appreciated.
Thanks,
-Vijay
I would look at moving your manual build to a scripted build using something like Apache Ant and using the junit support, see http://ant.apache.org/manual/Tasks/junit.html.
Once you have your tests which you can run via Ant, you can integrate into a continuous integration container like Hudson (hudson-ci.org) and get it to schedule a build run on a timer. You can also schedule to run on a code check-in.
For more on continuous integration take a look at Martin Fowler's article, http://martinfowler.com/articles/continuousIntegration.html.