0

I am using selenium with page object pattern. And I am using property file for keeping the test data , not scattering all over the script.

Here is my code

package propertytest;

import org.testng.annotations.Test;
import pageobjects.HomePage;
import steps.LoginSteps;
import util.DriverManager;

import java.io.IOException;

public class ReadFileData extends DriverManager
{


    public ReadFileData() throws IOException {
    }

    @Test
    public void initDriver() {
        //Arrange
        HomePage page = new LoginSteps().Login(prop.getProperty("nam"), prop.getProperty("pas"));

    }


    }


config.properties

baseurl=http://qms
nam=nab
pass=699
nam=gg
pas=677
nam=kkh
pas=7987

Is it possible to pass entire test data in one config.properties file. Is it possible ?

  • 1
    Please do not ask near-duplicate questions when your other questions have been put on hold. You would be better off editing the original question to fix the problems that caused it to be put on hold in the first place. – Kate Paulk Feb 2 '17 at 12:32
1

Yes, it is possible. Have a look at jUnit theories and datapoints.

A theory test is a test that is repeated for each datapoint. In your case you could load your properties into data points in make the test repeat it self for each entry.

Reads:

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.