Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tests/data/jasmine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Jasmine Runner Usage
=====================

If you want to test this runner from scratch, start by creating a new jasmine project:

```
% npm install --save-dev jasmine jasmine-json-test-reporter
% npx jasmine init
% npx jasmine example
% git add . && git commit -m "Initial commit"
```

Create spec/helpers/jasmine-json-test-reporter.js
```
var JSONReporter = require('jasmine-json-test-reporter');
jasmine.getEnv().addReporter(new JSONReporter({
file: 'jasmine-report.json'
}));
```

Record tests
```
BUILD_NAME=jasmine_build
launchable record build --name ${BUILD_NAME}
launchable record session --build ${BUILD_NAME} > session.txt

# Write all tests to a file
find spec/jasmine_examples -type f > test_list.txt

# Run all tests
npx jasmine $(cat test_list.txt)

launchable record tests --base $(pwd) jasmine jasmine-report.json
```

Request subset
```
cat test_list.txt | launchable subset --target 25% jasmine > subset.txt
npx jasmine $(cat subset.txt)
```

150 changes: 150 additions & 0 deletions tests/data/jasmine/jasmine-test-results-v3.99.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"suite2": {
"id": "suite2",
"description": "when song has been paused",
"fullName": "Player when song has been paused",
"failedExpectations": [],
"deprecationWarnings": [],
"duration": 2,
"properties": null,
"status": "passed",
"specs": [
{
"id": "spec0",
"description": "should be able to play a Song",
"fullName": "Player should be able to play a Song",
"failedExpectations": [],
"passedExpectations": [
{
"matcherName": "toEqual",
"message": "Passed.",
"stack": "",
"passed": true
},
{
"matcherName": "toBePlaying",
"message": "Passed.",
"stack": "",
"passed": true
}
],
"deprecationWarnings": [],
"pendingReason": "",
"duration": 0,
"properties": null,
"status": "passed"
},
{
"id": "spec2",
"description": "should be possible to resume",
"fullName": "Player when song has been paused should be possible to resume",
"failedExpectations": [],
"passedExpectations": [
{
"matcherName": "toBeTruthy",
"message": "Passed.",
"stack": "",
"passed": true
},
{
"matcherName": "toEqual",
"message": "Passed.",
"stack": "",
"passed": true
}
],
"deprecationWarnings": [],
"pendingReason": "",
"duration": 1,
"properties": null,
"status": "passed"
},
{
"id": "spec1",
"description": "should indicate that the song is currently paused",
"fullName": "Player when song has been paused should indicate that the song is currently paused",
"failedExpectations": [],
"passedExpectations": [
{
"matcherName": "toBeFalsy",
"message": "Passed.",
"stack": "",
"passed": true
},
{
"matcherName": "toBePlaying",
"message": "Passed.",
"stack": "",
"passed": true
}
],
"deprecationWarnings": [],
"pendingReason": "",
"duration": 1,
"properties": null,
"status": "passed"
}
]
},
"suite3": {
"id": "suite3",
"description": "#resume",
"fullName": "Player #resume",
"failedExpectations": [],
"deprecationWarnings": [],
"duration": 1,
"properties": null,
"status": "passed",
"specs": [
{
"id": "spec3",
"description": "tells the current song if the user has made it a favorite",
"fullName": "Player tells the current song if the user has made it a favorite",
"failedExpectations": [],
"passedExpectations": [
{
"matcherName": "toHaveBeenCalledWith",
"message": "Passed.",
"stack": "",
"passed": true
}
],
"deprecationWarnings": [],
"pendingReason": "",
"duration": 1,
"properties": null,
"status": "passed"
},
{
"id": "spec4",
"description": "should throw an exception if song is already playing",
"fullName": "Player #resume should throw an exception if song is already playing",
"failedExpectations": [],
"passedExpectations": [
{
"matcherName": "toThrowError",
"message": "Passed.",
"stack": "",
"passed": true
}
],
"deprecationWarnings": [],
"pendingReason": "",
"duration": 0,
"properties": null,
"status": "passed"
}
]
},
"suite1": {
"id": "suite1",
"description": "Player",
"fullName": "Player",
"failedExpectations": [],
"deprecationWarnings": [],
"duration": 4,
"properties": null,
"status": "passed",
"specs": []
}
}
15 changes: 14 additions & 1 deletion tests/test_runners/test_jasmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,26 @@ class JasmineTest(CliTestCase):
@responses.activate
@mock.patch.dict(os.environ,
{"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
def test_record_test_json(self):
def test_record_tests_json(self):
result = self.cli('record', 'tests', '--session', self.session,
'jasmine', str(self.test_files_dir.joinpath("jasmine-test-results.json")))

self.assert_success(result)
self.assert_record_tests_payload('record_test_result.json')

@responses.activate
@mock.patch.dict(os.environ,
{"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
def test_record_tests_without_filename(self):
result = self.cli('record', 'tests', '--session', self.session,
'jasmine', str(self.test_files_dir.joinpath("jasmine-test-results-v3.99.0.json")))

self.assertIn(
"does not appear to be valid format. "
"Make sure you are using Jasmine >= v4.6.0 and jasmine-json-test-reporter as the reporter.",
result.output
)

@responses.activate
@mock.patch.dict(os.environ,
{"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
Expand Down
Loading