1

I just developed a JS program that also uses Jquery. I need to test it programmatically which I don't know how. I'm kinda new to testing and my search results included some software testing tools like JsUnit, Selenium.

How can I test my program?

5
  • Are you asking about tools beyond the browser development tools? Commented Mar 16, 2015 at 6:48
  • No. My program code also includes Jquery, so can I use JS testing tools? My program includes some alert boxes and I don't know how to start! (Like must I develop a testing function and pass true/false values?) Commented Mar 16, 2015 at 6:51
  • try following code check alert() and console in developer tools and debug code in source tab Commented Mar 16, 2015 at 7:15
  • A little less chit-chat (read help→tour) is appropriate. Commented Mar 16, 2015 at 7:35
  • 1
    As it stands, I think your question is too broad for Stackoverflow. You've identified a couple of tools that you can use to test JavaScript, I recommend using Google to search for them with keywords like "tutorial" and "testing JavaScript". (I will say that if you want to test things that block the UI and require user interaction (like alert) then you'll either need something that tests from outside the browser's JS engine (like Selenium) or you'll have to mock alert.) Commented Mar 16, 2015 at 8:33

1 Answer 1

1

1.) Check Jquery and JavaScript result using alert() and console.log() method.
2.) Debug using developer Tools get from right click and select Inspect Element in browser

Try this code

   </head>
   <body>
  <input type="button" value="check" onclick="checkvaild()">         


       <script >

         function checkvaild()
         {
          alert("check");
         console.log("check");
         }
      </script>
   </body>

</html>

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Adding to Kishan's Answer, to obtain developer tools in browser Just Right click on your browser-> Inspect Element
I get that! But the function checkValid() above, was developed by the tester himself, Isn't it? Is there a tool that would create this function and all that the tester has to do is to pass the testing values?
Those are useful techniques for debugging but far, far too manual for testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.