[tbot] Example with composite testcase

Harald Seiler hws at denx.de
Thu Nov 22 09:32:31 UTC 2018


Hello Stefano,

On Thu, 2018-11-22 at 10:20 +0100, Stefano Babic wrote:
> Hi Harald, Heiko,
> 
> are there example how a test case can call another test ? It is not
> clear to me.

First, you need to import the python module where your test is defined.
Eg, if you have two files: `tc/tests_a.py` and `tc/tests_b.py`.  If
tests_a defines a testcase `do_foo_bar()`, you can call it in tests_b
like this:

	# tc/tests_b.py
	import tbot
	import tests_a


	@tbot.testcase
	def call_foo() -> None:
	    tests_a.do_foo_bar()

(If the testcase you want to call is in the same source file, just call
 it like a normal function)

> Have you set a repo with a set of common tests ? A "tc" repo would be fine !

I don't have an example repo yet, unfortunately :/ It is on my
ToDo list, I will add one soon(TM)!

> Best regards,
> Stefano
> 

-- 
Harald

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: hws at denx.de


More information about the tbot mailing list