STAMP-project / dspot

Automatically detect and generate missing assertions for Junit test cases (also known as test amplification)
https://dspot-demo.stamp-project.eu/
GNU Lesser General Public License v3.0
114 stars 28 forks source link

demo web interface for DSpot #801

Open monperrus opened 5 years ago

monperrus commented 5 years ago

we can have a demo web interface for DSpot. there would be two input fields: URL to a repo and email. People would submit their repo, Dspot would be run on the latest version, and the result email would be sent.

This is directly inspired by http://commit.guru/ (the code is online, we may reuse it)

Under discussion at KTH.

gibello commented 5 years ago

If based on the maven plugin, I have part of the code: a (not yet committed, still some pending issues) dspot invoker, and a Git cloner already committed in stamp-ci (https://github.com/STAMP-project/stamp-ci/blob/master/stamp-cicd-utils/src/main/java/eu/stamp_project/cicd/utils/git/GitCloner.java ).

monperrus commented 5 years ago

excellent, good to know.

not yet committed, still some pending issues looking forward to it.

danzone commented 5 years ago

Consider to use also the code developed by @luandrea, based on EGit Eclipse library (Luca also contributed to this library, adding support for web proxies: his contribution now is officially part of Eclipse library): https://github.com/STAMP-project/botsing-github-app/blob/master/src/main/java/eu/stamp/botsing/service/GitHubService.java In this class you can reuse several methods to open, for instance, pull requests on Github repo, containing the amplified unit tests.

monperrus commented 5 years ago

https://github.com/STAMP-project/botsing-github-app/blob/master/src/main/java/eu/stamp/botsing/service/GitHubService.java

Will be super useful, could you document its usage with some snippets or test cases?

gibello commented 5 years ago

Same kind of code here, but for Gitlab: https://github.com/STAMP-project/stamp-ci/blob/master/stamp-cicd-utils/src/main/java/eu/stamp_project/cicd/utils/git/GitlabIssueManager.java . Has comments + javadoc available. The GitHubService code could be moved to stamp-ci, I think... For the same reason I was requested to move my code there (it is of common use).

danzone commented 5 years ago

Dear @monperrus , at the moment some integration tests show how it works: https://github.com/STAMP-project/botsing-github-app/blob/master/src/test/java/eu/stamp/botsing/service/GitHubServiceTestIT.java Anyway, we will consider to write some documentation on it.

monperrus commented 5 years ago

Thanks a lot for the input material.

monperrus commented 5 years ago

FYI @tailp is working on this.

henry-lp commented 5 years ago
* could you post a temporary screenshot here?

This is a basic layout for the web page :). screenshot1 screenshot2 screen3 screenshot4

danzone commented 5 years ago

That's very interesting @Tailp ! Looking forward to see your progresses, and of course I will stay at your disposal in case you need some help on the code we referenced previously in this thread.

henry-lp commented 5 years ago

Thank you :). I'll contact you when that's the case .

danzone commented 5 years ago

Another source of info: two years ago I started to design REST API to expose STAMP as a service. But the project progressed in another direction, and those APIs was abandoned. They are already available at https://app.swaggerhub.com/apis/stamp-project/stamp-api/0.2.0 The idea was to upload test cases to amplify as a zip, base 64-encoded file, and amplified tests would be sent back with the same format (zipped and base64 encoded). The APIs contain example with real data: the base 64 values you will find are real test cases (both the test cases sent to DSpot and test cases generated by DSpot). I generated them executing locally into my laptop, and the used as example for the APIs.

danglotb commented 5 years ago

Hello @Tailp

That looks very nice! Thank you.

danzone commented 5 years ago

Another source of info: two years ago I started to design REST API to expose STAMP as a service. But the project progressed in another direction, and those APIs was abandoned. They are already available at https://app.swaggerhub.com/apis/stamp-project/stamp-api/0.2.0 The idea was to upload test cases to amplify as a zip, base 64-encoded file, and amplified tests would be sent back with the same format (zipped and base64 encoded). The APIs contain example with real data: the base 64 values you will find are real test cases (both the test cases sent to DSpot and test cases generated by DSpot). I generated them executing locally into my laptop, and the used as example for the APIs.

henry-lp commented 5 years ago

@danzone thank you very much. That sounds very interesting :). Currently I am stuck with another task on repairnator, but I'll surely take a look when I am back to Dspot again :) .

henry-lp commented 5 years ago
* could you create a WIP pull-request?

@monperrus currently I already have a fork for the dspot-Kubernetes task. So I won't be able to fork again and make a PR until that's is done :) . I'll continue working offline in the mean time.

monperrus commented 5 years ago

Note that it's possible to have as many parallel forks and PRs as you want.

monperrus commented 5 years ago

@tailp, per our meeting today, in your own fork, you have one branch per pull request.

danglotb commented 5 years ago

@Tailp I merged #847

I have some questions about it:

  1. Is the provided URL for the example, i.e. http://35.246.191.225:3000/, accessible from everywhere? I tried but could not reach it. (but might an issue on my side)
  2. The README shows:
    cd dspot-web
    npm install --no-optional
    npm run-script start

    But what should I do after running the last command to see the web interface?

Thank you, and great job!

henry-lp commented 5 years ago

@danglotb Hi :) , ah I think my Kubernetes cluster is running on europe-west3-c , maybe it's not accessible in France. I'll tell the guy resposible for the KTH K8s cluster to deploy it so that it also works at your place.

Meanwhile you can run it yourself locally. After the readme , you'll need 3 more things mongodb, activeMQ and our dspot-pipeline dockerimage (local updates not yet pushed here, related to this #852).

docker run -d --net=host mongo:4.0.11-xenial
docker run -d --net=host webcenter/activemq:5.14.3
docker run  --net=host tailp/dspot-pipeline

The last one is left running undetached since what happens after someone submit a git url is interesting :). You can now access the page at localhost:3000 and submit an url like this random repo on the internet "https://github.com/jenkins-docs/simple-java-maven-app" which will succeed or "https://github.com/STAMP-project/dspot" , which will give you an amplification failed since multi modules autoconfig are not yet supported :) . Otherwise just ping me if you encounter any bugs, I'll fix and update the docker image.

gluckzhang commented 5 years ago

Hi @danglotb , @monperrus , we just successfully deployed the DSpot web demo in our cluster. You could use this link to test: http://dspot.kth-assert.net/ (which should be avaliable everywhere)

As some project will keep DSpot running for quite a long time, we set up a 10 minutes timeout in the current deployment. Feel free to ping me or @Tailp if you have any questions :)

monperrus commented 5 years ago

847 is a milestone PR for this. we keep this issue open because we continue the work, esp with @borisbaldassari

monperrus commented 5 years ago

It would be great to have syntax highlighting in the test cases sent over email.