Skip to content
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

Easier testing (ie: adding specs) #1334

Closed
ponelat opened this issue Jun 4, 2015 · 2 comments
Closed

Easier testing (ie: adding specs) #1334

ponelat opened this issue Jun 4, 2015 · 2 comments

Comments

@ponelat
Copy link
Member

ponelat commented Jun 4, 2015

As per @fehguy request.

Make the whole testing of swagger-ui a little easier to approach, and allow the addition of specs to be pain-free.

What we can do is setup a connect( or even the more powerful express) server to dish out the specs. With some middleware(connect lingo for 'plugin') for 4XXs, false mime-types etc.

@webron webron added this to the v2.1.1 milestone Jul 21, 2015
@webron webron modified the milestones: v2.1.1, v2.1.2 Jul 31, 2015
@webron webron modified the milestones: v2.1.2, v2.1.3 Sep 2, 2015
@fehguy fehguy modified the milestone: v2.1.3 Jan 6, 2016
@fehguy
Copy link
Contributor

fehguy commented Jun 15, 2017

It's not too late! Here's an overview of how I'd like to see this effort tackled.

In general, this is a difficult project to test. There are an infinite number of combinations possible when defining a specification. The rendering and behavior of the UI thus needs to have a very flexible mechanism for creating tests and verifying that the behavior is correct.

It is impossible for us to build an "uber spec" which characterizes all the possible behaviors of the UI. Thus, we should expect that there will be a large number of specifications which need to be written in order to exhibit bugs or fixes in the user interface. Making things more complicated, there are dynamic rendering and execution behaviors as well, which means we have to hook in to the guts of the swagger-ui quite deeply in order to properly test.

From a contributor's point of view, I'd like to see that end-users have the following structure available when they submit an enhancement or fix:

  • A mechanism to provide a specification for a test.
  • A mechanism to load swagger-ui to render, based on the supplied specification
  • A framework for verifying the existence of buttons, links, rendered sections of text in a code-driven fashion
  • A technique to intercept requests, as executed through swagger-ui, to mock responses from a server.
  • A framework to verify rendered output in swagger-ui based on request execution

With the above, we should establish that single test files should be created here:

test/integration/*.js

In the integration folder, a single file should have the following:

  • A definition, in a JSON object
  • A convenience method to start swagger-ui (headless or not), where swagger-ui will use the definition in it
  • Tests should be called after swagger-ui has been initialized and is rendered

@shockey
Copy link
Contributor

shockey commented Sep 14, 2017

I believe we have everything that was outlined here covered.

Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants