Eclipse + Selenium + TestNG - Continuous Integration - **No** Ant, Maven, Etc - java

I'm looking at setting up a continuous integration server for running selenium and testng unit tests.
I know you can do so by using maven or ant, but I don't want to add a 2nd build system into our project. I've read all about it, another team here is using maven, but I'm trying as hard as I can to avoid it. (Would appreciate not turning this into an Ant or Maven debate.)
From what I've read, if I was using Intellij their TeamCity product could do this no problem from the project config files - but we're not (unfortunately, I'd love to), we're using Eclipse. If we were using Netbeans, apparently everything is already stored as an Ant project so that wouldn't be a problem.
Curious if anyone has had any success setting up a continuous integration server with an Eclipse project, without adding in another build tool to the project. We can do this without a problem on a developers local machine, seems like it shouldn't be to hard to do for an integration server...
Edit: I found another stack overflow topic on how to run the eclipse build from the command line -
Build Eclipse Java Project from Command Line
"eclipsec.exe -noSplash -data "D:\Source\MyProject\workspace" -application org.eclipse.jdt.apt.core.aptBuild"
I tried it out, and manually copying over the results into Tomcat definitely works (though you end up copying .class files rather than a .jar file). Most of the continuous integration products say they can use any command line tool to do the build.
Still wondering if anyone has done it before though...

Related

Clean and build java project without eclipse GUI using another java program

I am writing a program that needs to run JUnit tests that are located in an external project. That external project needs to be cleaned and built to ensure that the JUnit tests are run correctly. I can't require the user to go in and clean and build manually, so I need to automate this process. It needs to be done inside of a java program.
I was thinking I could possibly use ant, but then I would have to potentially call an external shell script to clean and build the project. I would prefer to do it all in one project, but if ant is the only way to go, please let me know.
I can't require the user to check the build automatically option in eclipse, because the projects we work with are really big and take a lot of time to build.
How do I automate the eclipse process of cleaning and building a project in java?
Since I am running the project using gradle, I was able to figure out and automate the process of cleaning and building with gradle by only requiring the user to run another project rather than use eclipse.

Appium Maven tests with Travis CI tool

I am kind of struggling with transitioning from Jenkins to Travis-CI. Running an Appium (or consider it Selenium) project that is built using Maven. I am not sure what really should go into the travis.yml file. From what I have been told I need to do a before_install, before_script, and script, and after (after not sure). Could someone please be nice of kind enough to paste a travis.yml that was created for Java Maven project.
Also not sure I will get the test running on a physical device for a tool that is hosted on the Cloud. For Jenkins all we would do is hook up the device to the master/slave.

Publish for tomcat:run on Maven

I am considering using Maven 3 for my Spring projects which I have been developing using Eclipse and Tomcat. Until now;
I have been disabling "Republish automatically" because sometimes I don't need publish, I only save .java files (classes) and keep development on debug mode.
I republish (by clicking Eclipse's "publish" button on Servers view) only when I changed js, jsp or htm-like files, not class files, so I can keep developing without restarting Tomcat.
Now I am going to use Maven for debug/run on development but whenever I changed my code, I don't know how to do this "publish" issues on Maven as it doesn't use Eclipse's Tomcat directly. I stop maven and start again. Do I have to do this for all changes on my code? How can I make this maven -tomcat:run- "publish/republish" for js/jsp/html files and "do nothing" for .java files?
Unfortunately, yes, you'll have to run maven for every change.
Maven't isn't really intended to be used this way - it assumes that you're going to use maven when you're ready to build (ie after development), but use something like Eclipse if you're trying to see your changes in real time. It has no mechanism for listening for changes.
For my webapps I use both maven and Eclipse, with the m2e and the 'Maven Integration for Eclipse WTP' plugins. With that setup I can see my changes in real time using an embedded Tomcat instance in Eclipse, and when I'm done, I use maven to build.
Give those two plugins a shot - I think it'll meet your needs.
I had the same problem. And it happens because I ran maven eclipse:eclipse. Then, Server stop publishing (click on publish and said it was synchronized). I downloaded again .classpath and .project and other innerit files of eclipse project structure from cvs and server starts publishing again. May be this could help.
Regards,
For the benefit of Googlers:
I was getting NoClassDefFound errors using tomcat:run to start the app.
It took some googling but the following post notes that using tomcat:run-war enables your dependencies to get picked up from the WAR:
http://www.hascode.com/2010/06/java-server-facesjsf-2-tutorial-step-1-project-setup-maven-and-the-first-facelet/
However, for debugging and hot code replace, it's simplest to run Tomcat from the Servers view in Eclipse.

Most effective way to go from Eclipse Project to Hudson Build

We want to use Hudson/Jenkins to build our project which is currently realized entirely in Eclipse. From what I can tell, there are various ways to go from A to B, or E to H, as it were: export as Ant script, export as Maven script, export as Runnable JAR while creating an Ant script for that, etc.
All of the above seem to have in common that between "This runs in Eclipse" and "Hudson produces something that runs" there are multiple steps which are independent, for example, you can change your project, commit to SVN and trigger a Hudson build, but unless you specifically remember to "Export as Ant Script" in between, it will fail.
Is there a "one in all" solution ? I'm not worried about the amount of clicks, but instead about the various steps in between that, to make matters worse, are only needed sometimes. In short: I am looking for something that goes from "I can click on the 'Run' button and it works" to "Hudson produces something that works" without every developer having to remember every optional step in between.
Ideas ?
Edit: All of the answers so far seem to suffer from the same issue: it's all parallel development. You have your Eclipse Run Configuration, and you have Maven/Ant/Whatever build. If you change your run config, you have to then remember later to change your Maven/Ant/Whatever build, commit it, and then HOPE that all other developers notice the change to the Maven/Ant/Whatever build during their daily SVN Update, manually open the file, inspect the changes and then duplicate those changes in their own run configs. That seems like it's just begging for bugs and mistakes, isn't there anything that's properly integrated with the Eclipse Run Configurations ?
Hudson can build Maven or Ant projects, so the first step is to get a reproducible build with either tool, which you only need to set up one time. Then you need to take that pom.xml or build.xml file and actually commit it to Subversion. This is necessary since Hudson won't open Eclipse and will instead use the command-line to execute a build.
Then you can setup a new Hudson job that will watch Subversion for any changes. Your developers can use their normal workflow, where they use Eclipse to do builds and commit changes to source control when they're ready. Hudson will see it and pull down a fresh copy of the code base, and then will do its own compile and will report back any problems.
Personally I prefer Maven2, since I know Hudson has solid integration with it and will do things like run your JUnit tests. Eclipse used to be painful with Maven, but now there's the m2eclipse plugin.
I'd try http://www.ant4eclipse.org/.
It allows you to build your eclipse project from an ant file. From the first paragraph here: http://www.ant4eclipse.org/node/6 it sounds very much like what you want. With ant4eclipse ant will access your eclipse project and then it should be able to build through Hudson.
The aim of the ant4eclipse project is to avoid (or at least: to reduce) the redundancy of Eclipse and Ant configurations. More precisly: it consists of Ant tasks that are able to read and work with some of Eclipse's configuration files.
Migrating to Maven, Hudson has great first class intergration with Maven.
Maven 3 + Archiva makes a very potent build system. Of course there are other Repository Managers but Archiva does just enough for what I need.
Once you get Maven, you really wonder how you did without it up until then. A dedicated private Repository Manager helps this greatly, that is why Archiva is important to the mix.

Measuring integration test coverage with Maven

The followings are ok now:
I have a multi-module project in maven with EJB and WAR projects
I want to use JMeter (and later selenium) for integration testing. I can run both from Maven. The JMeter plan is ready, I run it with Chronos maven plugin.
My application is a Java EE application, so I want to test the code with the planned production aplication server, which is Glassfish 2.11. I can create/start/deploy/stop and anything like that with glassfish maven plugin
I have put jmeter and glassfish related build settings into a submodule in maven, which is dependent on all of the other modules, so in build lifecycle it is the least, and for this reason a good point to test the whole application
My problem is, that how can I reach the followings:
deploy NOT instrumented code, but run integration tests on instrumented one
how to get coverage info from application server
I wanted to use emma4it which was created to instrument artifacts. It would be good for me, but i cannot make it instrument the war file in the other submodule. I do not even know anything about the supported arguments of emma4it, since I did not find it at all (just a binary in repository), no documentation and no source (I know I can decompile it)
I want to have a coverage raport at least in maven site, but the top would be to have it in Sonar
Could you give me advice, how to do this? I can provide POM snippets if you need it.
FINALLY. The solution arrived. See at http://www.sonarsource.org/measure-code-coverage-by-integration-tests-with-sonar/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+Sonar+(Sonar)&utm_content=Google+Reader
I currently try to do it.

Categories

Resources