Forum Discussion

skyhigh's avatar
skyhigh
Contributor
7 years ago
Solved

Testing for login failure

Hi,

 

I'm new to both SOAP testing and SmartBear test tools.  Right now I'm creating the failure test case for login.  The test case uses "Get" API that has parmaters username and password.  For the test case assertion, I use "JSONPath Expression" and the expression is $['IsSuccessful'].  If login is good then the expected result is "true".  However I would like to validate for the failure password so if  the login fails, it should return false as expected result.  so after I put "false" as the expected value and the password parameter I just use random text.  But after I execute the test suite, that test case results as fail instead of pass.  What did I do wrong?  thanks.

  •  

    200 OK is a standard status code for successful HTTP requests. Content-Length: 0 indicates that no JSON data was in the response so likely to be a problem with the service not the test step or assertion.

15 Replies

    • skyhigh's avatar
      skyhigh
      Contributor

      Great! thank you for responding to my question.

       

      Not sure if JSON below is what you're asking for.  But this is JSON data from the Response section.

      {
      "ErrorMessage": "",
      "IsSuccessful": true,
      "Data": null,
      "IsRedirect": false,
      "RedirectUrl": ""
      }

       

      Please note the JSON above, I took it from other login test case that passes the test run.  As for the test case that I'm asking for help to test the login failure, it does not have JSON data under Response section.

       

      thanks 

      • nmrao's avatar
        nmrao
        Champion Level 3
        skyhigh, do you get the similar response with "IsSuccessful": false on login failure? And that is expected?
  • Hello, maybe I'm coming in late. How do you post the username and the password? I'm not getting on how to do the login using soapUI.

     

    It would be great if you could help me, because I also need to check if login was sucessfull or not.

     

    Thanks in advance!

    • skyhigh's avatar
      skyhigh
      Contributor

      To pass username and password into GET, make sure you're in SoapUI NG tab because there are Dashboard, Projects, SoapUI NG, Secure, LoadUI NG, and Service V.  But in SoapUI NG tab allows you to create parameter.  There should be plus sign to add parameter.  For the parameter input fields, there will be the Name and Value of the parameter so just enter username and password.

       

      Since the product that I have tested, the Login API returns back when login successful so I can check the return call of JSON.  However the developers in my team feel afraid of security risk for returning back the value when login failed so they decided not to return anything.

  • Hello mate,

     

    I was testing a website which I would have to log in to acess some features. I have the open source product, I already did that with the get and add parameters. But when I run it, it just stays in the login page, doesn't login at all to the next page.

     

    Could you help ?

    • skyhigh's avatar
      skyhigh
      Contributor

      You probably have to look at different test option which I'm not sure how to do that in SmartBear SoapUI.  I use this tool to test web API only so all of my test cases don't really launch any web application.  It seems to me you're testing GUI as well.  Maybe someone here knows how to test GUI with SoapUI otherwise SpecFlow with Selenium.

       

      Goodluck...