-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Node.js from .NET using .NET Core #92
Comments
For anyone running into same issue, I worked around by simply calling nodejs in a |
Could you please give an example? |
@tarekahf sure: c# calling node and listening for output/errors:
c# unit test:
|
@JohnnyFun Thank you so much! In the meantime, did you figure out why the following is not recognized by vs code on a C# project?
I get error type not found or something like that? Could you please do me a favour and create a .NET 5.0 console project in VS code and wtite the simplest program to call nodejs from C#? I appreciate your help. Tarek |
Oh I should've done that right out the gate. Here ya go: https://github.com/JohnnyFun/NodeJsFromCSharp |
This is fantastic! I just changed the target .NET to NET5.0 and all worked like a charm. This will work. I was wondering why the original method is not working? You are not using Edge.js Package correct? Why I am not able t use Edge.js package in a regular C# .NET Console Project? Are you able to use Edge.js Package in a normal C# .NET Console Project in vs code? I appreciate your help. Tarek |
Cool, I'm running My console app doesn't use Edge.js. It has no nuget dependencies. I'm not sure why this issue was closed--perhaps it works now? I didn't check, since my nodejs workaround works for my needs 🤷 |
Well, I created another issue in this GitHub, and if they don't reply, I will use your method. I a not sure what is the value of Edge.js in this case? Your method replaced the whole framework! It is not worth it to spend days trying to figure out why the My plan is to use C# Project to Automate Unit Testing and QA End-to-End testing using Selenium and xUnit. The problem is that we need to invoke a number of complex APIs that are already set up under Postman, and it would be a pain to program such calls in C#. I figured out that I can use Newman NodeJs in this case, and integrate it with C#. We can invoke the Postman collections using NodeJs Newman, and in turn invoke the Newman calls from C#, in addition to using Selenium to control the Browser. So the C# Project will perform the following:
I thought to share this with you in case you have any feedback. I appreciate your help. Regards, |
@JohnnyFun I figured out what was wrong. According to the Edge.js package description, the framework |
You could just invoke your postman tests from the CLI as part of your CI pipeline. Unless I'm missing something, your needs don't require invoking dynamic js from c#. |
But how I can assert the result of the Newman invocation when the Selenium project kicks in? In Jenkins pipeline, I'll invoke the Newman command as a command line. I won't have an easy way (at least as per my findings) to confirm if the call is successful, get the post response details, and pass it on to the Selenium program to continue the test process. I know I can find work arounds, but I imagine it's going to be a pain to do. Besides, I need to give this setup to the QA team for end to end testing. At certain times, it's not possible to setup Jenkins pipeline only for end to end testing. So, best is to setup vs code project for such end to end testing automation. I though this is one of the justified use cases for using Edge.js. The other option is to use Node js for Selenium project which I haven't researched yet. If you can direct me to links or examples to help in this or if you have feedback, it'll so thankful for you. |
Sure, you know more about your situation than me. All that stuff gets pretty out of the scope of this humble github issue, so I'll just say good luck and godspeed, sir! |
Can you tell me if in your project sample, will you be able to pass on parameters to NodeJS program, execute Newman NodeJs call, and get the response back? The Newman invocation is received in a callback. I didn't do a deep-dive in your project, but couldn't figure out if I can use a callback to send the result back from NodeJS to C#. Sorry as I asked you many questions... Tarek |
Yeah, just build the nodejs string of code differently, bake your data into the code that'll get |
Hi,
I've tried running the following example in .net core 2.0, 2.1, 2.2, and 3.0, but all of them can't seem to recognize the Edgejs dll. It works perfectly in .net framework 4.7.2, with exact same code and nuget reference:
Am I missing something simple, or does edge-js not support .net core calling nodejs from c#?
Any insight would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: