Git Product home page Git Product logo

junit-contracts's Issues

Add simpler example: List?

I recommend adding a simpler example, such as showing that ArrayList and LinkedList both respect the List contract. I also recommend publishing a tutorial in which you show adding a few more contract tests. I further recommend showing how to distinguish a test for ArrayList that wouldn't apply to LinkedList (such as for trimToCapacity()).

Can't build a package from source

I'm on commit 8b8a264. mvn package fails:

Failed tests:   org.xenei.junit.contract.CImpl2ContractTest: expected:<[CImpl2ContractTest.producer.newInstance(), called Extra Method, CImpl2ContractTest.producer.cleanUp()]> but was:<[CImpl2ContractTest.producer.newInstance(), called Extra Method, CImpl2ContractTest.producer.cleanUp(), CImpl2ContractTest.producer.newInstance(), cname, CImpl2ContractTest.producer.cleanUp(), CImpl2ContractTest.producer.newInstance(), cname version of aname, CImpl2ContractTest.producer.cleanUp(), CImpl2ContractTest.producer.newInstance(), cname version of bname, CImpl2ContractTest.producer.cleanUp()]>

Tests in error:
  initializationError(org.xenei.junit.contract.AImplContractTest): No tests for class org.xenei.junit.contract.AImplContractTest
  initializationError(org.xenei.junit.contract.BImplContractTest): No tests for class org.xenei.junit.contract.BImplContractTest
  initializationError(org.xenei.junit.contract.CImplContractTest): No tests for class org.xenei.junit.contract.CImplContractTest
  initializationError(org.xenei.junit.contract.DImplContractTest): No tests for class org.xenei.junit.contract.DImplContractTest

I can't figure out what to do next. I don't understand the example well enough to see how the pieces fit together.

FastClasspathScanner is outdated -- consider porting to ClassGraph

Your project, Claudenw/junit-contracts, depends on the outdated library FastClasspathScanner in the following source files:

FastClasspathScanner has been significantly reworked since the version your code depends upon:

  • a significant number of bugs have been fixed
  • some nontrivial API changes have been made to simplify and unify the API
  • FastClasspathScanner has been renamed to ClassGraph: https://github.com/classgraph/classgraph

ClassGraph is a significantly more robust library than FastClasspathScanner, and is more future-proof. All future development work will be focused on ClassGraph, and FastClasspathScanner will see no future development.

Please consider porting your code over to the new ClassGraph API, particularly if your project is in production or has downstream dependencies:

Feel free to close this bug report if this code is no longer in use. (You were sent this bug report because your project depends upon FastClasspathScanner, and has been starred by 13 users. Apologies if this bug report is not helpful.)

maven reporting tool needs flag to fail if no classes found

Currently the maven plugin will fail if no classes were located in the list of specific packages. There needs to be a flag to determine if the report should fail the build or simply report the error. Currently this impacts Windows systems as the package names in the parameters list may be mixed case (for unix) and then fail on windows.

Example test for Serializable contract tests everything at once

I love the idea for junit-contracts. I fear that a TDD practitioner will look at the example test for the Serializable contract and have one of two unfortunate reactions: (1) "This test is absurd! This dude has no idea what he's talking about!" or (2) "Wow... that's a complicated test. I guess I should write more complicated tests." Both cause problems.

I strongly recommend splitting testSerializableContract() into several tests to illustrate a more sensible design for contract tests. For example, I see the following tests:

implementsWriteObjectMethod()
implementsReadObjectMethod()
implementsReadObjectNoDataMethodIfNeeded()
allFieldsThatNeedSerializingAreSerializable()
allFieldsThatAreNotSerializableDoNotNeedSerializing()

It's possible to break them down further.

ContractSuite fails if there are no tests.

Currently the ContractSuite fails with a "No tests found" error. It should log the error (not generate a testing failure) and let the maven plugin handle aborting the build.

There is no mechanism to skip individual tests in a contract test.

The "skip" attribute of the ContractImpl annotation lists interfaces of the class under test that should not be tested.

The "ignore" attribute fo the @ContractImpl annotation lists the test implementations that apply t othe class under test that should not be executed.

However, there is no mechanism to exclude specific tests from test implementations. This is required when classes do not implement all the functionality the test exercises but other tests are applicable.

Change 2 logging entries from info to debug

would it be possible to remove the logging at [INFO] for the next version of the contract framework?

ContractSuite.java:343
ContractTestMap.java:268

Messages like:
INFO main - Running: org.xenei.junit.contract.ContractSuite$BaseClassRunner@248e319b
INFO main - Running: org.xenei.junit.contract.ContractTestRunner@5d0bf09b
INFO main - Running: org.xenei.junit.contract.ContractTestRunner@793f29ff

aren't about the jena-core test suite.

    Andy

Does the contract scanning do class initialization

There may be issues when a class is initialized earlier than it should be. The class loader should load the class and explicitly not initialize the classes as we are only looking for annotations.

Once testing starts initializing the classes under test is acceptable and desirable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.