We are starting on a web application and thinking of TDD development. Can anyone please provide me a list of open source tools to automate our testing.
Thanks in advance
Kaushik
First and the most important: Jenkins Continuous Integration Server (or a CI server from some other vendor).
You can also take a look at a list of CI servers in comparison.
There are also many other tools that ease the process of development using TDD such as:
Obviously Unit test frameworks (JUnit, TestNG)
Mocking frameworks (EasyMock, Mockito, PowerMock)
Also, don't forget Maven for building, Selenium for automating web app testing and JMeter for load testing.
Cheers,
Take a look at cucumber for BDD, it integrates with Jenkins and might help you with your acceptance tests.
Related
I used to test an application using VS & NUnit and NUnit provided this interface which had all my tests listed under each browser. I had a selenium grid setup to run different browsers.
Nunit allowed me to run single test in individual browser or all test in one browser. It was really very useful. Now I am testing an app using Java and Selenium. I am wondering if there is a plugin like Nunit for eclipse so I can run all my tests using specific browser one by one. Any advice is greatly appreciated :) . Thanks
I used to use JUnit and Selenium WebDriver to acceptance test websites
We scratched the idea though, because i (and my other co-workers) had a tendency to overcomplicate the 'point-and-click' automatic acceptance tests, to the point where they were not reliable anymore (we had some huge flow-tests that caused these issues). Now we currently only smoketest HTML pages now, using HtmlUnit (more or less)
The equivalent of NUnit is TestNG or JUnit in Java. You can install TestNG in Eclipse by following the URL:
How to install TestNG in eclipse Kepler
What apps would you use? Are there auto testing suites like autotest for ruby? What do you use and why? To be honest, I don't even know how to write tests, when, or why. I'd like to learn though, I know that it will make me a better developer.
Our team uses Netbeans, not eclipse, although I'm going to still google eclipse responses to see if they are implemented as a Netbeans solution as well.
There are 2 most popular frameworks for unit tests: JUnit and TestNG. Both are annotation based. To create test you have to create class and mark each method that performs test using annotation #Test.
JUnit is older and have more extensions (DBUnit, Cactus etc). TestNG has much more annotations. Very important feature of TestNG is ability to create test groups using annotations.
Yet another group of tools you will probably need is mocking tools (EasyMock, EasyMock etc.)
There are a bunch of testing frameworks that are popular. JUnit is pretty good and comes by default with Eclipse. It provides an API for defining tests and doing assertions, as well as a Testrunner to execute the tests. EasyMock and Mockito work well with JUnit to provide mocking functionality so you can test components in isolation.
For continuous integration, there is Jenkins, which is free.
There are others as well.
I would use junit and possibly a mocking library like jmock.
Most of the automatic "tests" which can be done use the compiler or a code analysis tool like FindBugs.
In addition to what has already been said (JUnit, EasyMock, ...) you may also have a look at Fitnesse: it may be a good tool for full integration and acceptance tests!
Don't forget TestNG. It's the "next generation" beyond JUnit. It handles threaded tests better.
SOAP UI is the right tool for testing SOAP web services.
JMeter or Grinder for load testing.
As JUnit and Mockito was already mentioned, You can look into Infinitest or JUnit Max for autotesting.
http://infinitest.github.com/
http://junitmax.com/
If you are looking for something that implements continuous testing I can recommend two free products:
For a developer during work in Eclipse/IntelliJ IDE:
http://infinitest.github.com/
Infinitest is an Eclipse/IntelliJ plugin that runs your test continuously in the background while you are developing your code.
For a team:
http://hudson-ci.org/
or
http://jenkins-ci.org/
are great continuous integration servers that can do builds and run tests continuously.
Been writing junits for over 7 years now and I highly recommend spock for all your testing needs: unit and integration testing, mocking, end-to-end testing, data driven testing etc
I am a student and I have developed a web application based on JSP. Now my professor has suggested that i should do some tests like unit test etc for my web application.
Can anybody suggest what other test can I use to demonstrate the performance of my application.
And also any good resource from where I can study how to do unit testing, as I have never done any testing before.
Thanks!
Selenium is a popular framework for client-side unit tests (i.e. automating client input on a web page). The site also has a lot of introductory material.
For testing the server-side stuff the good, old JUnit will suffice - it's integrated in all major IDEs.
You should look into Kent Beck's Test-driven Development, although Test-Driven development is more than regular unit testing, this book will enlighten you (I bet) and you will write way better unit tests, too.
Selenium http://seleniumhq.org/
You should do unit testing for individual backing beans, an behavioural testing with something like Fitnesse
What you're talking about is "integration testing."
"Unit testing" is for proving the correct operation of individual components.
You can use SOAP UI to test SOAP-based web services.
You can automate testing of HTML user interfaces using Selenium UI.
Use JUnit for unit testing Java components, NUnit for .NET, etc.
I want to ask for your prefered way to test Java EE code?
I found only three project, that are trying to help to code unit tests in Java EE environment:
http://jakarta.apache.org/cactus/ : Last Published: 2009-01-18
http://www.junitee.org/ : Last Release: 2004-12-11
http://ejb3unit.sourceforge.net/ : Last Release: 2008-05-17
So I wonder,
is there any framework helping to write (j) unit test for Java EE code?
do you use embedded Java EE servers like jboss or glassfish v3?
do you mockup and inject by yourself?
Thanks a lot...
If by Unit Testing you mean... unit testing (testing a unit in isolation), then you actually don't need any particular framework since EJB3.0 are nothing more than annotated POJOs and thus can be relatively easily tested without any special fixture.
Now, if you mean something else - like Integration Testing or Functional Testing - then, yes, tools can help and simplify things (but you should really start to use the right terminology :) I'll assume that this is what you have in mind.
First, JUnitEE seems dead and obsolete and I'm not even sure it has anything for EJB3.x. Second, I'm not impressed by the Java EE 5 support of Cactus and having to deploy Cactus tests is painful (I think that Cactus was nice for J2EE 1.4 but is a bit outdated now). So this leaves us with Ejb3Unit which is in my opinion the best option, especially if you want to run out of container tests i.e. without really deploying the application (much faster).
If you want to run in container tests, then you could indeed use an embedded container and my current preference goes to GlassFish v3, even for Java EE 5 (I may be wrong but I'm pretty disappointed by the starting time of the latest JBoss releases so it isn't getting much of my attention). See the post GlassFish Embedded Reloaded, an appserver in your pocket for sample code (that you could use from your tests) or Using maven plugin for v3 embedded glassfish (if you are using maven).
Another option would be to package and deploy your application with Cargo and then run some tests against the deployed application (with Selenium or a BDD tool for example). This could be useful if you want to run end-to-end tests with a container that doesn't provide any embedded API.
So, to answer your last question, I would indeed use available tools, maybe a combination of them, for tests that are not unit tests and wouldn't mock/inject stuff myself, except if they don't cover some needs that I can't think of right now.
As you are interested in unit testing, I recommend JUnit. You can unit test the methods in the core classes. If you have difficulty in writing unit test cases using JUnit, then probably the design is not modular and it is highly coupled. First focus on your core functionality and test it using JUnit.
I've been facing the same problem of running integration tests based on JUnit in a Java EE 6 container (Glassfish v3, to be precise), and after a lot of browsing and searching, I could not find a solution that really suited me needs, so I wrote my own, now published as jeeunit on Google Code.
I wouldn't call it a test framework, it is really just a handful of classes providing the glue between JUnit and Embedded Glassfish.
The general idea is similar to Cactus, your tests run in the container and get triggered by a servlet from outside.
jeeunit supports JUnit 4, Glassfish v3, CDI and generates the standard XML JUnit reports just like Ant or Maven Surefire (in fact, I reused some code from Ant for generating the reports).
I had a requirement to test a CDI application and wrote a custom JUnit runner that runs everything outside of the web container.
http://jglue.org/cdi-unit/
It is suitable for Java SE and also supports dummy Request, Session and Conversation scopes for testing web apps.
It's small and fast, which is great when you have lots of unit tests.
I need to do an integration tests on my web application on each build.
Currently I have a set of JUnit tests, which tests various parts of an application before it constructed into war. What I need to do now is to test if application is in good shape after it is deployed into Web container.
The application is written using Spring framework, I've read a lot of docs about Spring integration testing, but all they talk is about testing of integration with databases etc. I've read about Cactus, but the info is pretty scarse as well.
Any pointers for a good tutorials and source code are appreciated.
Details of a software used by app: Spring 2.5, Hibernate 3.2, Maven 2.2, Tomcat 6.0
Many thanks!
You have two tasks to solve: A) Get the container running in an automated (maven based) process and B) run some tests against it.
We use selenium and maven-jetty-plugin for testing a fairly similar application setup. Works like a charm. You might find the same kind of plugins for tomcat, or just run in jetty.
The advantage of selenium is that it allows you to test the application in a very real environment with a real browser. You may find that tools that skip the "real browser" part are simpler to start with.