Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

[Jasmine 2] Results of assertions are not getting added in protractor json output file #2051

Closed
raghulraj opened this issue Apr 15, 2015 · 4 comments

Comments

@raghulraj
Copy link

Hi,

I am using "resultJsonOutputFile" to write my test results in json format. Recently i have migrated to Jasmine2.0, but after that, assertions results are always empty in the json output.

eg below:

[
{
"description": "my_test",
"assertions": [],
"duration": 6811
}
]

I have tried upgrading jasmine-expect 2.0.0-beta1 , but still getting same result.

@raghulraj raghulraj changed the title Results of assertions are not getting added in protractor json output file [Jasmine 2] Results of assertions are not getting added in protractor json output file Apr 15, 2015
@juliemr
Copy link
Member

juliemr commented Apr 16, 2015

We have many tests that use jasmine2 and resultJsonOutputFile, so this is nota general issue. I'm not familiar with the jasmine-expect module, but that may be causing your issues.

If you can create a reproducible example that shows your problem, please feel free to open up a new issue. Otherwise, I'm closing as not reproducible.

@juliemr juliemr closed this as completed Apr 16, 2015
@raghulraj
Copy link
Author

Hi Julie Ralph,

The issue was with assertions for only passed test cases. failed cases are perfectly fine. Before adding Jasmine2 as framework in config, i used to get assertions results for passed ones too. eg: below

[
    {
        "description": "test1",
        "assertions": [
            {
                "passed": true
            }
        ],
        "duration": 43041
    }
]

But after adding framework: jasmine2, the resultjsonoutput looks like this.

[
    {
        "description": "test1",
        "assertions": [],
        "duration": 12251
    },
    {
        "description": "test2",
        "assertions": [
            {
                "passed": false,
                "errorMsg": "Failed: No element found using locator: By.cssSelector(\".search-box-desktop1\")",
                "stackTrace": "Error: Failed: No element found using locator: By.cssSelector"
            }
        ],
        "duration": 14724
    }
]

Only changes I have added is framework change in config. So I am confused with output now.

@juliemr
Copy link
Member

juliemr commented Apr 16, 2015

That's true, there is an inconsistency here. Jasmine2 has a different system for what gets passed to reporters, so the output has changed slightly. I'll make an update, but is there any reason this is a problem? No assertions means everything passes.

@raghulraj
Copy link
Author

Thanks @juliemr for the quick fix. I had written an custom reporter for my test executions that relies on assertions. I have considered no assertions as invalid test cases. So i need to have assertion results in the result output.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants