Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling CANoe TestCases in LabVIEW over ActiveX

Solved!
Go to solution

Hi,

 

I want to run CANoe TestCases in LabVIEW using ActiveX.

Handling envVars and sysVars in CANoe was not a big deal and there are a lot of examples here.

But handling TestCases is quite difficult. The CANoe help file shows this way in the object hierarchy:

 

Application

Configuration

TestSetup

TestEnvironments

TestEnvironment

TestModules

TSTestModule

TestSequence

TestCase

 

But I didn't find any way to realize it. I ended up in the following:

 

IApplication3

IConfiguration4

ITestSetup

ITestEnvironments

ITestEnvironment

ITestSetupItems

ITestSetupItem

 

 

 

 

 ITestSetupItem is an object without any methods. I don't know how to access the TestCases without the linking objects in between.

 

Greetings,

Ludwig.

0 Kudos
Message 1 of 5
(8,148 Views)
Solution
Accepted by topic author Ludwig72

I've solved the problem with the help of Vector Support. They send me the following C# Example:

            CANoe.Application mApp = new CANoe.Application();
            CANoe.Configuration mConf = (CANoe.Configuration)mApp.Configuration;
            CANoe.TestSetup mTestSetup = (CANoe.TestSetup)mConf.TestSetup; //Test SetUp Window
            CANoe.TestEnvironments mTestEnvs = (CANoe.TestEnvironments)mTestSetup.TestEnvironments;
            CANoe.TestEnvironment mTestEnv = (CANoe.TestEnvironment)mTestEnvs[1]; // Test Environment (*.tse File)
            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("TestSequence Count " + mTestSequence.Count);
            CANoe.TestCase mTestCase = (CANoe.TestCase)mTestSequence[1];
            Console.WriteLine("Testcase Name " + mTestCase.Name);
            mTestCase.Enabled = false; // deactivate testcase - XML and structured NET module only.

            //CANoe.TestReport mTestReport =(CANoe.TestReport) mTSTestmodule.Report; // Access To report

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

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

Casting.png

 

This was the correct solution and I want to share it with you. 

Message 2 of 5
(7,909 Views)

Hello Ludwig72,

I know this post is very old but i'm very new to active X with LabVIEW. Can you please share me some sample code.It will be so helpful.

 

Thanks

0 Kudos
Message 3 of 5
(3,430 Views)
Solution
Accepted by topic author Ludwig72

@sunny7569650 wrote:

Hello Ludwig72,

I know this post is very old but i'm very new to active X with LabVIEW. Can you please share me some sample code.It will be so helpful.

 

Thanks


Here you are:

CANoe.png

0 Kudos
Message 4 of 5
(3,411 Views)

Thank You @Ludwig72

0 Kudos
Message 5 of 5
(3,403 Views)