Reputation: 11
I am trying to follow the way as mentioned in wiki page. I am not aware of Json. Just followed wiki page https://wiki.jenkins.io/display/JENKINS/Tests+Selector+Plugin
Have few queries . How to link your test case (either in java or python) to testcase mentioned in properties file? I plan to do it for python testcases.
Below is my properties file:
tests=
[{"enabled":true,"owner":"name","testgroup":"A","testcase":"NewTest.testCase1"},{"enabled":true,"owner":"name","testgroup":"B","testcase":"NewTest.testCase2"}]
enableField=enabled
groupBy=testgroup
fieldSeparator=.
showFields=testsuite,testcase
multiplicityField=multiplicity
NewTest is my class with testCase1 and testCase2 as methods.
In Jenkins , its listing as Null.NewTest.testCase1
.
Obviously i missed something. Can someone explain how it works internally? how the class methods get called without explicitly creating class instance?
Upvotes: 1
Views: 455
Reputation: 4358
Question is a bit unclear, but I think I understand. To answer how to link testcase in properties to actual python or java test . . .
The test selector provides the selected tests in a json array to other configured plugins which run in the Build part of job. The content of testcase or other vars needs to match what the configured test execution method expects.
e.g. the selected tests are provided in an environment variable to shell script if the Execute Shell method is configured to run in Build. "Choose tests for Environment variable TESTS :" $TESTS will be set containing the selection. $TESTS contains json style string of selected tests.
e.g.
e.g.
The properties file looks like this:
tests=[{"enabled":true,"owner":"OWN","testdir":"t/t/a","testfile":"test_a","testclass":"TestA","testname":"test_a","testcount":1},{"enabled":true,"owner":"OWN","testdir":"t/t/a","testfile":"test_b","testclass":"TestB","testname":"test_b","testcount":1}]
enableField=enabled
groupBy=testdir
showFields=testclass,testname
multiplicityField=testcount
fieldSeparator=.
And the TESTS var passed to shell script execution looks like this (of course with or without tests depending on what was selected):
'[{"enabled":true,"owner":"OMN","testdir":"t/t/a","testfile":"test_a","testclass":"TestA","testname":"test_a","testcount":"1"},{"enabled":true,"owner":"OMN","testdir":"t/t/b","testfile":"test_b","testclass":"TestB","testname":"test_b","testcount":"1"}]'
Upvotes: 0
Reputation: 11
you need to specify a testsuite. in your case "testsuite":"NewTest", "testcase":"testCase1"
Upvotes: 1