Intermec Home

How to Buy | Partner Login


Developers Forum

Showing results for 
Search instead for 
Do you mean 
Reply
Contributor
calebeskurdal
Posts: 12
Registered: ‎October 3 2011
0
Accepted Solution

Vocollect Libraries

Hi,

I'm trying to get the automated testing working using the built in python tests in VoiceLink Voice Application 4.0.1. There are multiple import errors that are keeping it from running. These seem to stem from imports failing. Here are two specific ones:

 

- In the Base.VLTestCase.py file on the first import (from base_test_case_server import BaseTestCaseServer):

Unresolved import: BaseTestCaseServer
BaseTestCaseServer Found at: BaseVLTestCase

from base_test_case_server import BaseTestCaseServer

 

- When running the build.xml all_tests:

BUILD FAILED
C:\workspace\VoiceLink Voice Application 4.0.1\build.xml:32: C:\workspace\Vocollect Core Library 1.1.0\lib not found.

 

I have v1.1 of the Vocollect Core, HTTP, and LUT ODR libraries installed. The Voice Application is 4.0.1 (not SP1)

 

Any help would be appreciated.

 

Regards,

Caleb Skurdal

Intermec
ddoubleday
Posts: 115
Registered: ‎September 21 2011
0

Re: Vocollect Libraries

First, try Project...Clean...All Projects to force a rebuild. Easy thing to try first.

 

If that doesn't fix it: the library plugins not only have to be installed, but they have to be extracted into your workspace as well. 

 

If you have them in your workspace, right click on the VoiceLink project and select Properties. Look at the Project References and make sure they are all being referenced correctly.

 

If you aren't seeing errors in Eclipse, but only when running tests, maybe  something is wrong in your antbuild.properties file.

 

Another possibility is that you aren't seeing errors because you haven't turned off PyDev Navigator content in the Project Explorer. See the release notes for VoiceArtisan in the Eclipse help system to find the procedure for doing that.

Intermec
mkoenig
Posts: 110
Registered: ‎September 27 2011

Re: Vocollect Libraries

Hi Caleb,

 

I tried duplicating this myself, and ran into a few problems along the way (including the one you are reporting). It looks like you have already solved some of those problems but I am going to list everything I needed to do to get it to work here for any others that read this post.

 

1. Create an antbuild.properties file - This file needs to be created in the root of the voicelink project in the same directory as the build.xml. The file needs to contain the following 3 properties

# Libraries
applib.dir=../Vocollect Core Library 1.1.0
lutodr.dir=../Vocollect LUT ODR Library 1.1.0
httplib.dir=../Vocollect HTTP Library 1.1.0

The paths to the variuos libraries are relative from where the  build.xml file is located. If all projects where extracted to the same workspace then the above settings should work

 

2. Update the buld.xml file - There are 3 settings in the build.xml file that need updated to point to the VCE you wish to use to run the tests. (NOTE: These could be extracted to properties if you wish, and the VCE directories could be copied to a more convenient location is setting up a build machine)

 

	<!-- Python path -->
	<path id="project.python.path">
		<pathelement location="${src.dir}"/>
           <pathelement location="${lutodr.dir}/src"/>
           <pathelement location="${lutodr.dir}/test"/>
           <pathelement location="${libsrc.dir}"/>
           <pathelement location="${libtest.dir}"/>
           <pathelement location="${httplib.dir}/src"/>
           <pathelement location="${lib.dir}"/>
           <pathelement location="${test.dir}"/>
           <pathelement location="C:\Development\eclipse_release\plugins\com.vocollect.vce.1.1.0_1.1.0.20110726000447\vce\vocollectvoice\lib"/>
	   <pathelement location="C:\Development\eclipse_release\plugins\com.vocollect.vce.1.1.0_1.1.0.20110726000447\vce\vocollectvoice\python31.zip"/>
           <pathelement location="C:\Development\eclipse_release\plugins\com.vocollect.vce.1.1.0_1.1.0.20110726000447\vce\mockcatalyst\1.1.0"/>
	</path>

 Note: It's the last 3 pathelement's that need set

 

3. Add a lib folder to the core library project and add the 2 attached files to that directory. These can be anywhere if you want to change the build.xml to point to where ever you put them. The build.xml property that would need to change if you do not put these under the core library is

 

 <property name="lib.dir" value="${applib.dir}/lib"/>

 

4. On the machine you are running on you need to add the VCE directory to your system path variable so the build can find the correct python.exe to run. There may be a way to set this in the ant target, but I am not familar with how. I just added the path to the system path variable. My path was

C:\Development\eclipse_release\plugins\com.vocollect.vce.1.1.0_1.1.0.20110726000447\vce\VocollectVoice

5. At this point I was able to run the test targets in the build.xml file. After the tests completed, under the following folders:

  • /test/voicelink_test/functional_tests
  • /test/voicelink_test/system_tests
  • /test/voicelink_test/unit_tests

You should find  a file called TEST-unittest.TestSuite.xml. This file is formated like junit test files and can be opened with the junit view in eclipse, and most build servers also accept this output format.

 

Let us know if this does not solve you problems.

 

 

 

 


Contributor
calebeskurdal
Posts: 12
Registered: ‎October 3 2011
0

Re: Vocollect Libraries

Thanks, that got me mostly working. I can run individual tests now. 

 

The Ant tests still are giving errors. When I run the Ant script unit_tests_xmlrunner I get a BUILD ERROR stating 'Error executing task' at the dir=..... line below.

 

<!-- run unit tests with XML output-->
<target name="unit_tests_xmlrunner" description="Execute Python unit tests using XMLRunner">
<py-test pythonpathref="project.python.path"
dir="${test.dir}/unit_tests" testrunner="xmlrunner.XmlTestRunner">
<fileset dir="${test.dir}/unit_tests">
<include name="**/test*.py"/>
</fileset>
</py-test>
</target>

 

Intermec
mkoenig
Posts: 110
Registered: ‎September 27 2011
0

Re: Vocollect Libraries

This line is the line that usually gets reported when any of the tests fail for any reason and may be normal. We have been seeing some errors randomly failing on some machines and we are not sure why at this point. To see if the test actually ran and just some of the actual tests are failing, look in the VoiceLink project for a file test/voicelink_test/unit_tests/TEST-unittest.TestSuite.xml. If this file exists then your ANT setup is working, it's just some of the actual tests are failing

 

This file is in a JUnit format that can be read by most build systems, and is not easy to read manaully. The best way to read the file manually is using eclipse. If you refresh your VoiceLink project in eclipse you should see this file in the folder described above. If you simply double click the file it should open in the JUnit window of eclipse  (You may have to wait a few seconds after refreshing for eclipse to properly ID this file since it is rather large) allowing you to look and see what tests are failing and why. You can then comment out those tests if they are in an area that is not important to you. Below is a screen shot of what the JUnit window looks like

 

The left shows the tests and there status, the right shows the stack trace for tests that fail (when you click on test on left)

 

Untitled.png

 

Or you can simply edit this file and search for <error or <failure to find the errors and failures. 

 

Again we are not sure why these failures occur on some machines, but it seems to occur most often on machines with multiple processors. We set up our build machine in a VM session using only a single processor.

 

Last thing I want to ask that was not clear from orginal post, was are you trying to get the ANT targets to run to set up a build machine, or do you simply want to run the tests manually after making changes? If you just want to run the tests manaully and locally there is a much simplar way to do this. In eclipse you can simply right moue click on the unit_tests folder and then select Run As -> Python Unit Tests. This will run all the tests under that folder (and any sub-folder) and the output will show in the console view. You can run any folder or individual test file this way. Just want to point this out just in case. 

 

Contributor
calebeskurdal
Posts: 12
Registered: ‎October 3 2011
0

Re: Vocollect Libraries

That works to right click the file or folder that I want to run the tests on. Just wanted to get the Ant script working so I could run the tests from the Ant window.

Intermec
mkoenig
Posts: 110
Registered: ‎September 27 2011
0

Re: Vocollect Libraries

Caleb,

 

I was playing around last night to see what was causing the instability of the tests. Although I did not find the exact problem I did find a problem that was occuring in the mock_server.py script that caused the test mock server to shut down when it shouldn't causing the random test failures. Again this seems to happen more on machines with multiple processors. 

 

I made a temporary fix to the mock server and raised on issue internally. Attached is the mock_server script with my changes. You can try replacing the on int the LUT/ODR library test folder with this one and you should have more luck in getting successful runs.