0

I use gauge and gauge-ts to test APIs with axios. In our project, when test runs, DB is initialized in @BeforeSuite. It was good enough.

Recently I'm trying to run gauge with -p flag, and DB initialize don't work well. @BeforeSuite runs many times(# of parallel streams), DB initialize runs in each, and initialize fails with message Duplicate entry '1000000' for key 'PRIMARY'.

How can I fix test codes and initialize once?

$ gauge -v                                    
Gauge version: 1.4.3
Plugins
-------
html-report (4.2.0)
js (2.4.0)
screenshot (0.1.0)
ts (0.1.0)
class testimpl {
  @BeforeSuite()
  public async setup() {
    // connect to local DB, clear old data, and insert default data
    await clearDB()
    await setupDB()
  }
}

0 Answers0