Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unit Test #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
SaifJerbi merged 6 commits into JsonSchema-JavaUI:master from Hdebbech:master
Jun 11, 2017
Merged

Unit Test #43

SaifJerbi merged 6 commits into JsonSchema-JavaUI:master from Hdebbech:master
Jun 11, 2017

Conversation

Copy link
Contributor

@Hdebbech Hdebbech commented Jun 11, 2017
edited
Loading

Added test cases for these layouts

  • Text Field
  • Text Area
  • Password
  • Number
  • CheckBox
  • RadioBox
  • ComboBox

These will cover around 86 % of the code

Testing strategy :

There is one thing i know about unit tests, they should be concise, easy to read, easy to maintain, and they should easily give you an idea about what the library does !

the idea is Given an annotated DTO, we generate the ui Form, then we inspect the ui form to make sure that none of the informations specified in the annotations are missing.

There is 2 alternatives for this:

  1. Either use the UI Form pojo:
    The JsonSchema object to test the customized json schema, and the JsonNode object to test the json schema ui form.
    It is easy to fetch information from the JsonSchema object to make assertions, but the problem resides in the JsonNode object, it has a tree-like structure, and traversing trees often results in a complex code that is harder to maintain in the long run, and the more complex the json it represents, the more harder it will become to fetch an information out of it.
  2. Or Serialize the ui form to json, and use Domain specific language (DSL) to query the json for the wanted information:
    I found a quite popular library named json path, it has a query language like SQL to query json. the syntax is pretty easy to grasp. It also comes with helper classes for unit tests, to traverse json and make assertions.

Copy link

Coverage Status

Coverage increased (+85.8%) to 85.789% when pulling 3efac63 on Hdebbech:master into 09ed590 on JsonSchema-JavaUI:master.

Copy link

Coverage Status

Coverage increased (+85.8%) to 85.789% when pulling 6ae2f4f on Hdebbech:master into 09ed590 on JsonSchema-JavaUI:master.

Copy link
Member

You have made a great job Hichem

@SaifJerbi SaifJerbi merged commit 41a0d75 into JsonSchema-JavaUI:master Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /