Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using previous written code?

Options
  • 18-01-2013 6:35pm
    #1
    Banned (with Prison Access) Posts: 196 ✭✭


    Howdy, learning the basics of Java

    Can anybody tell me what i should read up on to get a quick idea of using code for automation purposes, for instance:

    I write code/test script to login to a website => this logs me in and gets me to say a home page => on the home page i want to add criteria into fields, all is well.

    However, this would be a different test script, so to proceed on i want to reuse the last script code for logging in. Is this extends class?

    Please point me in the direction of reading material.

    Apologies if this is a stupid question!


Comments

  • Registered Users Posts: 52 ✭✭iFergal


    Try creating an object of your first class in your second class.

    firstClassName objectName = new firstClassName();

    Replace firstClassName with the name of the class with the login code and add arguments to the parameters if your constructor has any. And to use the methods from that class just type as an example - firstClassName.methodName.


  • Registered Users Posts: 27,161 ✭✭✭✭GreeBo


    Have you looked into using something like Cucumber/web driver for automated testing?

    Excellent for checking the behaviour of your site, rather than just running code.

    You can build up scripts to do anything, and then reuse them as you want.
    e.g
    write some code that checks that login works successfully
    write more code to check the home page works, this would resue the login code.

    etc, etc


Advertisement