GithubHelp home page GithubHelp logo

testingisdocumenting / webtau Goto Github PK

View Code? Open in Web Editor NEW
356.0 356.0 40.0 47.46 MB

WebTau (web test automation) is a testing API, command line tool and a framework to write unit, integration and end-to-end tests. Test across REST-API, WebSocket, GraphQL, Browser, Database, CLI and Business Logic with a consistent set of matchers and concepts. REPL mode speeds-up tests development. Rich reporting cuts down investigation time.

Home Page: https://testingisdocumenting.org/webtau/

License: Apache License 2.0

Java 54.37% Groovy 32.58% HTML 1.48% JavaScript 6.11% CSS 1.90% Shell 0.04% Kotlin 0.04% Batchfile 0.01% TypeScript 3.46%
cli database graphql groovy http java junit5 jvm report rest rest-api selenium test-framework testing websocket

webtau's People

Contributors

dependabot[bot] avatar mattmetlis avatar mykolagolubyev avatar tsiq-clemens avatar tsiq-karold avatar tsiq-nick avatar vmpn avatar

Stargazers

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

Watchers

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

webtau's Issues

Equivalent to JUnit's assumeThat

There are cases where we legitimately want to skip a test. For example, a particular bit of functionality is not yet available in certain environments. In JUnit, one would use assumeThat to achieve this, would be useful to have an equivalent in webtau.

One thing to be aware of with this is that the webtau CLI return code is count failed + error + skipped therefore assumeThat like "failures" cannot count towards the regular skipped count.

Groovy AST to handle should syntax on maps

myMap.should == 'wrongvalue gives no op.
It is not an issue when assertion is done in the context of http.get|post. But if the same syntax is used outside that it just gives no errors.

Need to create Groovy AST to replace calls like myVar.should == with ActualValue.value('myVar', myVar).should(equal(..)).

Need to replace existing runtime way of doing it with exception "should not reach here" inside Should and ShouldNot classes

Log error for path not part of Swagger spec

Specifically, from this particular condition in OpenAPISpecValidator.validateApiSpec:

ApiOperationMatch apiOperationMatch = apiOperationResolver.findApiOperation(path, method);
if (!apiOperationMatch.isPathFound()) {
    return;
}

Add Groovy Grape Support

Trying to use grape for dependency management but it doesn't seem to fetch the specified libraries

Show failed tests at the top

Currently, we order the tests alphabetically in the HTML report. Would be nice to see the failed errors at the top (ideally with a copyable details).

Support Run Groovy script from IDEA

Right now if I run a script using IDEA run, I get a null pointer on scenario call.

Caught: java.lang.NullPointerException: Cannot invoke method scenario() on null object
java.lang.NullPointerException: Cannot invoke method scenario() on null object
	at com.twosigma.webtau.WebTauGroovyDsl.scenario(WebTauGroovyDsl.groovy:39)
	at com.twosigma.webtau.WebTauGroovyDsl$scenario.callStatic(Unknown Source)

URLs are truncated in HTTP calls view

There is no horizontal scrollbar or tooltip, one has to either expand the request/response or go to steps tab. Can we either provide a tooltip on hover or maybe wrap the url if the row is expanded?

Default env logging is confusing

localHost:tests karol$ ~/Dev/webtau/dist/webtau scenarios/*
       env: local                                   // from command line argument

Clearly, the comment is not correct as no env was specified on command line!

Add JUnit 5 support

At the moment API can be used inside JUnit, but report will not be generated properly.
Need to create JUnit 5 extension to properly hook reporting.

Implement a caching auth provider

We have a couple of auth provider implementations now which basically do the same thing when asked for a token:

  • check local cache file and its validity (in terms of time expiry)
  • if valid, great
  • if not valid, fetch new token and cache it

Would be nice for webtau to have some sort of helper class/utils to make this easier and reduce the duplication.

Naming improvements for operations on a list response body

Asserting the size of a list response body is done with body.numberOfElements(). Accessing the elements is done via body.all(). The inconsistent naming is a little confusing.

It would also be quite useful to have find and maybe other similar operations on a list body.

Auto load groovy default config file when using Groovy console

If you use groovy console to play with API or to prototype tests none of the config values are loaded. So you have to manually set things like base url.
While base url setup through the console itself is quite trivial, setting authentication handlers may not be.

Need to detect that webtau is in groovy mode and lazy load config before first HTTP or UI command.

Swagger schema validation

If a Swagger json is specified in config (local or http) then following an http call, validate the response to the model in Swagger. This will first require pattern matching on the URL to determine the right operation.

Specifying a non-existent env leads to confusing errors

I think non-existent env should lead to an error saying "requested env does not exist" or something like that. Right now, it'll try to run tests and invoke http calls without the base url so it'll do a GET /foo for example which predictably fails. This is quite confusing and not immediately obvious what's wrong.

Provide option to validate responses against JSONSchema

Proposed syntax would be something along the lines of:

http.get('/something') {
    body.shouldBe validAgainstSchema('schema.json')
}

Things to consider:

  • loading schema relative to current working dir
  • config for location of specs

Comparison of array and list

Currently something like this fails:

def actual = //something that returns a String[]
actual.should == ['foo', 'bar']

Error:

[value]:   actual: [Ljava.lang.String;@50313382 <java.lang.String[]>
         expected: [foo, bar] <java.util.ArrayList>

Swagger url coverage UI

Use collected URL coverage data to provide

  • % coverage information on Summary page
  • list of covered and non covered operations

Swagger url coverage

Integrate with swagger to figure out what URLs and operations are covered.
Collect this data in a way to be consumable inside HTML report.

maven plugin documentation

Document maven plugin usage.
Need mdoc support for extracting portion of xml to avoid confusion around pom parent.

Summary at the end of groovy cli run

It would be helpful to either:

  • print a summary of failed tests before the Total: z, Passed: y, blah line
  • or, have a debug flag, without which we only print test name and passed/failed instead of all HTTP invocations, bodies, etc.

Incorrect behaviour with delegates for list responses

If an http call responds with a json list rather than an object this code passes when it should fail:

http.get('emptyResponseUrl') {
    nonExistentField.shouldNot == null
}

If I print nonExistentField, it looks something like this:

[[null node]@body[0].nonExistentField, [null node]@body[1].nonExistentField]

It looks like webtau is doing a projection of that field onto the list.

Set properties cannot be compared with TableData

Example:
Set aSet = myBean.getChildrenSet()
aSet.should == [ ... table data ...] // throws exception that Set cannot be converted to a List.
aSet.toList().should == [ ... table data ...] // works fine

This prevents sub collection matching if I want to verify properties of myBean, e.g.
myBean.should == [ propA: 'expectedA', childrenSet: expectedChildrenTableData ]

Add timestamps to each scenario run & http request

This will be useful for correlating failed integration tests to the logs, which will help drill down into root cause quickly.

Timestamps could be in ISO8601 format with the system's timezone e.g. 2008-09-15T15:53:00.123-04:00

  • Under tests -> Summary, please add two cards. Labels: "Scenario Start" and "Scenario End" with the values as the timestamps.
  • For each HTTP call under http calls -> individual call, please add a single card (currently just has "Latency (ms)"). Label: "Request Start" with the timestamp.
  • Under tests -> HTTP calls, please include Request Timestamp as a column.

Feature Testing specific configuration manipulation messes with custom config handlers

To simplify feature testing we added triggerConfigHandlers

        WebTauConfig.resetConfigHandlers()
        WebTauConfig.registerConfigHandlerAsFirstHandler(cliConfigHandler)
        WebTauConfig.registerConfigHandlerAsLastHandler(cliConfigHandler)

        // during end to end testing we re-create the instance of CliApp, but our config is singleton
        // we cannot rely on constructor actions
        //
        getCfg().triggerConfigHandlers()

this mess-up custom config handlers as they are being called twice.
Need to think how to enable feature testing with fewer consequences.

Null body generates an NPE in find* operations

This code:

def foo = body.find { something }

can lead to:

Caused by: java.lang.NullPointerException
    at java.util.Collections$UnmodifiableCollection.<init>(Collections.java:1026)
    at java.util.Collections$UnmodifiableList.<init>(Collections.java:1302)
    at java.util.Collections.unmodifiableList(Collections.java:1287)

Maven plugin for executing tests

Currently, unless using the JUnit option, one has to write some maven exec code in the pom and in all likelihood also invoke a script to then unzip dist and run CLI.

Provide a way to skip execution of all scenarios in certain failure cases

The primary use case for this is if you fail to obtain creds in a header provider then in all likelihood no tests will pass therefore may as well abandon the test run straight away. Right now if an exception is thrown from the header provider webtau will still try all scenarios.

One option would be to have a special exception type, e.g. AbortTestExecutionException, that can be thrown and skips further scenario execution. There may be a better way though.

Enable CI

Enable Travis CI to perform regular builds for PR and pushes

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.