简体   繁体   中英

Automated API stability testing

I have a webapp I want to test for API stability.

To test the API I have a dependency on the project containing the domain objects written by my API, I call the api and try to deserialize the objects (using spring RestTemplate) into the domain objects.

When developing a new version of the API, a newer version of the domain object project will be used. Here's a picture of the scenario: 在此处输入图片说明

Now I want an automated way of running the test project against a given webapp on a build server (Jenkins in this case, using maven or ant). The problem is that they share one dependency with different versions (so I can't build them together).

My current approach is to build the webapp, deploy it in a jetty and then try to run the tests. It has proven to be hard.

Any takes on how to solve this issue? Previous experience?

why does webapp-tests depend on domain 1.1 and webapp-api on 1.2-SNAPSHOT? shouldn't the webapp-tests artifact depend on the same common dependency as webapp-api? If its the same artifact just with a different version you could configure that into a property. But I think its better to also add webapp-api into the project so it shares the common version:

  • domain (version)
  • webapp-api (depends on domain)
  • webapp-tests (depends on domain, testing webapp-api)

all share the same parent and the same version.

if you want to test against the previous released version (or one of them) you need to do something similar to the cobertura-plugin: http://mojo.codehaus.org/cobertura-maven-plugin/ This would mean writing a plugin.

Did you try to add the dependency you want to test into a maven profile so the webapp-tests run agains the webapp-api using different version of the domain? so you could re-run the tests activating a different profile.

I might just get the question wrong :) If webapp-tests should contain a different version then dont let it depend on the webapp-api or domain project? Since you do rest-testing there is no common classpath where the dependency could interfere?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM