Testing attributes of controls on vbhtml page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mbewers980
    New Member
    • Aug 2012
    • 5

    Testing attributes of controls on vbhtml page

    Hi,

    I have a web page called Benefits.vbhtml written in vbhtml, which contains groups of checkbox controls and am trying to write some tests for it.

    I have a test method written in a separate Javascript file, which I have tried to call the test method from Benefits page when I click a submit button and write some statements to the Visual Studio console to show proof of testing, but nothing happens.

    If you have experience in writing such tests, can you provide a link which shows me how to do get started and go about this the right way as I am lost.

    Thanks
    Matt
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    i'm not quite sure if i get it right - and i'm a bit more unsure if it's possible to write to the VS-console from javascript - but you can write to the firebug- or chrome-console with the console.log() method directly. if u need the javascript-errors/output serverside to trace it somewhere then you can catch it - make an ajax-call and send it back from the client to the server where a service can do with it whatever you want.

    Comment

    • mbewers980
      New Member
      • Aug 2012
      • 5

      #3
      Thanks for your reply gits. A colleague came up with another solution, which I reckon is a bit simpler. Which is

      1. Write your javascript code in your javascript test class.
      2. Use a click button as the input to run the test in the main page, call the method you want in javascript test class, when you click it.
      3. Add a reference to the class in the webpage like so:

      Code:
      <script src="../../Scripts/Benefits3-WithJQuery.js" type="text/javascript"></script>
      and position this at the start of the javascript code in your vbhtml file.

      Regards
      Matt
      Last edited by gits; Aug 31 '12, 07:32 AM. Reason: added code tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        if the question was just to execute the test - then its the way to include the test in the page - of course. i thought the issue was to display something in a console-window.

        so i'm glad you got it sorted.

        Comment

        Working...