0

At our organization we are following this DSL model Domain specific language and stuff where users can write tests from a spreadsheet and the underlying java code understands and executes those instructions.

Now here is the problem. We have a single test method in our class which uses a data provider, reads all the test methods from the file and executes the instructions.

Naturally, when surefire executes and prints results it says: Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Is there a way to manipulate this in TestNG such that each custom test metod from excel can be picked up by the system as a legitimate test method when the overall suite executes.

I actually made the group migrate from Junit to TestNG and they are questioning if the DataProvider feature can handle that and i have no response for it :(

So essentially we want to break bindings between java methods by using external data providers but at the same time preserve the number of test methods executed as provided in an excel spreadsheet. If you can give me any direction it would be most helpful to me. Attaching my spreadsheet here.

My java file has only 1 test method:

@test
RunSuite(){

  // Read each test method from file, i want the build server to recognize them someway as a individual test methods
}
Korpel
  • 2,432
  • 20
  • 30
Shreejit
  • 11
  • 4
  • To be more specific , if a business user enters a test name say Login in the excel file, i would like Testng to dynamically understand it as a test method so Maven reports the number of tests passed as what has been passed in Excel and not default report to a single test method – Shreejit Nov 05 '15 at 21:49
  • As you have your own excel based test framework, why do you need another one like junit or testng? – juherr Nov 06 '15 at 02:47
  • Juherr, We are using TestNG to drive our tests using data provider and other reporting features. Anyways, the issue was with getting the excel test method rounds to be recognized as an individual test method during the data provider execution. I figured that out. Thanks – Shreejit Nov 13 '15 at 19:24
  • You should provide a more concrete example of what you have and what you want, and/or what is working and what is not working. Then, how do you run TestNG? It would be helpful to provide a concrete little example too (maybe on github?) – juherr Nov 13 '15 at 19:44
  • Hi Juherr, TestNG is run as a single @test method which has a dataprovider that reads an excel spreadsheet with the operations that need to be performed. @DataProvider(name = "CRIS_TESTDATA") public Object[][] createTestSuite() throws Exception { return getTestSuite(moduleName + TEST_SUITE_FILE_SUFFIX); } @Test(dataProvider = "CRIS_TESTDATA") public void runTestSuite(Map dataMap) throws Exception { testSuite(dataMap); } – Shreejit Nov 13 '15 at 21:46
  • The goal of `@Test` method is to run one single test. `@Suite` doesn't exist. Your data provider has to extract tests instead of suites, when your test method has to run them. – juherr Nov 14 '15 at 05:03
  • Thanks Juherr, In our case the business users write tests in excel and the way dataprovider is configured is to behave like each test written in excel is an individual test method. By moving around how the test method accepts the parameters we got this working. – Shreejit Nov 15 '15 at 16:27

0 Answers0