randoop | Automatic test generation for Java | Unit Testing library

 by   randoop Java Version: v4.3.2 License: MIT

kandi X-RAY | randoop Summary

kandi X-RAY | randoop Summary

randoop is a Java library typically used in Testing, Unit Testing, Swagger applications. randoop has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub.

Automatic test generation for Java
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              randoop has a highly active ecosystem.
              It has 455 star(s) with 158 fork(s). There are 22 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 43 open issues and 237 have been closed. On average issues are closed in 244 days. There are 14 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of randoop is v4.3.2

            kandi-Quality Quality

              randoop has no bugs reported.

            kandi-Security Security

              randoop has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              randoop is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              randoop releases are available to install and integrate.
              Build file is available. You can build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed randoop and discovered the below as its top functions. This is intended to give you an instant insight into randoop implemented functionality, and help decide if they suit your requirements.
            • Create a test class
            • Creates a fixture
            • Returns the sequence as code lines
            • Creates a test method as a test method
            • Command line agent
            • Read a string containing the method calls that should be replaced by the given replacement file
            • Adds method replacements for the original class
            • Adds the method replacements for the given package
            • Checks a contract on an array of values
            • Creates a test driver
            • Runs the tests
            • Returns a string representation of this expression
            • Compares two typed operations
            • Compute the last statement information
            • Checks that the sequence is valid
            • Overridden to extend this type variable to be instantiated
            • Creates the test suite for the given test suite
            • Transform the bytecode of the class
            • Main method for testing
            • Returns the string representation of this primitive
            • Determines if the minimize method is invoked
            • Step 1
            • Transforms a given class
            • Prints out the command in HTML format
            • Runs a command synchronously and returns the result
            • Creates and executes all generated sequences
            Get all kandi verified functions for this library.

            randoop Key Features

            No Key Features are available at this moment for randoop.

            randoop Examples and Code Snippets

            No Code Snippets are available at this moment for randoop.

            Community Discussions

            QUESTION

            Randoop Time Limit
            Asked 2021-Jan-17 at 18:32

            Is Randoop --time-limit for spending that time for generating tests for each class or for the entire project? For example if I set --time-limit = 180 for a project for over 100 class, Randoop will spend 180 seconds for all of the classes, or for each class it will spend 180 seconds to generate tests.

            ...

            ANSWER

            Answered 2021-Jan-17 at 18:32

            Per the Randoop manual, it is the time for the entire project:

            --time-limit=int. Maximum number of seconds to spend generating tests. Zero means no limit. If nonzero, Randoop is nondeterministic: it may generate different test suites on different runs.

            The default value is appropriate for generating tests for a single class in the context of a larger program, but is too small to be effective for generating tests for an entire program.

            If you are testing multiple classes, you might want to multiply the default time limit by the number of classes being tested.

            Source https://stackoverflow.com/questions/65756080

            QUESTION

            Randoop generates tests with same name for all of the classes
            Asked 2020-Dec-17 at 16:01

            I want to generate tests for 200 classes (I have put their classes names in --classlist txt) but Randoop generates RegressionTest0.java to RegressionTestN.java and replaces generated files because they have same name. Is it possible for Randoop to generate tests files with same name as class names, I have put in the classlist file? For example, I have a KMeans.java class and Randoop generate KMeans0.java to KMeansN.java instead of RegressionTest.java? Thanks.

            ...

            ANSWER

            Answered 2020-Dec-17 at 16:01

            Each generated test may call any or all of the classes under test. For example, if your classlist file contains Class1.java, Class2.java, and Class3.java, then each generated test might call all three classes. Randoop does not create a separate set of tests for each class.

            If there is only one class under test (which is definitely against the recommended practice!), then you could rename the files and the classes within them after they are generated. But that is not your situation, as you described above.

            Source https://stackoverflow.com/questions/65333389

            QUESTION

            Randoop with Kotlin
            Asked 2020-Sep-09 at 16:12

            Is there any way (other than migrating Kotlin code to Java with IntelliJ) to make Randoop work with Kotlin? If not is there any other "official" (well-known, tested, widely used) solution for unit test generating in Kotlin projects?

            ...

            ANSWER

            Answered 2020-Sep-09 at 16:12

            Randoop's input is .class or .jar files. Randoop generates Java JUnit test cases. If you are willing to have Java tests for your Kotlin code, then it should be possible to use Randoop.

            If you want Randoop to generate Kotlin code, you would need to change the way that Randoop outputs its internal data structures into test file.

            The only automated Kotlin test generator that I know of is EvoMaster, which generates system-level tests (not unit tests) for RESTful APIs that provide a schema in OpenAPI/Swagger format. It detects 500 status codes and mismatches from the API schemas.

            Source https://stackoverflow.com/questions/63803329

            QUESTION

            Using Eclipse's JDT, how do I identify the classpath for a project?
            Asked 2019-Aug-20 at 22:56

            I am writing a plug-in that will generate unit tests for a Java class that is selected in Eclipse's Project Explorer. This plug-in uses a third-party program called Randoop to generate the tests, so I make this happen using ProcessBuilder:

            ...

            ANSWER

            Answered 2019-Aug-20 at 22:56

            If the outputLocation is null, you have to use the default output location javaProject.getOutputLocation() instead of entry.getPath().

            See Javadoc of IClasspathEntry.getOutputLocation():

            Returns:

            the full path [...], or null if using default output folder

            If in Project > Properties: Java Build Path tab Source the check box Allow output folders for source folders is not checked, IClasspathEntry::getOutputLocation() will always return null.

            Source https://stackoverflow.com/questions/57578734

            QUESTION

            Using Randoop To Generate Test Cases (Based on Pre- and Post- Conditions)
            Asked 2019-Feb-12 at 06:32

            I am trying to use Randoop (by following Randoop Manual) to generate test cases based on pre- and post- conditions specification stored in a JSON file.

            Target program is the following (buggy) Java method.

            ...

            ANSWER

            Answered 2019-Feb-12 at 06:32
            1. Why does not changing --output-limit change the number of generated test cases?

            Randoop generates tests, then outputs a subset of them. For example, Randoop does not output subsumed tests, which appear as a subsequence of some longer test.

            This is mentioned obliquely in the documentation for --output-limit.

            two of which checking the method getClass does not return null value (even though that is not part of my specification)

            getClass() is a method in Math (the class under test), so Randoop calls getClass(). At test generation time, the return value was not null, so Randoop made an assertion to that effect.

            There is nothing special about getClass(); Randoop would create similar regression tests for other methods.

            1. It seems that Randoop does not consult the specification inside spec.json

            There was a bug in Randoop's handling of postcondition specifications for static methods. The bug has been fixed.

            To report a bug, it is better to use Randoop's issue tracker, as noted in the Randoop manual. The options for getting help also include mailing lists. Unlike Stack Overflow, the issue tracker and mailing list permit discussions and tracking current status. Thanks!

            Source https://stackoverflow.com/questions/54612864

            QUESTION

            Cannot find module 'generator-jhipster'
            Asked 2018-Apr-10 at 07:32

            I am trying to load the "generator-jhipster' inside Yeoman as is described on the Yeoman documentation:

            http://yeoman.io/authoring/integrating-yeoman.html

            ...

            ANSWER

            Answered 2018-Apr-10 at 07:32

            Solved.

            The jHipster genetator don't have the index.js on the main folder, so, the correct code to invoke it is:

            Source https://stackoverflow.com/questions/49731743

            QUESTION

            LinkageError from loading in classes that have a parent-child relation
            Asked 2018-Mar-12 at 10:14

            I followed the CoreTutorial example class at http://www.jacoco.org/jacoco/trunk/doc/examples/java/CoreTutorial.java to understand how to incorporate Jacoco into a project.

            However, I am facing java.lang.LinkageError problem that is related to the MemoryClassLoader class that is used.

            ...

            ANSWER

            Answered 2018-Mar-12 at 10:14

            First of all, you should override findClass instead of loadClass. The restriction that a class with a specific name can only be defined once in a loader does always apply and you may always encounter situations where the same class is requested multiple times (in any nontrivial scenario).

            The loadClass implementation inherited from ClassLoader will already take care of this and return the existing definition, if there is one. Since it also queries the parent loader first, you should take care to specify the right parent loader, if the loader is supposed to define classes with names that are also in use by other class loaders. Using the default implementation of loadClass, your findClass method can stay that simple:

            Source https://stackoverflow.com/questions/49227392

            QUESTION

            Unable to set the package name for classpath in randoop
            Asked 2017-Sep-22 at 00:28

            Here the project structure cloned from github after compiling on Ubuntu successfully,

            ...

            ANSWER

            Answered 2017-Jul-25 at 16:46

            The error message gives you the answer:

            Ignoring interface net.sf.javaml.core.Dataset specified via --classlist or --testclass. No classes to test

            You are supposed to provide a class, not an interface, to the --testclass command-line argument.

            By passing --testclass=net.sf.javaml.core.Dataset to Randoop, you indicated that you only want Randoop to create objects of type net.sf.javaml.core.Dataset. However, since that is an interface, it cannot be instantiated, and Randoop cannot create any objects, nor any tests.

            Source https://stackoverflow.com/questions/45280294

            QUESTION

            How often do Libraries change? Do Libraries need regression testing as much as programs do?
            Asked 2017-Apr-21 at 13:25

            I read it in a research paper published on IEEE which said that libraries dont change often and hence dont need much of regression testing. I wanted someone to verify the statement. Also, it said that Randoop was earlier developed and evaluated on libraries. Can someone verify that?

            ...

            ANSWER

            Answered 2017-Apr-21 at 13:25

            [The paper] said that Randoop was earlier developed and evaluated on libraries.

            This is largely true not just of Randoop, but of other test generation tools such as ARTOO, Check 'n' Crash, EvoSuite, GRT, QuickCheck, etc.

            The paper is "Scaling up automated test generation: Automatically generating maintainable regression unit tests for programs" (ASE 2011). Its problem statement is that test generation tools have often been applied to libraries, which are easier to handle than programs. Its contribution is showing how to extend a test generation tool (Randoop) to programs.

            An example of an earlier paper that applied Randoop to libraries is "Feedback-directed random test generation" (ICSE 2007). It reports finding dozens of important, previously-unknown errors.

            I read it in a research paper published on IEEE which said that libraries dont change often and hence dont need much of regression testing.

            The paper does not say libraries "don't need much regression testing". It actually says, "A library is less likely to be in need of a regression test suite. Libraries rarely change, and a library is likely to already have some tests." The main point is that the Randoop tool generates tests, and such a tool is more needed for components that don't have tests. As a general rule, libraries usually already have a human-written test suite. The library is also exercised by every program that uses it. By contrast, many programs exist that don't have a test suite, or whose test suite omits large parts of the program's behavior. Test generation is more needed for such components.

            This is point #5 near the end of a list of 6 reasons to motivate extending Randoop to programs. The comment makes sense in that context but not when taken out of context or misquoted. The list starts with,

            Randoop was originally targeted toward detecting existing bugs in data structure libraries libraries such as the JDK's java.util. Instead, we want to extend Randoop to generate maintainable regression tests for complex industrial software systems.

            Data structure libraries tend to be easier for tools to handle in several ways. ...

            Returning to one of your questions, every software component -- whether a program or a library -- needs a regression test suite to be run when it changes. Running the tests gives you confidence that your changes have not broken its functionality. If you never change a component, then you don't need a regression test suite for it.

            Some libraries never change (because of policy, or because there is no need to change them), and others are being constantly updated.

            Source https://stackoverflow.com/questions/43525059

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install randoop

            You can download it from GitHub.
            You can use randoop like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the randoop component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            Randoop homepageRandoop manualRandoop releaseRandoop developer's manualRandoop Javadoc
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries