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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Using previous written code?

  • 18-01-2013 5: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, Registered Users 2 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, Registered Users 2 Posts: 27,366 ✭✭✭✭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