How can I integrate selenium webdriver c# - MSunit tests to run on the Jenkins server as part of CI/CD
you need to use step Windows Batch Script and write there the exact command which is executing your tests locally (not from IDE but from local command promot or powershell)
after that if you need to publish test results consume plugin for MSunit and give the path of generated test rauls file to it.
Related
I have a unique case where I need to run the integration tests on the same server that the API has been deployed to. In our current pipeline, we build the API and then deploy it to the alpha test server. What I want to achieve is adding another step after the deployment that will build and deploy the xunit test project and run it on the same server then get the results of the test back and if any of the tests fail I want to revert the deployment. I know that I can run the tests from the command line in windows, but first I basically need the entire bin folder to be created/build and put on the server. I know it's not the usual way to be doing integration tests in azure pipelines but that's a requirement for our project. We are not going to use Docker containers for a while. We use the new YAML pipelines.
That is perfectly straightforward. In your pipeline, just add a task (after the deployment task) to run the tests! The build artifact will already be present with all the integration test code, so you just call the test runner in much the same way as you would when running them locally.
I am writing integration tests with Selenium Web Driver using the Chrome Driver.
I need to run these integration test on the build server.
Can it be ran "headless" or should I recur to PhantomJS? Thank You.
I use ChromeDriver for web application testing. Unit tests work OK locally on my machine. But when I start automated test run on build server it fails with an exception on new ChromeDriver():
System.ComponentModel.Win32Exception: The system cannot find the file specified.
All required binaries exist in TestResults\Out folder. Sample console program with ChromeDriver works fine on build machine. I tried to start build service in interactive (console) mode, but it did not help either.
Any suggestions?
Is it possible to run tests (written in C# with NUnit) with Jenkins on Linux OS?
I can find a lot of info on running NUnit tests with Jenkins but can't find any speak of my situation.
UPDATE
Looks like it's possible. I'll need to use a Master Jenkins in Linux to run a Slave Jenkins in Windows. Described in the article.
Looks like it's possible. I'll need to use a Master Jenkins in Linux to run a Slave Jenkins in Windows. Described in the article.
This turned out to be relatively painless using mono on Linux
1) Install NUnit Console.
sudo apt-get install monodevelop-nunit
2) Under Build in your Jenkins project "Add build step" "Execute shell" after your MSBuild step
cd "$WORKSPACE"
# so nunit does not fail on file operations
export MONO_IOMAP=all
nunit-console ./UnitTests/UnitTests.csproj
The only problem I ran into were failing tests involving NancyFx due to Nancy trying to access the projects bin/Debug directory. (The project runs normally with mono under the same environment setup) This turned out not to be a problem as we moved away from Nancy.
is there a way to install selenium into hudson, and have it run a test via a .dll (c#)? all i can find so far is a html script.
Thanks
If your Selenium test are based on NUnit, you should be able to run them in Hudson. You can also utilize Selenium Plugin for Hudson in this case.
The fix i've found for this, was to use gallio and push my compiled DLL throw its gallio.echo console.
hudson passes and fails the job based on the results from gallio.