This restriction is necessary for the test to work on the JS platform. Unlike runBlockingTest(), it will wait for asynchronous callbacks to handle situations where some code runs in dispatchers that are not integrated with the test module.Ĭall runTest() only once per test and immediately return its result. runTest() will automatically skip calls to delay() and handle uncaught exceptions. The entry point to the new API is the runTest() function, which you can use on any platform to test code that involves coroutines. The new experimental API also fixed multiple issues with the previously used runBlockingTest() scheme. The testing module received multiplatform support and solved the problem of writing portable tests with suspending functions, which we decided to shift into the library space. A new API and multiplatform support for kotlinx-coroutines-testįollowing our roadmap, we completely reworked kotlinx-coroutines-test. To try them out right away, jump to the How to try it section. In this blog post, we’ll take a closer look at all the new features.
0 Comments
Leave a Reply. |