Skip to content

Commit

Permalink
[event-protocol] Add VCS attribute to test-run-started
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpros committed May 5, 2017
1 parent be6683b commit 7b94745
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion event-protocol/examples/events.ndjson
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{"pickle":{"language":"en","locations":[{"column":3,"line":2}],"name":"World","steps":[{"arguments":[],"locations":[{"column":11,"line":3}],"text":"a step"}],"tags":[]},"type":"pickle","uri":"features/hello.feature"}
{"type":"attachment","source":{"uri":"features/hello.feature","start":{"line":3,"column":7}},"data":"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAELUExURUdwTACoGAClFACqHACoFwCnGQCnFQCnGACoGQCoGQCoGACuGgCnFwCiFwCoGACoGACnFwClFgCpGACoFwD/AACnGAC2JACoGACnFwCqKgCoGACoGACqGQCoFwCnFwCoFwB/AACnGACoGAC/AACoGACoFgCmFwCnFwCnFwCqFgCmFgCZAACoGC64Ql3IbA2sJBuxMBiwLhewLR2yMgmrIOn36/z+/BGuJ9/04rHkuIDUjGHJcA6tJeD04wGoGQusIpnco+T257PlugSpHN704XDOfQeqHiCzNc7u0+z57t3z4HvSh7fmvj69UJzdpSi2PNjy3AKpGlrHahqxMBCtJpHZm83u0jS6R0vCXEWczDEAAAAsdFJOUwDIJQlYPSP7cFCqE1cW+mf4ImiBAXQHPu8GfP0zzoyOAp2wBOg4a2PqOU4FxgPjdgAAAK9JREFUGNNNj1UCwkAMRBcotLi7uw1S3N3d4f4nYSvIfO28bCYJIaI0OSabJ1+pFaDKpD4+zUJS1CHVWSwer+esDNhEQP+fV/f5uAd4XEIesNldl5WK0KSlQAtcDkc5xUcBA+y3tL/UKQIhCpLA+sTzw1K7UQVHQTyB23QyKraaNSAgTOGAQb9bqBeAoDg2EpMT4XdLm3rD8qrO7zFWO7UW8+86oodJp/zzRGUwyq83Mjcb8VXl0ZMAAAAASUVORK5CYII=","media":{"encoding":"base64","type":"image/png"}}
{"type":"attachment","source":{"uri":"features/hello.feature","start":{"line":3,"column":7}},"data":"Exception in thread \"main\" java.lang.NullPointerException\n at com.example.myproject.Book.getTitle(Book.java:16)\n at com.example.myproject.Author.getBookTitles(Author.java:25)\n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)\n","media":{"encoding":"utf-8","type":"text/vnd.cucumber.stacktrace.java+plain"}}
{"type":"test-run-started","workingDirectory":"/Users/matt/projects/cucumber-ruby","timestamp":1489683458}
{"type":"test-run-started","workingDirectory":"/Users/matt/projects/cucumber-ruby","timestamp":1489683458,"vcs":{"git":{"head":"be6683b9004a5785ca9b51776b98694dfe406fb6","diff":"diff --git a/event-protocol/schemas/test-run-started.json b/event-protocol/schemas/test-run-started.json\nindex 6fa0e39..48efe9a 100644\n--- a/event-protocol/schemas/test-run-started.json\n+++ b/event-protocol/schemas/test-run-started.json\n@@ -12,7 +12,27 @@\n },\n \"timestamp\": {\n \"type\": \"number\"\n+ },\n+ \"vcs\": {\n+ \"type\": \"object\",\n+ \"properties\": {\n+ \"git\": {\n+ \"type\": \"object\",\n+ \"properties\": {\n+ \"head\": {\n+ \"type\": \"string\"\n+ },\n+ \"diff\": {\n+ \"type\": \"string\"\n+ }\n+ }\n+ }\n+ }\n }\n },\n+ \"required\": [\n+ \"type\",\n+ \"timestamp\"\n+ ],\n \"additionalProperties\": false\n }\""}}}
{"type":"test-case-prepared","sourceLocation":{"uri":"features/passing.feature","line":2},"steps":[{"actionLocation":{"uri":"/Users/matt/projects/cucumber-ruby/lib/cucumber/filters/prepare_world.rb","line":28},"sourceLocation":{"uri":"/Users/matt/projects/cucumber-ruby/lib/cucumber/filters/prepare_world.rb","line":28}},{"actionLocation":{"uri":"features/passing.feature","line":3},"sourceLocation":{"uri":"features/passing.feature","line":3}}]}
{"type":"test-case-started","sourceLocation":{"uri":"features/passing.feature","line":2}}
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/passing.feature","line":2}},"index":0}
Expand Down
8 changes: 7 additions & 1 deletion event-protocol/examples/events/005_test-run-started.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"type":"test-run-started",
"workingDirectory":"/Users/matt/projects/cucumber-ruby",
"timestamp":1489683458
"timestamp":1489683458,
"vcs": {
"git": {
"head": "be6683b9004a5785ca9b51776b98694dfe406fb6",
"diff": "diff --git a/event-protocol/schemas/test-run-started.json b/event-protocol/schemas/test-run-started.json\nindex 6fa0e39..48efe9a 100644\n--- a/event-protocol/schemas/test-run-started.json\n+++ b/event-protocol/schemas/test-run-started.json\n@@ -12,7 +12,27 @@\n },\n \"timestamp\": {\n \"type\": \"number\"\n+ },\n+ \"vcs\": {\n+ \"type\": \"object\",\n+ \"properties\": {\n+ \"git\": {\n+ \"type\": \"object\",\n+ \"properties\": {\n+ \"head\": {\n+ \"type\": \"string\"\n+ },\n+ \"diff\": {\n+ \"type\": \"string\"\n+ }\n+ }\n+ }\n+ }\n }\n },\n+ \"required\": [\n+ \"type\",\n+ \"timestamp\"\n+ ],\n \"additionalProperties\": false\n }\""
}
}
}
20 changes: 20 additions & 0 deletions event-protocol/schemas/test-run-started.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,27 @@
},
"timestamp": {
"type": "number"
},
"vcs": {
"type": "object",
"properties": {
"git": {
"type": "object",
"properties": {
"head": {
"type": "string"
},
"diff": {
"type": "string"
}
}
}
}
}
},
"required": [
"type",
"timestamp"
],
"additionalProperties": false
}

2 comments on commit 7b94745

@aslakhellesoy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe vcs info should be a separate event. Could be interesting to know for a "gherkin lint" pass too, but in that case there is no "test run"

@aslakhellesoy
Copy link
Contributor

@aslakhellesoy aslakhellesoy commented on 7b94745 May 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same goes for workingDirectory. Maybe those two could be grouped in an environment event?

{
   "workingDirectory": "....",
   "vcs": {},
   "os": {}
}

WDYT?

Please sign in to comment.