Git Product home page Git Product logo

domain-test-dsl's People

Contributors

allanmckenzie avatar benouaer avatar khanhassan avatar krzysztofo avatar mapingo avatar martinyspasov avatar mohamedfarouk-hmcts avatar purple52 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

domain-test-dsl's Issues

Investigate POJO argument issues

There have been reports of problems passing lists of POJOs to the aggregate method. We need to:

  • Test that if you have a List method argument that the wrapper can correctly find the right method based on the input JSON
  • Check that nested POJO classes work (eg, an argument that takes a POJO that in turn has another POJO as a field
  • Consider other POJO deserialisation cases and talk to the other teams about what might not work.

Support wildcards in expected events

If an aggregate generates data (eg, creates a UUID or the current timestamp) and uses those values in an expected event, then we cannot match against the expected event because an exact match is done between the expected and actual events.

We need to add support for specifying a wildcard in the expected event data to support this scenario.

"Then" clause failures produce a stack trace instead of useful error message

If a "Then" (or subsequent "And") does not match an event, it should report what event (if any) was found instead of the one expected. Currently, if no event is found, the following stack trace is emitted instead:

Then hearing allocated for listing # DomainTestSteps.previous_events(String)
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
at java.util.LinkedList.get(LinkedList.java:476)
at uk.gov.justice.services.test.domain.DomainTestSteps.assert_events_generated(DomainTestSteps.java:54)
at uk.gov.justice.services.test.domain.DomainTestSteps.previous_events(DomainTestSteps.java:32)
at โœฝ.Then hearing allocated for listing(allocate-hearing.feature:28)

Improve Null and Optional Handling

Currently, if a field is omitted from the argument JSON that is used to create the arguments passed to the aggregate method, because it is not a required field, then the aggregate wrapper fails to find the matching method.

We need to expand the code that finds a matching method so that if it doesn't find an exact match it looks for methods that take additional optionals.

We should discuss whether this should be expanded to pass nulls for unmatched parameters, or whether to insist on optionals.

Support multiple events in a JSON file

Add support to allow multiple events to be listed in a JSON array in an input or output file. It should act as though the events were listed explicitly in the Given or Then.

Support improved syntax in When clauses

Currently we support When clauses such as:

When you doSomething to an ExampleAggregate

We would like to make the "to" (and other similar words) optional, so we can support:

When you something an ExampleAggregate

We would also like to update the joingin words that are used with the method arguments in the When clause, so that the "a|an" is not mandatory and to additionally support "some":

When you doSomething to an ExampleAggregate using a turnip
When you doSomething to an ExampleAggregate using some turnips
When you doSomething to an ExampleAggregate using turnips

Usability Feedback

  • Allow whitespace between events names and commas.
  • Remove the "there are previous events" text for the Given clause. We would just list the event names
  • Add support for "nothing happens" (ie, no events) in the Then clause
  • Update When definition to support "When (you) something (to|from|on|in) (a|an) Thing (using|with) (a|an) (*)" with then last three bits optional. eg, "When you addIngredients to a Recipe using an empty list" would load a file called "empty-list.json" to use as the parameters
  • Remove "the" from Then
  • Add support for methods with no parameters in the When clause.
  • Add support for unqualified aggregate class names. eg, "When you addIngredients to a Recipe" should classpath scan for a class called Reciepe that implements the Aggregate interface.
  • Add support for leaving out dashes from filenames, and add them programmaticly when trying to load the specified file. eg, "Given cake ordered" will load an event file calledcake-ordered.json
  • Add support for the "And" operation for specifying multiple Given and Then clauses as well as supporting commas,
  • Add support for "with" in Given and Then. eg: "Given cake ordered with unknown cake" should look for an event JSON file called cake-ordered-with-unknown-cake.json. We may add other phrases as well as "with" to expand this vocabulary. Using these words to separate the event name from a qualifier will make syntax highlighting clearer.

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.