I'm developing a Spring + AngularJS 1.x application. For test automation, I'm thinking to use a functional testing tool like Selenium.
Client side form validation can be easily tested using the tool. But I was wondering how to test server side validation. If AngularJS had some setting, using which client side validation could be disabled, then my same test scripts could be used for server side testing. Otherwise, I think I'll have to write server test scripts using a separate, API testing tool. Not only will that double the effort, but also I 'll have to simulate using CORS, CSRF etc., which might not be a great reality-check.
Like to hear recommendations.
(Note: In AngularJS, if we submit the form even if client side errors are displayed, AngularJS does not populate the fields)
yes you can disable client side validation with some hacking methods like so :
first you need to use JavascriptExecutor
and write a function to remove required attribute from your element(s)
((JavascriptExecutor)driver).executeScript("document.getElementById("city").required = false;");
after running this code your client side validation will disabled , and all validations are coming from server side .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With