New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case fails with not clear reason "expected 'true' but was 'true'" with enabled global dictionary #166

Closed
olha-bastieieva opened this Issue Nov 21, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@olha-bastieieva

olha-bastieieva commented Nov 21, 2016

Hi,
I have enabled global dictionary:

<citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary" global-scope="true">
    <citrus:mappings>
        <citrus:mapping path="title" value="citrus:concat('Dictionary1_', citrus:randomNumber(4))"/>
        <citrus:mapping path="body" value="${body}"/>
        <citrus:mapping path="labels[0]" value="dictionary1.test"/>
        <citrus:mapping path="labels[1]" value="dictionary1.bug"/>
        <citrus:mapping path="labels[2]" value="dictionary1.feature"/>
    </citrus:mappings>
</citrus:json-data-dictionary>`

and the test case:

@CitrusTest @Parameters("designer")
public void DesignerSendJSONGetTest(@Optional @CitrusResource TestDesigner designer){
    designer.send("gitHubHttpClientJSON");
    designer.receive("gitHubHttpClientJSON")
            .messageType("json")
            .header("Status", "200 OK")
            .payload("{\n" +
                    "  \"login\": \"defunkt\",\n" +
                    "  \"id\": 2,\n" +
                    "  \"avatar_url\": \"https://avatars.githubusercontent.com/u/2?v=3\",\n" +
                    "  \"gravatar_id\": \"\",\n" +
                    "  \"url\": \"https://api.github.com/users/defunkt\",\n" +
                    "  \"html_url\": \"https://github.com/defunkt\",\n" +
                    "  \"followers_url\": \"https://api.github.com/users/defunkt/followers\",\n" +
                    "  \"following_url\": \"https://api.github.com/users/defunkt/following{/other_user}\",\n" +
                    "  \"gists_url\": \"https://api.github.com/users/defunkt/gists{/gist_id}\",\n" +
                    "  \"starred_url\": \"https://api.github.com/users/defunkt/starred{/owner}{/repo}\",\n" +
                    "  \"subscriptions_url\": \"https://api.github.com/users/defunkt/subscriptions\",\n" +
                    "  \"organizations_url\": \"https://api.github.com/users/defunkt/orgs\",\n" +
                    "  \"repos_url\": \"https://api.github.com/users/defunkt/repos\",\n" +
                    "  \"events_url\": \"https://api.github.com/users/defunkt/events{/privacy}\",\n" +
                    "  \"received_events_url\": \"https://api.github.com/users/defunkt/received_events\",\n" +
                    "  \"type\": \"User\",\n" +
                    "  \"site_admin\": true,\n" +
                    "  \"name\": \"Chris Wanstrath\",\n" +
                    "  \"company\": \"@github \",\n" +
                    "  \"blog\": \"http://chriswanstrath.com/\",\n" +
                    "  \"location\": \"San Francisco\",\n" +
                    "  \"email\": \"chris@github.com\",\n" +
                    "  \"hireable\": true,\n" +
                    "  \"bio\": \"\uD83C\uDF54 \",\n" +
                    "  \"public_repos\": 107,\n" +
                    "  \"public_gists\": 273,\n" +
                    "  \"followers\": 15803,\n" +
                    "  \"following\": 208,\n" +
                    "  \"created_at\": \"2007-10-20T05:24:19Z\",\n" +
                    "  \"updated_at\": \"2016-09-13T19:41:49Z\"\n" +
                    "}")
            .ignore("bio")
            .ignore("followers");
}

And with enabled global dictionary ( global-scope="true") this test fails with strange reason

Values not equal for entry: 'site_admin', expected 'true' but was 'true'

The log:

TEST FAILED TestMessages_1.DesignerSendJSONGetTest2 <com.revenue.integration> Nested exception is: 
com.consol.citrus.exceptions.ValidationException: Failed to validate JSON text:
{"login":"defunkt","id":2,"avatar_url":"https://avatars.githubusercontent.com/u/2?v=3","gravatar_id":"","url":"https://api.github.com/users/defunkt","html_url":"https://github.com/defunkt","followers_url":"https://api.github.com/users/defunkt/followers","following_url":"https://api.github.com/users/defunkt/following{/other_user}","gists_url":"https://api.github.com/users/defunkt/gists{/gist_id}","starred_url":"https://api.github.com/users/defunkt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defunkt/subscriptions","organizations_url":"https://api.github.com/users/defunkt/orgs","repos_url":"https://api.github.com/users/defunkt/repos","events_url":"https://api.github.com/users/defunkt/events{/privacy}","received_events_url":"https://api.github.com/users/defunkt/received_events","type":"User","site_admin":true,"name":"Chris Wanstrath","company":"@github ","blog":"http://chriswanstrath.com/","location":"San Francisco","email":"chris@github.com","hireable":true,"bio":"🍔 ","public_repos":107,"public_gists":273,"followers":15816,"following":208,"created_at":"2007-10-20T05:24:19Z","updated_at":"2016-09-13T19:41:49Z"} Values not equal for entry: 'site_admin', expected 'true' but was 'true'
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:98)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:52)
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:65)
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:50)
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:203)
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:133)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.TestCase.executeAction(TestCase.java:214)
at com.consol.citrus.TestCase.doExecute(TestCase.java:142)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.Citrus.run(Citrus.java:254)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.invokeTestMethod(TestNGCitrusTest.java:124)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:100)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:58)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:209)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.IllegalArgumentException: Values not equal for entry: 'site_admin', expected 'true' but was 'true'
at org.springframework.util.Assert.isTrue(Assert.java:68)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateJson(JsonTextMessageValidator.java:195)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:86)
... 39 more

With disabled global dictionary (global-scope="false") test case passes.

@christophd

This comment has been minimized.

Member

christophd commented Nov 30, 2016

Fixed with #174

@christophd christophd closed this Nov 30, 2016

@christophd christophd removed the IN PROGRESS label Nov 30, 2016

@christophd christophd removed their assignment Nov 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment