porscheinformatik / cucumber-report-db

Stores results of BDD tests with Cucumber-JVM in a database and provides reporting capabilities
18 stars 21 forks source link

Add custom products #13

Closed maxtar closed 9 years ago

maxtar commented 9 years ago

Can I somehow add my project to the products list? Now they are hardcoded. And I want rename "collection_version" to another name.

klausbayrhammer commented 9 years ago

The name of the collection can be modified by extending the MongoDBFormatter and overwriting at.porscheinformatik.cucumber.formatter.MongoDbFormatter#getCollection. The default implementation just returns "collection_version". By overriding the getCollectionmethod you could return something like "MyProductA_1.0.0" as well. This is, at least, how we currently set the collection names, because we get them from our system under test. But what do you think about changing the default implementation to check a system property for the collection-name?

The menu "products" just links to a filtered list of the collections. But I thought about either removing it or retrieving it dynamically from the DB. But ATM I'd rather remove it since it doesn't provide that much additional functionality.

maxtar commented 9 years ago

Collection name from system properties - ok. Fine variant. Products name will be cool to get from database. :)

maxtar commented 9 years ago

Can you do that instead list of features will list of runs. What if I want run few tests from different features?

klausbayrhammer commented 9 years ago

When you click on a collection on the home-screen you will come to a list of runs. Here you can see a list of four runs (two runs only run the "Basic Arithmetic" feature, one run contains the "Basic Arithmetic Two" feature and one run contains both features.

maxtar commented 9 years ago

Thanx, Klaus. Will try with run by JUnit.

klausbayrhammer commented 9 years ago

@maxtar the products should be loaded via the database. Could you give it a try?

maxtar commented 9 years ago

@klausbayrhammer Sorry for long answer. We are having NewYear holidays till 12 of Jan. I'll try when return to work. :)

maxtar commented 9 years ago

@klausbayrhammer hi. I added -Dcucumber.report.collection.name=project to JVM arguments, but nothing changed. I have only one product - "collection".

klausbayrhammer commented 9 years ago

@maxtar The name of the collection specified by cucumber.report.collection.name has to be in the form productname_version (the underscore is necessary). In commit c96b4c290bb47d44443b18d4a762051b8d36e29e I've added specific system properties for the product name cucumber.report.product.name and product version cucumber.report.product.version.

Now you can specify the name of the collection via

maxtar commented 9 years ago

@klausbayrhammer Sorry, I don't understand. I have set following settings: -Dcucumber.report.product.name=Boor -Dcucumber.report.product.version=MySNAPSHOT -Dcucumber.report.collection.name=FF But in web-interface I see only "Product / Version Statistics collection_version Charts"

klausbayrhammer commented 9 years ago

You have to set the properties for the process you use for your cucumber-tests with the MongoDBFormatter.Like java -cp ..... cucumber.api.cli.Main -f at.porscheinformatik.cucumber.formatter.MongoDbFormatter -Dcucumber.report.collection.name=productA_1.2.0 myFeature.feature

The idea behind this was to have a single web-application which stores all test-results from different products and versions. When you execute your cucumber-tests each test-run knows what product and version is tested and publishes the information to the web-application. So one test-run only tests one product/version but the webapp stores information on test-runs of different products and versions.

Hope to help

maxtar commented 9 years ago

Yes, i have following run string "java -Dcucumber.report.server.baseUrl=http://localhost:8080 -Dcucumber.report.product.name=Boor -Dcucumber.report.product.version=MySNAPSHOT -Dcucumber.report.collection.name=FF -Dfile.encoding=UTF-8 -classpath ... cucumber.api.cli.Main --format at.porscheinformatik.cucumber.formatter.MongoDbFormatter --monochrome --glue ... My.feature"

klausbayrhammer commented 9 years ago

Hm that looks correct. In the webapp you should have a couple of logs like 08:52:40.662 [http-nio-8081-exec-2] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection Boor_MySNAPSHOT Is the collection name in the logs correct? And can you see the data of the new testrun in the webapp?

maxtar commented 9 years ago

No, I see only strings like this: "18:28:19.664 [http-nio-8080-exec-8] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection collection_version 19:40:58.062 [http-nio-8080-exec-9] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection collection_version 19:44:46.530 [http-nio-8080-exec-10] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection collection_version"

klausbayrhammer commented 9 years ago

Is it possible, that you use an older version of the formatter? In c96b4c290bb47d44443b18d4a762051b8d36e29e I've changed the fallback collectionname from "collection_version" to "product_version". So in the current version of the formatter you should see a log like INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection product_version

maxtar commented 9 years ago

Strange. I've got last version yesterday. Will try one more time.

maxtar commented 9 years ago

Sorry. I got it! You have changed version, but I didn't notice these. And didn't change in my pom dependencies. All OK, except I doesn't see collection name from cucumber.report.collection.name property

klausbayrhammer commented 9 years ago

Sorry for the version-change. The collection-name has to be in the form product_version - the underscore is necessary. Like -Dcucumber.report.collection.name=FF_mySnapshotOtherwise the data is filtered and not shown in the webapp.

maxtar commented 9 years ago

Ok. have changed to F_F. Nothing changed.

klausbayrhammer commented 9 years ago

Hm. Do you have a log-entry INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection F_F? Can you see the results of that test-run unter the "collection_version" or "product_version" product?

maxtar commented 9 years ago

No, I haven't. Just "12:13:12.730 [http-nio-8080-exec-9] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection Boor_MySNAPSHOT 12:30:00.902 [http-nio-8080-exec-4] INFO a.p.c.m.r.c.CucumberPluginController - insert report into collection Boor_MySNAPSHOT

klausbayrhammer commented 9 years ago

Hm and you don't see an entry Boor_MySNAPSHOT on the product overview or the entry "Boor" in the product dropdown on the menu?

When you start with -Dcucumber.report.product.name=Boor -Dcucumber.report.product.version=MySNAPSHOT -Dcucumber.report.collection.name=FF the collection name is a combination of product.name and product.version. If you start with -Dcucumber.report.collection.name=F_F the collection-name is F_F.

Do you have any exceptions/stacktraces in the webapp-log?

maxtar commented 9 years ago

Yes. I have "Boor" product in dropdown list. I haven't any exceptions. Am I properly understand that I need set or -cucumber.report.product.name, cucumber.report.product.version or just only cucumber.report.collection.name properties?

klausbayrhammer commented 9 years ago

Yes exactly. You can either specify:

maxtar commented 9 years ago

Iv'e got it, Klaus. I think will be better to add this description to the documentation. :)

klausbayrhammer commented 9 years ago

Glad to hear! You're right all these things should go in the documentation. I'll update the docs tomorrow!