Getting an error when using Ztest+Twister on nrf5340dk

Hello, 

I am trying to use twister + ztest to run some basic tests on my device custom project and nrf5340

Here are the contents. 
Current Directory Structure

sensor app
|
|----   tests/
|       |------ src/
|               | --- main.c
|       | ----- CMakeLists.txt
|       | ----- prj.conf
|       | ----- testcase.yaml
|       | ----- map.yml


Contents of map.yml

- connected: true
  id: 000051000169 #this is the Serial Number of the JLINK debugger unit. 
  platform: nrf5340dk/nrf5340/cpuapp
  product: J-Link
  runner: nrfjprog
  serial: COM11


Contents of testcase.yaml

tests:
  sensor_app.sensor_app_tests:
    tags: sensor app unit test
    platform_allow: 
      - nrf5340dk/nrf5340/cpuapp
    integration_platforms:
      - nrf5340dk/nrf5340/cpuapp
    harness: console
    harness_config:
      type: multi_line
      regex:
        - "Running test_basic_assertions"
        - "[00:00:00.001,159] <err> Flash_Task: Successfully configured"
    timeout: 600
    # tags: rtt
    extra_configs:
      - CONFIG_RTT_CONSOLE=y
      - CONFIG_USE_SEGGER_RTT=y


Contents of prj.conf

CONFIG_ZTEST=y

Contents of tests/src/main.c

/*
 * Simple Zephyr Test Framework Example
 */

#include "zephyr/ztest.h"
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
/* Define the test suite */
ZTEST_SUITE(sensor_app_tests, NULL, NULL, NULL, NULL, NULL);

LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);
/* Test case 1: Basic assertions */
ZTEST(sensor_app_tests, test_basic_assertions)
{
    LOG_DBG("Running test_basic_assertions\n");
    
    zassert_true(1, "1 should be true");
    zassert_false(0, "0 should be false");
    zassert_equal(1, 1, "1 should equal 1");
    zassert_not_equal(1, 2, "1 should not equal 2");
    
    LOG_DBG("test_basic_assertions PASSED\n");
}


 
Used the configurator tool to modify the JLINK such that the VCOM is enabled and able to see JLINK enumerated in the Device Manager with COM11

twister commands used:

west twister --device-testing --hardware-map=map.yml -p nrf5340dk/nrf5340/cpuapp --west-flash="--recover" -T .\sensor_app\tests\ -vv


Error:
DEBUG - sensor_app.sensor_app_tests.basic_assertions: No status
DEBUG - sensor_app.sensor_app_tests.basic_assertions: No status

From the twister-out directory:

the twister_suite_report: shows untested, no results captured testsuite misconfiguration?

Objective is to run the ztests using twister runner on my customized project - sensor_app
Current connection:
Nrf5340dev kit board connected to laptop via J LINK Debugger. 

Able to do west build and flash + view the logs on the RTT viewer. 
But it fails when i use west twister command
Misc: Using Windows 11, with powershell to run all the above commands. 

Parents
  • Sorry for the delay, I had to change computer for nrfjprog. 

    When you are using 2.7 you can use nrfjprog, it is only depricated in newer version of NCS. 
    I had no issue running the test over RTT with the following sample.yml

    sample:
      description: random test
      name: hello world ztest
    common:
      tags: tests
      integration_platforms:
        - nrf5340dk/nrf5340/cpuapp
      harness: ztest
      harness_config:
        fixture: rtt
    tests:
      sample.ztest.simple:
        tags: tests
    

    It seems strange that you can only enable one peripheral. In general i would presume you would mock it anyway

    Regards

    Runar

Reply
  • Sorry for the delay, I had to change computer for nrfjprog. 

    When you are using 2.7 you can use nrfjprog, it is only depricated in newer version of NCS. 
    I had no issue running the test over RTT with the following sample.yml

    sample:
      description: random test
      name: hello world ztest
    common:
      tags: tests
      integration_platforms:
        - nrf5340dk/nrf5340/cpuapp
      harness: ztest
      harness_config:
        fixture: rtt
    tests:
      sample.ztest.simple:
        tags: tests
    

    It seems strange that you can only enable one peripheral. In general i would presume you would mock it anyway

    Regards

    Runar

Children
No Data
Related