How to plan C # unit tests with Jenkins?

Over the past 6 months, our test team has used selenium web selenium to test our web products. We have made great strides and continue to use it daily. We use visual studio since we are a .net store to write our tests in C #. We do not use any other testing framework for .net. Until recently, we carried out automation tests manually through the test explorer window in visual studio (2013), checking the results and then writing them to an extended data sheet. I know that this is not ideal, but we do not have so many tests, so until now we really liked it. However, the number of automation tests we will need to write and maintain should increase rapidly over the next few months.

I recently played with creating batch files to call vstest.console.exe and its various commands, and then added these logs to the server. Not ideal. I know that I can still do much more, especially integrate some kind of CI server.

We already use the team foundation server and have at our disposal various virtual servers (all running windows 8.1), so I thought about using this to start learning about Jenkins. The problem is that I do not find much information about Jenkinks and C #. This is primarily due to the configuration of java. Am I missing something? What little information I found is seriously outdated and does not work for me.

I got to installing it and installing the vstest.console.exe plugin, but could not get a simple test to run. The current walkthrough that doesn't precede 2012 would be great :) Do you guys think Jenkins is the way for C # and the .net framework? Is there a β€œstandard” used in the C # community? I heard about cruise control, and I'm going to check it out. Is this a viable alternative? Easier to use with .net?

Here is what we need:

  • Keep writing our tests inside the visual studio and create unit tests in C #
  • Plan to run our unit tests on a remote / local server.
  • Write a result / log file - good reporting functions in case of failures / passes will be great
  • Email file to qa / dev commands

I hope some of you guys once walked this road and can share some insights

+6
source share
2 answers

You can use Jenkins to run tests using batch scripts, reporting to Jenkins via NUnit or MSTest plugins. To do this, simply call the test runner from the executable Jenkins script (see links below). The main reason for this in my store is because Jenkins is used to automate the build process, and automated tests run every time new code is promoted. If you are not using Jenkins to automate the assembly and reporting, i.e. You just need to plan - the most basic solution will be the Task Scheduler (as indicated by John O). Also, if you are using MSTest and not NUnit, then as others have suggested, it is better to look at TFS.

If you really want to use Jenkins with MSTest, the following links may be useful in terms of configuration:

Error trying to run mstest on jenkins - 2012

An example of starting MSTest from Jenkins from the link above:

"C: \ Program Files (x86) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ MSTest.exe" /testcontainer:Example.Tests\bin\Debug\Example.Tests.dll/resultsfile:TestResults.trx

Jenkins Plugin MSTestRunner cannot start mstest.exe - 2014

If you can / want to use NUnit, check the following:

How do you run Jenkins NUnit tests?

Run NUnit with Jenkins

Actually, for reporting purposes, registering with Excel or something similar is not a terrible idea (especially if your organization uses Sharepoint). The worst comes to the worst, and you cannot make something work, then one solution will automate this reporting process using the Excel COM Object Model to directly write the results to a spreadsheet.

Suppose TFS is your best bet.

+5
source

I will give you some information on how the test can be processed with CI, and not exactly how to configure Jenkins or another CI server. This may be a partial answer to your question, but at least something. Keep in mind that selenium tests always need a live site to indicate, and before you start testing, the site must be deployed (both manually and automatically). I prefer to run the test suite once at night and let it go all night. You can simply accomplish this using the NUnit console, batch and windows task manager. See my answer here how to do it. Of course, this can be achieved from any other CI server. With the NUnit Command switch, you can also automatically export the result.

0
source

Source: https://habr.com/ru/post/979343/


All Articles