Skip to content

Writing Unit Tests for Twister2

Chathura Widanage edited this page Oct 16, 2019 · 4 revisions

How to write a Test

We are using Java JUnit for Unit testing.

We can write a test as a normal JUnit test.

How to run a unit test

We need to invoke the following command

bazel test --config=ubuntu twister2/comms/tests/java/edu:UnifiedSerializerTest

How to load Config from yaml files to unit tests

  1. Add, load("//tools/rules:twister2_client.bzl", "twister2_client_common_files") to the BUILD file.
  2. Add classpath_resources = twister2_client_common_files(), to the java_tests rule.
  3. Use ConfigLoader.loadTestConfig()