Build Script Interaction questions

Hello,
Here is my question.
So I am using Team City and I have my Automated UI Tests running on a command line build step to execute the ArtOfTest runner from Telerik (http://docs.telerik.com/teststudio/features/test-runners/artoftest-runner).  
Below is a couple lines from the build log.
The command line does executes all of the provided tests, but it does not identify the individual tests.  
So is adding Service messages the way to identify the test?  
The line that specifically says Executing test: '607...' is the clear indication of when the Test starts.
Then the line following this like Execute Test... is where a subtest for login and navigation.  
So are service messages applicable for this type of use in telling me when a test starts, end, and fails?

[16:50:36]Step 2/2: Run QA Tests Art of Test Runner Command Line admin (Command Line) (1h:26m:56s)

[16:50:37][Step 2/2] Starting: "C:\Program Files (x86)\Telerik\Test Studio\Bin\artoftest.runner.exe" list="C:\Users\ewin.hong\Desktop\buildAgent\work\4356906eeffb0cad\MyVector.AutomatedTest\testlists\myvector_dev.aiilist"

[16:50:37][Step 2/2] in directory: C:\Users\ewin.hong\Desktop\buildAgent\work\4356906eeffb0cad

[16:50:46][Step 2/2] Executing test: '607 U V Update My Profile Page'

[16:50:48][Step 2/2] Execute test 'Load MyVector'

[16:50:48][Step 2/2] Navigate to : '/'

[16:51:25][Step 2/2] IF (Verify ExistsNot 'OverridelinkLink')

[16:51:26][Step 2/2] Wait '5000' msec for url:'MyVector'

[16:51:26][Step 2/2] Click 'UpdateMyH4Tag'


To be honest, I read this documentation (https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity) over and over several times.  But I guess I am missing a piece of information to be effective in what I am trying to achieve.

##teamcity[testStarted name='testName' captureStandardOutput='<true/false>']

In the snippet here, I would like to pass in "607 U V Update My Profile Page" coming from this line into the name parameter.

[16:50:46][Step 2/2] Executing test: '607 U V Update My Profile Page'

Is this possible? Or is there another way to achieve my intent?

6 comments
Comment actions Permalink

Hi Ewin,

Could you please explain what do you mean by
>In the snippet here, I would like to pass in "607 U V Update My Profile Page" coming from this line into the name parameter ?

The example of test reporting (Command Line build step is used):
echo "##teamcity[testSuiteStarted name='Load MyVector']"
echo "##teamcity[testStarted name='testName' captureStandardOutput='true']"
echo "lalala"
echo "##teamcity[testFailed name='testName' message='Error' details='message and stack trace']"
echo "##teamcity[testFinished name='testName' duration='<test_duration_in_milliseconds>']"
echo "##teamcity[testSuiteFinished name='Load MyVector']"

The result looks as follows:
Screen Shot 2015-10-12 at 18.25.43.png
Is it what you need?

0
Comment actions Permalink

From the command line build step, I want to be able to use the information "607 U V Update My Profile Page" in the name parameter like how the below service message looks.

##teamcity[testStarted name='607 U V Update My Profile Page' captureStandardOutput='true']"

Is it possible to interact with the information coming from the command line build step and pass it into the service message?

0
Comment actions Permalink

You can use properties defined in command line build step in service messages:

export TESTNAME=testName1
export SUIT=suit1
echo "##teamcity[testSuiteStarted name='$SUIT']"
echo "##teamcity[testStarted name='$TESTNAME' captureStandardOutput='true']"
echo "##teamcity[testFailed name='$TESTNAME' message='Error' details='message and stack trace']"
echo "##teamcity[testFinished name='$TESTNAME' duration='<test_duration_in_milliseconds>']"
echo "##teamcity[testSuiteFinished name='$SUIT']"

Also you can use service message in your build script to dynamically update build parameters of the build right from a build step:

##teamcity[setParameter name='ddd'
 
value='fff']

The changed build parameters will be available in the build steps following the modifying one. They will also be available as build parameters and can be used in the dependent builds via
%dep.*%
parameter references
.
0
Comment actions Permalink

export TESTNAME=testName1

export SUIT=suit1


I see this snippet here.  

Could you explain this?

Is this a method on declaring a property within the Team City's service messages?

Could I use service message to listen for a particular line from the command line build step and use information from it?

I would not want to create / setup numerous parameters beforehand for the tests I plan to run.

0
Comment actions Permalink

"export TESTNAME=testName1" is a command to define environment variable via command line.
If you want to define build parameters using TeamCity service messages you should use:

##teamcity[setParameter name='ddd'
 
value='fff']


>Could I use service message to listen for a particular line from the command line build step and use information from it?
Not sure that I understand what you want. Service messages are used to pass commands/build information to a TeamCity server from the build script. In order to be processed by TeamCity, they should be printed into a standard output stream of the build.


Also you can pass parameters to the build script using
teamcity.default.properties files from VCS.
0
Comment actions Permalink

The build log puts out information to the log.

I imagine that TC uses this command below to output to the build log even though I did not see this in verbose mode:

##teamcity[progressMessage '<message>']


Is it possible to use information in an object oriented way before it outputs into the log?

Before the information is output to the build log, I would like to interact with the information and then pass it around.

So right before the build log gets this line: [14:33:21][Step 3/14] Executing test: '16329 User View Query Unpaid Enrollments'

I want to use only this information: "16329 User View Query Unpaid Enrollments" in a Test Start service message:

##teamcity[testStarted name='16329 User View Query Unpaid Enrollments'
 
captureStandardOutput='true']


I could use export TESTNAME=16329 User View Query Unpaid Enrollments

##teamcity[testFinished name='%env.testname%']

I would also like to avoid making numerous calls to set a variable or making multiple variables since my groups of test are varying in size.
0

Please sign in to leave a comment.