Home Corporate Contacts

TETware Knowledgebase


Products
Solutions

Information

Datasheet
Documentation
FAQ
Knowledgebase

Return to Knowledgebase Index

38. How to process a scenario that contains test cases that use different APIs

 

Question

Is it possible to define a scenario that contains test cases that use different APIs? In particular, Java test cases must be executed by a Java-specific exec tool which cannot execute test cases that use other APIs.

 

Answer

tcc is able to process scenarios that contain a mixture of test cases. The issue to be resolved is how to arrange for the build, exec and clean tools to recognise the different types of test case and process them accordingly.

In build and clean mode it is probably best to provide a makefile to build each test case. The Java build tool could be invoked from the makefiles that build the Java test cases.

In exec mode, one way to handle this is to have a top-level exec tool which switches on the name of the test case being executed and invokes an appropriate language-specific exec tool. Of course, only the Java exec tool is mandatory - the others are optional.

If you do this you need to organise the test suite in a way that the exec tool understands. For example, you might define a directory hierarchy which looks like this:


tset/
	c-tests/
		. . .
	shell-tests/
		. . .
	perl-tests/
		. . .
	java-tests/
		. . .



Then you could use a top-level exec tool that looked something like this:

#!/bin/sh
# top level exec tool which may invoke a language-specific exec tool
# depending on test case name

# extract the name(s) of the language-specific exec tool(s) and their # optional argument(s) from the config file C_EXEC_TOOL= C_EXEC_FILE= SHELL_EXEC_TOOL= SHELL_EXEC_FILE= PERL_EXEC_TOOL= PERL_EXEC_FILE= JAVA_EXEC_TOOL= JAVA_EXEC_FILE= eval "`sed -n 's/#.*// /^[ ]*\$/d /^[A-Z]*_EXEC_[A-Z]*=/s/\([^=]*\)=\(.*\)/\1="\2"/p' ${TET_CONFIG:?}`"

# determine the name of the test case to execute tcname=${1:?} shift

# work out if we can execute the test case directly # or should invoke a language-specific exec tool and optional # tool argument cmd= case $tcname in */c-tests/*) if test -z "$C_EXEC_TOOL" then cmd=./$tcname else cmd="$C_EXEC_TOOL $C_EXEC_FILE $tcname" fi ;; */shell-tests/*) if test -z "$SHELL_EXEC_TOOL" then cmd=./$tcname else cmd="$SHELL_EXEC_TOOL $SHELL_EXEC_FILE $tcname" fi ;; */perl-tests/*) if test -z "$PERL_EXEC_TOOL" then cmd=./$tcname else cmd="$PERL_EXEC_TOOL $PERL_EXEC_FILE $tcname" fi ;; */java-tests/*) if test -z "$JAVA_EXEC_TOOL" then echo "$0: JAVA_EXEC_TOOL is null or not set" 1>&2 exit 1 else cmd="$JAVA_EXEC_TOOL $JAVA_EXEC_FILE $tcname" fi ;; *) echo "$0: can't determine test case type: $tcname" 1>&2 exit 1 ;; esac

# finally, execute the test case or tool exec $cmd ${1:+"$@"}




In the execute mode configuration you would define TET_EXEC_TOOL to be the name of this file. Then if required you could define one or more of C_EXEC_TOOL, C_EXEC_FILE, SHELL_EXEC_TOOL, SHELL_EXEC_FILE, PERL_EXEC_TOOL, PERL_EXEC_FILE, JAVA_EXEC_TOOL, and JAVA_EXEC_FILE in the execute mode configuration. Only the JAVA_EXEC_TOOL is mandatory; the others are optional.

 

See also

  • "The Test Case Controller'' and "Configuration variables which modify TETware's operation'' in the TETware Programmers Guide.

 


Home Contacts Legal Copyright Corporate News

Copyright © The Open Group 1995-2012, All Rights Reserved