Why exactly did you choose MAVEN for your selenium project - java

I was wondering what could be the good answer to "Why was the need to use Maven and Not Jenkins or other framework"
This is with respect to an automation project created in selenium and testNG with Maven framework

There are a couple of fundamental and functional difference between the usability of Maven and Jenkins
Maven :
Apache Maven popularly known as Maven is a Software Project Management tool. Based on the concept of a Project Object Model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information dynamically which is configured through a file pom.xml.
From Selenium Framework perspective, Maven enables you to to get rid of the manual configuration of Selenium JARS and WebDrivers. You can easily switch over from one version of the underlying software to another through a simple update in pom.xml.
Jenkins :
Jenkins is a popular tool for Continous Integration (CI) which can be used as a simple CI server or turned into the continuous delivery hub for any project. Jenkins being a self-contained Java-based Program is always ready to run out-of-the-box with packages for Windows, Mac OSX and other Unix-like operating systems. Jenkins can be easily configured through its web interface to integrate on-the-fly check-ins and built-in help.
From Selenium Test Automation perspective, through Jenkins you would be able to schedule the Test Execution whenever you require and as many times you may require.

Related

Trigger selenium-java test scripts after TFS build

I have a maven project in Jenkins (which is a selenium- java project), web-Developers use TFS , I want to execute my selenium tests as soon as developers push their code change to TFS.
If you are using the TFS2015 or later, to execute Java Maven Project in TFS with vNext build system, you can refer to this link for detailed steps: Build your Java app with Maven.
If you want to build in Jenkins and just use TFS as the Version Control System, you can refer to this article to know How to integrate Selenium C# .NET test automation codes with Jenkins.
Below articles also for your reference:
Create and run a Maven build on Visual Studio Team Services
Getting Started with Selenium Testing in a Continuous Integration
Pipeline with Visual Studio

Projects which are accessed via multiple (different) IDEs: Ant or Maven?

Is it true that one of the real benefits of Maven is that its projects structure is clearly defined and therefore it can be opened in any IDE that supports Maven?
We develop in a team consisting of 5 people and we use three different IDEs (IntelliJ, Eclipse, Netbeans). I know that I cannot open an Ant project of Eclipse in Netbeans but with Maven this is possible.
Is this really reason enough to use Maven?
Maven and Ant are two different things.
Ant is a build tool while Maven accumulates the functionality of:
resolving dependencies (you only specify the dependencies, and Maven cares about downloading them in the correct version from the default repositories on the i-net, or the ones you specified explicitly)
a build tool (incorporating Ant),
creating distribution artifacts (containing not only the jar/war/etc. file of the project but also dependencies, resources, documentation),
runtime environment (e.g. starting Jetty and deploying your artifact)
unit testing
integration testing
deployment (including signing, incrementing the version, deploying the artifacts etc.)
and more (look out for plugins on i-net)
Maven uses lifecycles to achieve this. You can trigger certain functionality at certain points in the lifecycle. For example unit tests should be run right after compiling while integration tests (e.g. selenium tests) require more setup, maybe initializing a web server and deploying the WAR file.

Why do I need Maven if I use Eclipse?

I have seen that if I right click on a project in Eclipse and choose to run it on a server, then I can see output which means the project is running.
If everything is working fine without Maven, what's the point of using it. How is it different than simply running it via eclipse?
Maven is a build tool (build manager, in fact), similar to ANT. The main job of any build tool is configure the project, compile using required projects and do the final packaging. A build script in your project gives a blue-print of project's deliverable structure. This frees you from any configurable dependencies on specific IDE like Eclipse. All you need to know is the standard command to perform the build and you can build your code almost anywhere.
Now, back to your question, why wouldn't do it in Eclipse?
For a simple project and small team Maven is an overkill. You can easily communicate the configuration, IDE to use, and instruct any special steps to be taken. In big projects, however, there exits lots of loosely coupled dependencies. To start with, there will be different settings for developer machine build, test build and production build. There are requirements to run automated test, integration tests, store the build package (artifact) to a commonly accessible repository, update versions of various modules.
Obviously, if all the steps mentioned above is done manually there are chances of missing a step. Moreover, the manual process is time consuming.
Ideally, you should prefer a tool which fits the best for you. If you think that you're able to achieve what you required without Maven, it makes sense to not to use Maven/build-tool just because everyone uses it.
It is suggested to study automated deployment, this will give you bigger picture on what all the stuffs that you can do with build tools. And if you do not feel that it adds any value to your current process, you probably don't need Maven or any other build tool right now.
Your question does not make much sense. Do you expect your users to access your application from eclipse? If so that is a very strange set up in my opinion.
Perhaps your question should be about how to build your project. Maven provides you a way to centralize dependency libraries across the enterprise. It lets you automate your build process (most likely in conjunction with a CI server like hudson, cruise control, etc). It lets you automate your unit testing. Maven makes the packaging of app very easy to do. A developer does not have to follow arcane set of steps to package an application. You add the right plugin and maven takes care of it as part of the build life cycle. All of this magic can happen because of the principle of convention over configuration. There are many more benefits, I just named a few.
Maven is not replacing how you run the app, rather how you package the app, automate that process, and manage the dependencies of your app.
Some links on why someone should use maven:-
Why maven ? What are the benefits?
why I use Maven
Why you should use Maven
Use Maven

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.

How to setup a sophisticated java development infrastructure?

I'm looking for a complete java development infrastructure with an integration of:
an IDE like eclipse,
a build system like Maven,
a version control system like subversion,
a continuous integration server like Hudson,
a repository manager like Nexus,
an automated release plugin like Maven Release Plugin.
Further I'd like to have:
a predefined multi component project structure
...and optionally:
an issue manager like Jira,
an integration with an open source hoster like sourceforge.
Evaluating all these systems could take a long time, making the setup of a running infrastructure a job of a month or longer.
At work I'm ready to setup each system individually, but for my private development at home I'd like to have something like Devware - A development environment virtual appliance (unfortunately I didn't find a download link) where everything is already installed and functional.
So, could you please give me some advice which combinations create a working infrastructure? Or even better where to find a preconfigured development infrastructure?
PS: I'm not committed to any of the named products, so feel free to suggest alternatives if they match better.
If you're looking to avoid some integration pains, check out SecureCI, which is a free download of various open-source products in an integrated stack.
Blurb from the site:
SecureCIā„¢ provides organizations with an integrated suite of open source tools that assist in the automation of the software build, test, and deploy process. By integrating secure code analysis and web security testing technologies, SecureCI extends continuous integration to incorporate automated security analysis and security testing of applications as well.
The current version bundles these tools:
Project Management
Trac (0.11.5)
Sonar (1.10.1)
Security Scanning
ratproxy (1.58)
Development
Subversion (1.4.6)
Hudson (1.322)
Apache Ant (1.7.1)
Apache Maven (2.2.1)
Sonatype Nexus (1.3.6)
Testing
JUnit (4.6)
Cobertura (1.9.2)
Selenium Remote Control (1.0.1)
Code Analysis
Checkstyle (5.0)
FindBugs (1.3.8)
PMD (4.2.5)
JDepend (2.9)
As far as IDE integrations are concerned, later versions of Eclipse now come integrated with Mylyn, this provides a task focused API for connecting to various tools.
The Trac integration can be installed with the Connector Install Wizard.
Other Eclipse integrations to use:
Subversion integration: Subclipse and the Subclipse Mylyn integration)
Hudson plugin
Maven integration: M2Eclipse (also has some Mylyn connectors)
Code Coverage: ECLEmma (I find the Cobertura plugin doesn't work too well myself)
Selenium plugin
Checkstyle plugin
Findbugs plugin
PMD plugin
JDepend plugin or CAP
Or just use IntelliJ from JetBrains.
You might want to look into http://www.poweredbypulse.com. It provides easy to install pre-configured Eclipse instances. You can also build/configure your own.
It has been a while since I actually used this so it may have changed since then.

Categories

Resources