nunit

C# - NUnit Console Test Generation

青春壹個敷衍的年華 提交于 2019-12-13 07:35:05
问题 Currently I am trying to get test results in xml file, using NUnit. The following command that I am using is: nunit3-console.exe --labels=All --out=TestResult.txt "--result=TestResult.xml;format=nunit3" "Acceptance Tests\AcceptanceTests.dll" --trace:Debug What I receive in the output window is: Then inside generated file "TestResult.xml", test-run element I have testcasecount="1" result="Failed" label="Error" total="1" passed="0" failed="1" inconclusive="0" skipped="0" asserts="0" engine

How do I write a test to verify Entity Framework Database First Model

China☆狼群 提交于 2019-12-13 05:11:04
问题 I have a Entity Framework Database First Model. I want to write a MSTest/nUnit test to verify that all the Stored procs and tables that are defined in my edmx model are still valid on the database. With a large team of developers some only working on stored procedures and other in c# I would like to run an integration test to validate/verify the EF models in the project. I had a test in Linq2Sql to look for an attribute that is common on the stored procedure calls then it ran a SQL Query to

Unit Tests: How to Assert? Asserting results returned or that a method was called on a mock?

对着背影说爱祢 提交于 2019-12-13 04:35:02
问题 I am trying to find out the best way to Assert, should I be creating an object with what i should return and check that it has equal to the expected result ? Or should I be running a method against a mock to ensure that the method was actually called. I have seen this done both ways, I wondered if anyone has any best practices for this. Of course, it's quicker and easier to write a unit test to assert that a method was called on the mock but quicker and easier is not always the best way -

What is the NUnit test name template for the test fixture arguments?

南笙酒味 提交于 2019-12-13 04:18:23
问题 So {a} refers to the test case arguments, but in the full name of the test case we can see the test fixture arguments. For example: C:\DFDeploymentSmokeTests\LocalTestProfiles> $xml = [xml](cat ..\TestResults\CSTests.xml) C:\DFDeploymentSmokeTests\LocalTestProfiles> $TestCase = $xml.SelectSingleNode('//test-case') C:\DFDeploymentSmokeTests\LocalTestProfiles> $TestCase.name SiteCheck C:\DFDeploymentSmokeTests\LocalTestProfiles> $TestCase.fullname Web.ForEachWebServer(nan4dfc1app01_10.192.78

nunit-console can not loacte fixture

牧云@^-^@ 提交于 2019-12-13 03:42:22
问题 I have 2.5.8 and VS2010 I want to run tests against a dll and if I type nunit-console a.dll I also have these suites public class AllTests { [Suite] public static IEnumerable Suite { get { List<Type> suite = new List<Type>(); foreach (Type testCase in UnitTests.Suite) { suite.Add(testCase); } return suite; } } } and public class UnitTests { [Suite] public static IEnumerable Suite { get { List<Type> suite = new List<Type>(); suite.Add(typeof(LicenceManagerTests)); suite.Add(typeof

Weird nUnit unit test failure

别等时光非礼了梦想. 提交于 2019-12-13 03:34:10
问题 I have classX: Sub New(ByVal item_line_no As String, ByVal item_text As String) ' check to ensure that the parameters do not exceed the file template limits Select Case item_line_no.Length Case Is > m_item_line_no_capacity Throw New ArgumentOutOfRangeException(item_line_no, "Line No exceeds 4 characters") Case Else Me.m_item_line_no = item_line_no End Select Select Case item_text.Length Case Is > m_item_free_text_capacity Throw New ArgumentOutOfRangeException("Free Text Exceeds 130 characters

Selenium:how to create test evidence report with NUnit

时光总嘲笑我的痴心妄想 提交于 2019-12-13 01:05:11
问题 I was wondering how one would create proper test evidence of Selenium UI tests. I was thinking about screenshots but they do not actually cover everything you have done as it is difficult to determine when to screenshot. (Every click or every wait or every pageload). Another option I thought about was screen recording, but this makes it rather difficult to work with parallelism as you record the whole screen and not a specific chrome window. However, you could possibly also take a screenshot

How to get the git tag name in Jenkins in Node configuration

旧城冷巷雨未停 提交于 2019-12-12 19:21:58
问题 We re using node configuration in Jenkins.In the Post-build Actions we have Git Publisher which has tags to Push e.g 5.1.0.$BUILD_NUMBER.This now becomes the new build number and is used as the release number for testing I wanted to access this tag for all the remaining jobs so that I can create the Test report XMLs something with 5.1.0.$BUILD_NUMBER+myjob.xml so that its related to that unique build number. However I am not sure how can I retrieve the Git tags in all the individual jobs.I am

Passing an argument to TestFixture OneTimeSetUp From SetUpFixture

让人想犯罪 __ 提交于 2019-12-12 19:04:44
问题 I'm currently building an automation project using C#, nunit and Selenium and I'm trying to have a setup class that will initialize the selenium webdriver before any TestFixture will run and after all of them have ended and trying to get that webdriver from the TestFixture in each TestFixture OneTimeSetUp attribute, can it be done or should I change the selenium class to static in order to be able to get the driver field in each TestFixture setup? so the basic structure is this: [SetUpFixture

Selenium Grid in C# Parallel execution with Nunit

陌路散爱 提交于 2019-12-12 18:08:18
问题 i just made the setup for selenium grid 2. The hub and the nodes are up and running. I'm using Selenium webdriver + C# + Nunit to run my tests, i want now to do the following: 1) Distribute the test cases among different nodes(Parallelism), for example node 1 running test x and node 2 running test y 2) I need to be able to configure the browser and the platform type for each node, what i'm able to do now is that i make one setup function and it uses the same platform and browser for all the