Java - JUnit Test Generators [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I would like to know about good tools to automatically generate JUnit4 tests. By automatic generation, I mean that if I write a .java file, then a test file for the same should be created with method placeholders and setup/teardown in place (like the auto-generate constructors feature of eclipse)
I found some but I haven't tried them all and frankly I am overwhelmed by the plethora of choices. I was wondering if someone has tried some/all of them and has any recommendations from these or any other.
http://moreunit.sourceforge.net/
http://sourceforge.net/projects/junitgenerator/
http://sourceforge.net/projects/junittestmaker/
http://jub.sourceforge.net/
http://testcasegen.sourceforge.net/
http://www.softpedia.com/get/Programming/Other-Programming-Files/JUnit-Test-Generator.shtml
http://mediakey.dk/~cc/generate-junit-tests/
http://developers.google.com/java-dev-tools/codepro/doc/features/junit/test_case_generation?hl=hu-HU
http://agile.csc.ncsu.edu/SEMaterials/tutorials/fit/

I use the Eclipse plugin MoreUnit. It can generate TestClasses and test-methods. It also shows which methods have test methods ...
Together with TestNG(JUnit is also good) and EclEmma junit testing is quite easy to handle and keep track on the code coverage

Some suggestions: Randoop, AgitarOne, and EvoSuit for Java.

The Squaretest plugin for IntelliJ IDEA works well. It can auto-generate test-classes with a lot of the required boilerplate code. It supports creating tests in either Java or Groovy with the JUnit4, JUnit5, AndroidJUnit4 or Robolectric3 test frameworks.
Disclaimer: I created the Squaretest plugin.

CodePro Analytix Plugin for Eclipse is also good. Exiting thing for me is it generates multipe testcases covering all the execution paths of a method, analyses dead code and dependencies and has lot of other features.
Check out the User Guide here

My favorite is JUnit-Tools to generate JUnit Tests and more. It's a eclipse plug-in and up to date. Further there are many possibilities to configure and to adapt.

Related

Alternative to Gatling [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 months ago.
Improve this question
I’ve been having issues lately because my dependencies has been updated to use netty 4.1 and Gatling has not been updated for a while, and still work only on Netty 4.0.
Anybody knows any alternative to Gatling to create similar Simulations and scenarios for the performance test to be run automatically in my Maven life cycle?
If you look for something code-based it would be:
Locust
Grinder
For UI and/or XML based scenario definition you can check out:
Tsung (this one can be reliably run on Linux/Unix only)
Apache JMeter
Check out Open Source Load Testing Tools: Which One Should You Use? to learn more about the aforementioned tools and decide which one fits to your most.
As a nice replacement for Gatling I would recommend you to check the Locust. The good thing about the Locust specifically for you is that it is code based performance testing tool which does not enforce you to write the tests only in a specific programming language like Python. Because if you used Scala before, you might be more comfortable to switch to something like Java or even Kotlin while writing your tests which is more than doable using Locust framework. You can find the handy tutorial by this link:
https://www.blazemeter.com/blog/locust-performance-testing-using-java-and-kotlin
Here's also a benchmark comparison of different tools.
If you are javascript/Ecma familiar k6 does the job.
Apache JMeter is a known alternative to Gatling.
It is frequently updated (at least 2 major releases per year) and has a strong user base and a lot of commercial offers.
There is a Maven Plugin that is being recently much more frequently updated, there has been 4 releases in 2 months.
Look at code coverage in more details.
k6 is a good alternative, if js is not a problem for you. https://k6.io/

Tool for java code coverage on GitHub [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have a Java project created in IntelliJ and using Gradle.
My repository is hosted on GitHub, I've also integrated Travis CI.
My tests are done using JUnit and Mockito, Java 8.
I'm looking for a tool that would automatically run tests whenever I push to my repository, providing me with information if tests passed and code coverage information. Would like it to generate a GitHub badge just like Travis CI does, so that I can see how each branch is covered and if it's passing.
Thanks!
I decided to go with Codecov
Here's my GitHub repo with example implementation.
I use JaCoCo to capture coverage statistics which get published to Coveralls to track coverage changes between builds and visualize the results. Coveralls also provides a badge with a coverage percentage.
Gradle/Travis/Github examples here and here
With https://codecov.io/, the official example here is more up to date compared to the best answer:
https://github.com/codecov/example-gradle
However, I the CodeCov badge is set up in a nice way in the best answer's code, compared to the official examples which seem to have no badge in the README.
EDIT: After trying to set up all of this, I really disrecommend using CodeCov for private repos (although it can work well for public repos). Full of bugs. Very mad.

JUnit examples to teach [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I need good examples of Junit tests for Java classes, to spend in training, anyone have suggestions of good examples?
Here is a good one which shows you step by step what you have to do, including screenshots with Eclipse also.
From memory, I think Kent Beck's Test Driven Development walks through some good examples. Probably a good book to refer to in testing training courses. http://www.amazon.co.uk/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530
You can have a look at open source software - maybe a library which you use for yourself. They often contain unit tests, e.g.:
Apache Commons lang test code
Google guava libraries test code
and for sure a lot more....
I do not know what you mean with 'to spend in training' but if you will use it for other purpose than to train yourself check the license first.
JUnit tests are somehow based on your procedures. It depends what do you want to test. For example, if you want to test if for specific input, you receive specific output, you can use assertEquals. For writing a simple step by step JUnit test in Java in Eclipse, look at "Write Simple JUnit Test".
For thorough information, look at "Unit Test Tutorials".

Java Mutation Testing Integration with Maven [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Our project will integrate mutation testing as part of its build cycle. Right now, we are on the evaluation phase.
So far, I have only found that Jester has a maven-plugin (Grester). I have not been able to find anything for the other mutation testing tools available (Jumble, µJava and Javalanche). Of course, we want full maven integration. We do not want to reinvent the wheel (i.e., write our own maven plugin for the tool that we choose).
Do you know of any maven-plugins for those Jumble, µJava and Javalanche? I've already googled and, like I said, have only found Grester. Also, if you know of any other mutation testing tools for java, any hints will be greatly appreciated.
PIT, provides a Maven plugin.
It's available from Maven central and has the advantage of being considerably faster than Jester, Jumble or muJava. It is also actively developed and supported which does not seem to be the case for Jester or muJava.
(disclosure I'm the author and am probably unfairly biased)
Of the mutation testing tools in the java world, I've found this about Maven support:
µJava: no
Bacterio: no (uses its own ide)
Javalanche: no (uses its own ide)
muTest (µTest): no
Jumble: yes
PIT: yes
Jester: yes
Simple Jester: no
Judy: no
MAJOR: no (uses its own compiler)
(This information was found by googling and from the article Delahaye, du Bousquet: A Comparison of Mutation Analysis Tools for Java.)
My vote would also go for PIT.

Sample project for learning JUnit and proper software engineering [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm having a hard time making the connection between testing and code. I could ask numerous questions here about things like directory structure and naming of test classes and JUnit 3 vs 4 and so on, but I'd rather find a sample project that does it right and learn by reading it.
I'd like something not too complex so that I can understand it easily, and JUnit 4 would be best (no reason to stick with 3 since I'm starting fresh, right?). I'm on Windows 7, I use Eclipse and I'm planning/hoping to learn and use Hudson. I like Ant, haven't had a good experience with Maven but that's cool too.
Is there a sample project out there that fits this criteria?
edit: Neither of these answers mentioned Hudson; I really like the Craftsman articles (and maybe it goes into continuous integration) but does anyone else have any other suggestions?
I found the Craftsman articles by Robert Martin (Uncle Bob) an excellent resource for learning effective unit testing. It focuses on Test Driven Development and walks you through the experience of a new coder learning how to test code. The first article can be found here and is called The Craftsman #1: Opening Disaster.
If you're looking for an easy example of project structure and convention, I would recommend giving Maven another go. To use it with Eclipse, install the M2Eclipse plugin, and create a Maven project using one of the Maven archetypes. The archetypes build simple template projects, including source and test structure, and will run with Maven and Eclipse right away.

Categories

Resources