scala - How to test objects or other single resources / disable parallel testing with uTest -


https://github.com/lihaoyi/utest

as said in documentation utest runs tests parallel. test cases inside 1 test suite can run sequentially if used

import utest.executioncontext.runnow 

but sbt runs different test suites parallel. https://github.com/lihaoyi/utest#parallel-testing

this performance when testing objects or other "single resources" can cause problems. if same object tested or used in several test suites, these parallel tests may disturb each other.

logging example: logging may use commom factory object , in cases object can contain state default logging level or data structure log instances etc. logging used in several sw modules / in several test suites , if 1 of test suites tests logging other test suites may cause random false results in logging test suite. database example of "single resource".

is there way limit parallel running of utest test suites user can decide test suites run sequentially , test suites can run parallel?

e.g: run test suites: com.xxx.yyy.mytestsuitea, com.xxx.yyy.mytestsuiteb , com.xxx.yyy.mytestsuitec sequentially (in order) , rest parallel (d-z).

sbt "script" not solution

sbt testonly com.xxx.yyy.mytestsuitea sbt testonly com.xxx.yyy.mytestsuiteb sbt testonly com.xxx.yyy.mytestsuitec sbt testonly com.xxx.yyy.mytestsuited sbt testonly com.xxx.yyy.mytestsuitee sbt testonly com.xxx.yyy.mytestsuitef ... 

because nothing run parallel , must list test suites. might good:

sbt test -- sequentially com.xxx.yyy.mytestsuitea, com.xxx.yyy.mytestsuiteb, com.xxx.yyy.mytestsuitec 

meaning rest can run parallel , in whatever order. or

sbt test -- sequentially  

meaning test suites run sequentially

here quick fix can add project build file, can used complete sequential execution.

parallelexecution in test := false 

quoting actual documentation.

disable parallel execution of tests¶ default, sbt runs tasks in parallel. because each test mapped task, tests run in parallel default. make tests within given project execute serially:

scala parallelexecution in test := false test can replaced integrationtest execute integration tests serially. note tests different projects may still execute concurrently.

for other use case, suggest try tagging tests , running tagged tests exclusively.

tags.exclusive(benchmark) 

refer doc more information here.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -