0

The issue that I am facing is with import of the groovy package. The build error is:

error: package dataProviders.singleOrder does not exist
import dataProviders.singleOrder.NOSDataProvider;

I have a data provider written in groovy:

The groovy file is under: src/test/groovy

package dataProviders.singleOrder;

public class NOSDataProvider implements OrderTypeAndTIF {
    @DataProvider(name="nosDataProvider")
    @Override
    public Object[][] getNOSParameters() {
        def values = []
        char[] sideArray = {};
        char[] tifArray = {};
        char[] orderTypeArray = {};

        for (Side side : [Side.BUY, Side.SELL, Side.SELL_SHORT]) {
            for (TimeInForce tif : [TimeInForce.DAY, TimeInForce.IMMEDIATE_OR_CANCEL, TimeInForce.FILL_OR_KILL]) {
                for (OrdType orderType : [OrdType.LIMIT, OrdType.MARKET]) {
                    values.add(side, tif, orderType);
                }
            }
        }
        return values;
    }
}

The Java files are under: src/test/java/

The Data Provider is injected in the TestNG test case as:

package testcases.testNOS;

import dataProviders.singleOrder.NOSDataProvider;

    @Test(dataProvider = "nosDataProvider", dataProviderClass = NOSDataProvider.class)
    public void testNOS(char side, char tif, char orderType) throws InterruptedException, SessionNotFound {
        NewOrderSingle nos = new NewOrderSingle(new ClOrdID("1"), new HandlInst('1'),
                new Symbol("TCS.NS"), new Side(side), new OrderQty(100.0),
                new OrdType(orderType));
        nos.set(new TimeInForce(tif));
   }
The Roy
  • 2,178
  • 1
  • 17
  • 33
  • Asking for my own knowledge... Why have you written your app in groovy, then used Java for tests instead of something like Spock? – tim_yates Mar 15 '20 at 15:31
  • isn't Spock also a groovy based testing framework? Will try to use it as well. – The Roy Mar 15 '20 at 15:40
  • Ahhh, the issue here is compile order... Move your java class to be under src/test/groovy as well, and it will work – tim_yates Mar 15 '20 at 16:32

0 Answers0