Coder Social home page Coder Social logo

Comments (18)

klauer avatar klauer commented on May 18, 2024 1

@u-hafner - thanks! I can confirm that both of the following work, though devenv.com nicely tees the output to both standard error and the log file specified:

With devenv.com:
"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE\devenv.com" project.sln /Rebuild "Debug|TwinCAT RT (x86)" /Out logfile.log

Using start /wait:
start /wait "" "%ProgramFiles(x86)%/Microsoft Visual Studio 12.0/Common7/IDE/devenv.exe" project.sln /Rebuild "Debug|TwinCAT RT (x86)" /Out logfile.log

from tcunit.

sagatowski avatar sagatowski commented on May 18, 2024 1

Not yet. For TcUnit, the documented way will be handled by the TcUnit-Runner, which is not yet released. The software is done, but the documentation is not yet finished - and don't want to release one without the other :-)

from tcunit.

Aliazzzz avatar Aliazzzz commented on May 18, 2024 1

from tcunit.

Roald87 avatar Roald87 commented on May 18, 2024 1

A bit offtopic, but I was wondering if there is a simple way to just invoke msbuild to build the tcproj on the buildserver, and encode multiple configurations to include / exclude the unit tests.

@edgargrimberg Its not possible with MsBuild, because plc projects are build with CodeSYS compiler. See here.

from tcunit.

teddyrendahl avatar teddyrendahl commented on May 18, 2024

Awesome repository! Came here looking for this so just putting a ⬆️. Would love to have an out of the box solution to run on Appveyor.

from tcunit.

edgargrimberg avatar edgargrimberg commented on May 18, 2024

Great initiative. A bit offtopic, but I was wondering if there is a simple way to just invoke msbuild to build the tcproj on the buildserver, and encode multiple configurations to include / exclude the unit tests. Think a Jenkins builder that can be trigger a compilation to produce the build artifacts, and another compilation to create the binaries with unit tests, to be run later on.

from tcunit.

klauer avatar klauer commented on May 18, 2024

@edgargrimberg I tried and failed to get msbuild to work, but have made some progress with devenv:

"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" (your_twincat_solution).sln /Rebuild "Debug|TwinCAT RT (x86)" /Out build_output.txt

Devenv unfortunately runs in the background - returning immediately after you type the command - but eventually the build results will show up in build_output.txt.

from tcunit.

u-hafner avatar u-hafner commented on May 18, 2024

@klauer Maybe this can help for blocking until it ends:
https://stackoverflow.com/questions/10416122/for-command-using-devenv-exe-runs-too-quickly

from tcunit.

kumaraswamygaviyappa avatar kumaraswamygaviyappa commented on May 18, 2024

Thank you @sagatowski, I could able to build a job in Jenkins as you explained in the series: https://bit.ly/2Y0TBIJ

As the next task, i am trying to add unit testing using TcUnit to Jenkins.
I could able to Activate Configuration of TwinCAT System.

ITcSmTreeItem plcProjectRootItem = sysMan.LookupTreeItem("TIPC^UnitTestJenkins");
ITcPlcProject iecProjectRoot = (ITcPlcProject)plcProjectRootItem;
iecProjectRoot.BootProjectAutostart = true;
iecProjectRoot.GenerateBootProject(true);

sysMan.ActivateConfiguration();
sysMan.StartRestartTwinCAT();

Results of the unit testing appears on the error list window of VS2013 project(VS2013 was invoked by the C#):

Message	1	The application is up to date		0	0	
Message	2	Build complete -- 0 errors, 0 warnings : ready for download!		0	0	
Message	3	Generate TMC information ...		0	0	
Message	4	Import symbol information ...		0	0	
Message	5	generate boot information...	PLC.UnitTestJenkins	0	0	UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
Message	6	27.11.2019 11:17:27 875 ms | 'TwinCAT System' (10000): Ein Neustart des TwinCAT Systems wurde von AmsNetId: 10.73.8.239.1.1 Port 35688 angefordert.		
Message	7	27.11.2019 11:17:28 511 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird gesichert!		
Message	8	27.11.2019 11:17:29 465 ms | 'TwinCAT System' (10000): COM Servers TcEventLogger wird heruntergefahren!		
Message	9	27.11.2019 11:17:31 515 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird geladen!		
Message	10	27.11.2019 11:17:31 516 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird initialisiert!		
Message	11	27.11.2019 11:17:31 561 ms | 'TwinCAT System' (10000): TcIo Server wurde gestartet: TcIo.		
Message	12	27.11.2019 11:17:31 573 ms | 'TwinCAT System' (10000): TcPlc30 Server wurde gestartet: TcPlc30.		
Message	13	27.11.2019 11:17:31 580 ms | 'TwinCAT System' (10000): TcRtsObjects Server wurde gestartet: TcRtsObjects.		
Message	14	27.11.2019 11:17:31 586 ms | 'TwinCAT System' (10000): TcRTime Server wurde gestartet: TcRTime.		
Message	15	27.11.2019 11:17:31 705 ms | 'License Server' (30): license validation status is Valid(3)		
Message	16	27.11.2019 11:17:31 749 ms | 'TCRTIME' (200): Intel(R) Core(TM)-i 4'th generation detected		
Message	17	27.11.2019 11:17:32 160 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird gestartet!		
Error	18	27.11.2019 11:17:32 183 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbSum_Test@TwoPlusTwoEqualsFour', EXP: 4, ACT: 3, MSG: The calculation is not correct 		
Error	19	27.11.2019 11:17:32 243 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians@DegreesToRadians_Test1', EXP: 0.0, ACT: 0.01745329, MSG: The calculation is not correct 		
Error	20	27.11.2019 11:17:32 303 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians@DegreesToRadians_Test2', EXP: 1.0, ACT: 0.01745329, MSG: The calculation is not correct 		
Error	21	27.11.2019 11:17:32 463 ms | 'PlcTask' (350): | ==========TESTS FINISHED RUNNING==========		
Error	22	27.11.2019 11:17:32 783 ms | 'PlcTask' (350): | Test suites: 2		
Error	23	27.11.2019 11:17:33 103 ms | 'PlcTask' (350): | Tests: 4		
Error	24	27.11.2019 11:17:33 423 ms | 'PlcTask' (350): | Successful tests: 1		
Error	25	27.11.2019 11:17:33 743 ms | 'PlcTask' (350): | Failed tests: 3		
Error	26	27.11.2019 11:17:34 063 ms | 'PlcTask' (350): | ======================================		

Using ErrorItems errors = dte.ToolWindows.ErrorList.ErrorItems; i could display only message 1 to 5.
Other Messages has different format 'TwinCAT System' (10000) or 'PlcTask' (350):.
Is this will not be captured by Edte.ToolWindows.ErrorList.ErrorItems; ?

I tried other approach to see if thing will work out.
In the Beckhoff website, i foundITcSysManager2::GetLastErrorMessages https://bit.ly/37DKmm9 method returns the last error messages.

I wore the code as below, ErrorMessage.Length returns always 0

ITcSysManager2 ErrorMessages = pro.Object;
string ErrorMessage = ErrorMessages.GetLastErrorMessages();
int test = ErrorMessage.Length;
Console.WriteLine("ErrorMessages.GetLastErrorMessages: " + test);

Is there any way to capture these messages on display on to the console.

from tcunit.

kumaraswamygaviyappa avatar kumaraswamygaviyappa commented on May 18, 2024

Thank you @sagatowski, I could able to build a job in Jenkins as you explained in the series: https://bit.ly/2Y0TBIJ

As the next task, i am trying to add unit testing using TcUnit to Jenkins.
I could able to Activate Configuration of TwinCAT System.

ITcSmTreeItem plcProjectRootItem = sysMan.LookupTreeItem("TIPC^UnitTestJenkins");

Thank you @sagatowski
Your suggestion helped to solve this issue.
https://stackoverflow.com/questions/59101242/twincat3-automation-interface-display-o-p-on-jenkins-console/59161528#59161528

from tcunit.

Aliazzzz avatar Aliazzzz commented on May 18, 2024

See also Export results in Xunit XML format #11

from tcunit.

sagatowski avatar sagatowski commented on May 18, 2024

Parts of this functionality is now merged into the main by the PR #91.
#91

from tcunit.

Aliazzzz avatar Aliazzzz commented on May 18, 2024

I think this issue is now solved

from tcunit.

Aliazzzz avatar Aliazzzz commented on May 18, 2024

Looking forward to see your C# TcUnit-Runner in action! It must be great to finally run true CI/CD scenario's using it (allthough from CODESYS point of view it has little added value as that has (iron) python-power under the hood) Never the less a breakthrough for TwinCAT related software!

from tcunit.

sagatowski avatar sagatowski commented on May 18, 2024

I'm looking forward to it as well. It's just been so much more challenging than I could ever have imagined. So many use cases to consider. Right now it's at least in such a state that it's ready to receive feedback. I can imagine much of this is already in place for vanilla codesys.

from tcunit.

sagatowski avatar sagatowski commented on May 18, 2024

Do you have a link to the documentation of this API?

from tcunit.

Aliazzzz avatar Aliazzzz commented on May 18, 2024

Good starting point;
https://help.codesys.com/webapp/_cds_struct_using_scripts;product=codesys;version=3.5.15.0

CODESYS Python scripting API;
[https://help.codesys.com/webapp/idx-scriptingengine;product=ScriptEngine;version=3.5.15.0]
(https://help.codesys.com/webapp/idx-scriptingengine;product=ScriptEngine;version=3.5.15.0)

CODESYS Commandline Interface, maybe TwinCAT has support for this too?
[https://help.codesys.com/webapp/_cds_commandline;product=codesys;version=3.5.15.0]
(https://help.codesys.com/webapp/_cds_commandline;product=codesys;version=3.5.15.0)

from tcunit.

sagatowski avatar sagatowski commented on May 18, 2024

Finally implemented. To state this was a major task would be an understatement.
See:

from tcunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.