Login/logout testcase
Hello,
I'm new to soapUI and after reading some documentation and check some tutorials on youtube not being able to do something. I wanna do a login test to a website, what I mean is I wanna check out if with some credentials I can acess the site and then verify if login was succeeded or not.
If that was not clear, please let me know. Really would like some help.
Thank you in advance.
It sounds like you want to do what a browser would do when a user enters login details on a website.
Doing a login on a webpage form isn't the same thing as invoking a RESTful webservice - but there are a lot of similarities. REST isn't actually a protocol - it's more about ideas for how to design a webservice. The underlying protocol is just HTTP. So since SoapUI uses HTTP for REST test steps, in theory you should be able to test the same actions that a browser takes pretty easily using REST test steps, though it could depend on what technologies the website is using. The sending of passwords is rarely is simple as I'm going to explain here. (This is one reason that people have been asking you for specific information about the website you are trying to log into - you don't need to name it but we need to know how it works).
The other possibility is that you're trying to use a REST service, and not a website. In that case you either need somebody to tell you the parameters to put on your request (and whether they go in the URI, in the body, in the headers etc), or you can load a WADL. If you load a proper WADL, SoapUI should be able to generate some test requests with default parameters that you can just update. (Just because you added a URI to your SoapUI project, that doesn't mean you successfully loaded a WADL).
The super basic approach to logging in to a web page:
First get hold of the login page source markup. You could do this just by pointing your favourite browser at the login page and finding a View Source button. Or you can do it in SoapUI as a REST Request to the same address with the method set to GET.
You'll end up with some HTML. Depending on the site it might not be very human readable, but you'll need to look for a form tag. Here's an example one that I stole from here: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_post
<form action="/action_page.php" target="_blank" method="POST"> First name:<br> <input type="text" name="username"> <br> Last name:<br> <input type="text" name="password"> <br><br> <input type="submit" value="Submit"> </form>
Based on the above form, the next step would be to create a new REST request with the resource set to /action_page.php and the method set to POST. You would add parameters "username" and "password" and enter your values there. Then enable the option to Post QueryString.
The response you get will be another HTML. You can look it over yourself to see if it indicates the login was successful, and maybe that's enough for you. Or if you'd like SoapUI to give it a pass or fail each time you run it, you can add an assertion (something like Contains: "Welcome, fgvieria"?)