Control of canoe of unit tests in LabVIEW on ActiveX

Hello

I want to run the unit tests of canoe in LabVIEW using ActiveX.

EnvVars and sysVars in canoe handling was not a big deal, and there are plenty of examples here.

But the unit tests of handling is quite difficult. Canoe help file shows this way in the object hierarchy:

I solved the problem with the help of vector Support. They sent me the following c# example:

            MApp CANoe.Application = new CANoe.Application ();
CANoe.Configuration mConf = (CANoe.Configuration) mApp.Configuration;
CANoe.TestSetup mTestSetup = (CANoe.TestSetup) mConf.TestSetup; Test settings window
CANoe.TestEnvironments mTestEnvs = (CANoe.TestEnvironments) mTestSetup.TestEnvironments;
CANoe.TestEnvironment mTestEnv = (CANoe.TestEnvironment) mTestEnvs [1]; Test environment (file *.tse)
Console.WriteLine ("Name" + mTestEnv.Name);

CANoe.TestSetupFolders mTestSetupFolders = (CANoe.TestSetupFolders) mTestEnv.Folders;
CANoe.TSTestModule mTSTestmodule = (CANoe.TSTestModule) mTestEnv.TestModules [1];
Console.WriteLine ("Name" + mTSTestmodule.Name);

CANoe.TestSequence mTestSequence = (CANoe.TestSequence) mTSTestmodule.Sequence;
Console.WriteLine ("Count TestSequence" + mTestSequence.Count);
CANoe.TestCase mTestCase = (CANoe.TestCase) mTestSequence [1];
Console.WriteLine ("Name of Testcase" + mTestCase.Name);
mTestCase.Enabled = false; disable the unit test - XML and structured NET only module.

CANoe.TestReport mTestReport = (CANoe.TestReport) mTSTestmodule.Report; Access to the report

CANoe.Measurement mMeasurement = (CANoe.Measurement) mApp.Measurement;
If (! mMeasurement.Running)
mMeasurement.Start ();

mTSTestmodule.Start ();

I realized that you can cast the ActiveX object references to another class of the child in the following way:

It was the right solution and I want to share with you.

Tags: NI Products

Similar Questions

  • How can I unit test screws with classes?

    I have my first VI using an oriented object approach I want to unit test. How in the world I have configure Unit Test infrastructure to accept a specific class? See the attached excerpt.

    Hi elrathia,.

    Here is a link that should help you:

    http://zone.NI.com/reference/en-XX/help/372584D-01/lvutfconcepts/utfc_tests_cases/

    Below, you can see an example location:

    labview\examples\Unit Test Framework\LabVIEW Class\LV Class.lvproj

    (Note this is for 2012)

    DylanC

  • LabVIEW Unit Test Framework: workaround for forbidden control characters label?

    Hello

    I am using Unit Test Framework of LabVIEW and he tells me that I am not allowed to use the unit as [Celsius] card in my labels of control:

    «Control's label may not contain the following items: \n, \r, tabs, table holders, name and decimal separators delimiters.»

    In the VI under test contain [] or /. »

    Rename these labels is a difficult option for me because the format of the units in brackets is on our company agreements.

    Can anyone think of a work around so that the test framework ignores these labels?

    Thank you

    Peter

    There was an exchange of views on these "Naming Conventions" a general consensus was arrived at, it became obvious that the best methods for the controls and indicators is to use short "Lables" and put to amplify the info in the caption showing the legend on the FP and not the Lable.

    for example

    "Temp".

    "Temperature [Celsius].

    This saves a lot of space BD when buldling / unbundling or using VI Server refs, always give the user all the information they need, and help displays the legend if there is one.  It even allows to change the default value (0) without messing up any type defs.

    In your case the Framwork UT would be happier if you have taken this approach.

  • Unit testing and Version control tool

    Hi all

    We try to evaluate a PL/SQL developer tool that will have the following options.

    1. version Control (Control Version TFS or Subversion server)
    2. unit tests


    I see two options

    1 Developer SQL
    2 TOAD + Quest Code tester for Oracle

    Some you will suggest which option to go for and why?

    Also can we use JDeveloper or any other for this purpose?

    Please notify.

    Kind regards
    Hari

    It is somewhat a generic question.

    different tools have benefits different and different tools suit different companies and how projects that are managed or how the development is made etc..

    Some people may prefer to use these tools just for the development of the code, but for example use the CCS for source code management and version control, then develop their own unit test scripts, or have dedicated 3rd party tools in order to test the individual unit, business, test system etc. of test cases.

    Without knowing your company's configuration and requirements in detail, it would be difficult to say that one thing is better than the other in most cases.

  • VI test a string control configured to view password, it displays 'normal view' mode in the Unit Test Framework lvtest Properties dialog box

    Configuration of the password does not lvtest UTF Properties dialog window. It's probably a bug.

    Hey jorgeinSD,

    The Unit Test is designed to test the input values and compare them with a desired output value to make sure that your VI works under different entries. For this reason, it is necessary that the user makes tests see the entry and not just values «*» Your VI should not change (as in the VI should still display mode password, ' * '), but the properties of Unit Test should display the actual value and not mode password. Is that what you mean by 'configuration of the password does not UTF' or did, I misunderstood the question? I hope this helps!

    -Nathan H

  • How calculated the code coverage in unit test infrastructure

    I'm looking for documentation on how the unit test framework calculates code coverage.

    I just recently installed the unit test framework and I had mixed results with the code coverage feature.  I manually calculated all the branch points in my vi, but the framework calculates more that I can think of, which gives a value of code coverage less than stellar (51%).  Is there documentation for how it is calculated?  I'm either missing something fundamental, or there is a bug with the framework.

    My vi consists of a loop (with shift registers) uninitialized which runs once.  On the inside of the loop is a business T/F structure that leads to a listed case structure possible two cases (one of which is the default value)... pretty basic.  Inside one of the structures is a loop and the other is cross.  For some reason, the unit test framework calculates 7 "flags chart run.  I use the method of "external" test harness to call all my test cases for the vi under test, b/c frankly it was easier to use than the UI provided.  I don't know if this is the cause, b/c I saw the other oddities when using it, which I'll save for another thread of discussion.

    Code coverage is calculated by dividing the number of diagrams, code that was executed by the number of diagrams in your VI altogether. Each VI has at least 1 schema (schema-block real). Loops have a single diagram each, case structures and sequences have a single diagram by image and so forth (=> from your description, your VI has at least 7 diagrams). You can double-click the patterns that were not executed in the Unit Test Framework results dialog box to be displayed.

    This approach does not reflect the amount or complexity of the code that contains each diagram. We looked at various ways of counting nodes, terminals, controls, son and other, that would give you a number that reflects your code with more precision. Unfortunately, neither of these approaches gives values that can easily be understood without some knowledge about the inner workings of LabVIEW. We chose to go with a solution that is completely transparent to end users.

    Thank you

    Herbert

  • unit test framework

    Is it possible to group together the Unit Test framework in an EXE?  I would like to pass a path of the project file and path of the report file to an exe file that will reside on a dedicated test server and run tests or user-defined Unit Tests that are included in the project file.

    I want to use this EXE to run automated tests that can be triggered by a CI server like cruise control.

    Is there a limitation with a Toolbox or UTF specifically, which prevents the package in an EXE?

    You cannot run as a stand-alone executable Unit Test infrastructure. He uses a lot of functionality which is part of the LabVIEW development system, but not the LabVIEW runtime engine (for example in order to process the block diagrams, project files).

    What you can do in order to solve your use case is to install LabVIEW on your test machine and run a VI that runs your tests. There are several ways of commissioning and control of LabVIEW, including a command line interface that allows you to pass in a name of VI to run more parameters for the VI. A more accurate way to control LabVIEW would be through ActiveX, which is possible for example in a VB Script or JavaScript that are executed by the Windows Scripting Host.

    This piece of VBScript for example takes 2 inputs command line, start of LabVIEW, charge a VI, passes the values to the VI and run the VI. He will wait for LabVIEW is finished (as an option). You can also choose to keep LabVIEW run all the time, or to have the script open and close as needed.

    Dim oLV
    Set oLV = CreateObject("LabVIEW.Application")
    
    sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
    
    Dim oVI
    Set oVI = oLV.GetVIReference(sCurPath&"\LVDiff.llb\Diff_VI.vi")
    
    oVI.SetControlValue "Input 1", WScript.Arguments(0)
    oVI.SetControlValue "Input 2", WScript.Arguments(1)
    
    On Error Resume Next
    oVI.Run(0)
    If Err.Number>0 Then
        oVI.Abort
        MsgBox "Error"
    End If
    

    Hope that helps,

    Herbert

  • Run unit tests different projects

    Hello

    I would like to start automatically tests in several projects.

    Here's the scenario: given A, B, C,... independently developed projects and say the developer has introduced an amendment that affects the B and C and maybe other projects too. now, I would like to re - run all unit tests in A, B, C,... to see if the change results in errors in B, C, or any other project.

    I thought to create a master project containing all the tests of A, B, C,... in auto-complete files but: 1) auto-complete files must be added manually and I would have a general solution; (2) auto fill records appear to be buggy or at least that they do is refresh as expected; in any case, 1) already is a show-stopper.

    LabVIEW can be script? Other solutions?

    Thank you

    Peter

    Peter,

    P@Anand referred to in the screw of the API of the UTF... You can use them to load unit tests and run independently of the project.

    Norbert

  • renaming of unit test

    After the discussion here:

    http://forums.NI.com/T5/LabVIEW/cannot-rename-lvtest-file/m-p/2621909/highlight/true#M785332

    I eventually create several dummy unit tests in the lvproj then exit and restart labview and then correctly configure these dummy unit with own names test.

    What is the Unit Test framework in $$? Pretty boring we can if expect a simple rename the feature to $$.

    Has anyone found alternative workaround in the meantime?

    Hello

    the expected way to create tests is not by right click on "my computer"...

    Here's the official help file:

    Creating Tests (Unit Test Framework Toolkit)

    By creating the unit test of the VI the name change should be no problem!

    Best,

    Anna

  • Unit Testing Unit Test Framework when the expected production is just a table of NaNs to report a fake PASS

    It is a cross-post of the Unit Testing Group:

    https://decibel.NI.com/content/message/121915#121915

    I remember having this problem with the old version of the unit testing framework, but alas, it is still present in the new version.

    To do this, I use LabVIEW 2015.

    A customer contacted ask me what to do, because the expected output was table of NaNs and the VI under test returns an array of numbers and yet, the test was passing!

    My suggestion to use as a solution was to create a defined trial user who would test for the table of NaNs. I was wondering if someone here had found this problem and if you have further suggestions other than user defined Test.

    Until someone suggests we turn to JKI VI tester for this project, I can tell you that we use UTF and tester of JKI VI not because the client is in a regulated industry.

    A video describing the problem and the workaround (via user defined Tests) is here: https://youtu.be/AoBe-Gw2Nzo

    Question: Is using a user defined Test is the best approach? We missing something in the way that the Unit Test is defined which translates the fake of the Test infrastructure Unit reports that the test successful?

    Thank you

    Fab

    Hey Fab,

    I was able to reproduce the problem on my machine and I have observed the same results. What I see in the video, it looks that you are setting the unit test. I think that this is a bug rather than your test configuration, so I presented a report on this issue will have to be reviewed by the R & D.

    Go ahead, I agree that a user defined Test is the best solution in this case. If it meets the needs of your clients, I recommend you take this option.

  • Distribution of the source - unit test dependency problem

    Hello

    I developed and API and I want to make the distribution of the sources, however my faulty build (error message is below) due to the error of reclassification of the Unit Test framework that I use to test my code. All Unit Tests are in the same folder, called "UnitTests", which is a part of a class. If I delete the UnitTests from the class folder, source distribution is created as expected. I try to put the folder always excluded UnitTests, but it does not help.

    I use LV 2012.

    Any ideas what I am doing wrong?

    Thank you

    Andrej

    Error message:

    LabVIEW does not find a file that is a dependency of a startup, exported or always included VI.

    File not found: the file "C:\Program Files (x 86) \National 2012\vi.lib\utf\dialogs\utf_defocus_trees.vi" must have the qualified name of "NI_UnitTestFramework.lvlib:utf_defocus_trees.vi", but it has the qualified name of "utf_defocus_trees.vi".

    The missing file can be referenced by one of the libraries included in the compilation or the file - CircularBuffer.lvlib. To resolve this problem:

    -Open all the startups, exported or always included live, recompile them (CTRL-SHIFT click the Run arrow) and keep them to update their dependencies.
    -Open libraries included in the building and check the existence and the location of the referenced files. Also, try building with the option of additional exclusion, 'Delete unused library of the project members', verified.

    Is attached to a fixed version of utf_defocus_trees.vi.  Place it in your \LabVIEW 2012\vi.lib\utf\dialogs directory .

    In addition, you might want to load/save utf_test_properties_sub.vi to get rid of the dirty dot.  This VI is located in the: \LabVIEW 2012\resource\framework\providers\utf.

  • Unit Testing C++ plug-ins

    Hello

    This can be an incredibly stupid question, because I'm not terribly famous (I used JUnit test before and that's all).

    I wrote a plug-in for Acrobat X Pro in C++ using Visual Studio 2010 and would like to know if it is possible to use to exercise my unit tests code.

    I think it should be a non-standard method of doing a suite of tests from the plugin must operate within acrobat (as opposed to being autonomous) in order to work or have data, functions, parameters, return values, no sense at all.

    I think that this could be done by exposing my profile in OLE automation or whatever that would allow an external program control my plug-in.

    Any ideas?

    Thank you.

    You could certainly integrate with all of the different unit tests

    frames BUT you must write the code that 'start' as

    well within your plugin and provide the user API to do.

  • Developer SQL 3 EA1: Unit Test

    Hello

    I just started to use the work unit test framework in SQL Developer 3 EA 1 and I need assistance, definition of a test case involving parent - child tables that are handled using an API from plsql. The API for the child table requires a registration key in the parent table. The parent record and its key is created by a process of starting test case. The key is retrieved using a query of dynamic value in the implementation of the test. It seems that the dynamic value query is executed before the start of the test case process have been executed. Is this expected behavior? My expectation is that the boot process are executed before the dynamic values query.

    Also, is it possible to use values resulting from processes of startup as the case other than type parameter values by using a dynamic query in value?

    Summary test scenario:

    2 boot process: the first deletes all the data tables parent and the child. The second inserts in a record in the parent table.

    No disassembly process.

    Test implementation: application of dynamic value that selects the key of the parent table and defines literals for the remaining parameters of test cases.

    1 process validation: check if a record has been inserted into the table of childe with expected values.

    Thank you

    Alistair

    Hi Alistair.

    We execute the dynamic query to control how many times the test (start, test cases, validation, demolish) cycle runs.

    To get the behavior you want, put the test in a test suite and test suite start do the initialization of the table for you.

    Brian Jeffries
    SQL development team

  • Is there any unit test framework tools for DAQmx programmers who use C interface?

    I need to accuratly simulate DAQmx devices for the software in the development of unit tests. Are there tools available to make this easier?

    You have the integrated simulation of DAQ devices in MAX. The simulation is limited. It is explained in the NOR-DAQmx help (NI - DAQmx Key Concepts > NOR-DAQmx simulated devices).

  • Unit Test Framework: Inline Subvi test coverage

    Hello

    does anyone know if the Unit Test Framework considers inline subVIs recursively during the measurement of coverage?

    Consider following the example:

    f(a:int) {}

    g() ;

    }

    g() {}

    If (false) - return 1;

    else return 0;

    }

    Obviously, there is no test for g() with coverage of 100% (branch), and any trial for f() reaches 100%.

    My question is: given a test for f(), UTF gives a different cover if I set to be (Inline g()<100%) or="" not="">

    Thank you

    Peter

    Peter,

    No, the Subvi cannot be analysed for coverage of the code if the value inline.

    Fact is, that this feature requires the option 'Allow debugging' must be disabled (Yes, I hate double-negation!), but if it is not allowed to debug, the code coverage will result in 0%.

    See Help:

    "You have to allow debugging for each VI under test to measure the code coverage. If VI a VI under test properties have not checked the checkbox allow debugging , the result of code coverage will always be zero. »

    Norbert

Maybe you are looking for