My project has already existing end to end scenario using another tool. We are reproducing our scenario using NoraUI. The scenario is reproduced and working but with hard-coded testing data.
We would like to reproduce the dynamic testing data generation we had on our project into this one but it's a quite complicated way to generate them as we have multiple query on our database which can change depending on result of precedents one and other conditions.
It seems at the moment there is only three way to inject data into the scenario:
And this happen through the ScenarioInitiator which is launched at the very beginning of the run.
Is there a way to add a custom way to inject data into a scenario, or for example to generate the data inside the XLSX file before its data are injected without the need of another project ?
In your XxxxxRobot.properties file:
# type of dataProvider (EXCEL, CSV, DB, REST, noraui.data.xxx.YourCustomDataProvider)
dataProvider.in.type=noraui.data.json.CustomJsonDataProvider
dataProvider.out.type=noraui.data.json.CustomJsonDataProvider
Sample of CustomJsonDataProvider class:
package noraui.data.json;
import noraui.data.CommonDataProvider;
import noraui.data.DataInputProvider;
import noraui.data.DataOutputProvider;
import noraui.exception.TechnicalException;
public class CustomJsonDataProvider extends CommonDataProvider implements DataInputProvider, DataOutputProvider {
public CustomJsonDataProvider() {
super();
logger.info("data provider used is ...");
}
@Override
public void prepare(String scenario) throws TechnicalException {
// TODO Auto-generated method stub
}
@Override
public void writeFailedResult(int line, String value) throws TechnicalException {
// TODO Auto-generated method stub
}
@Override
public void writeWarningResult(int line, String value) throws TechnicalException {
// TODO Auto-generated method stub
}
@Override
public void writeSuccessResult(int line) throws TechnicalException {
// TODO Auto-generated method stub
}
@Override
public void writeDataResult(String column, int line, String value) throws TechnicalException {
// TODO Auto-generated method stub
}
@Override
public int getNbLines() throws TechnicalException {
// TODO Auto-generated method stub
return 0;
}
@Override
public String readValue(String column, int line) throws TechnicalException {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] readLine(int line, boolean readResult) throws TechnicalException {
// TODO Auto-generated method stub
return null;
}
}