The Standard Performance Evaluation Corporation (SPEC) is a non-profit corporation formed to establish, maintain and endorse standardized benchmarks and tools to evaluate performance and energy efficiency for the newest generation of computing systems. SPEC develops benchmark suites and also reviews and publishes submitted results from our member organizations and other benchmark licensees.
What's New:
L Defective Unit Clipped Dimension 0.3346 0.433 8.5 11 L1 Lead Wire Enclosure 0.09842 − 2.5 − P Feedhole Pitch 0.4921 0.5079 12.5 12.9 P1 Feedhole Center to Center Lead 0.2342 0.2658 5.95 6.75 P2 First Lead Spacing Dimension 0.1397 0.1556 3.55 3.95 T Adhesive Tape Thickness 0.06 0.08 0.15 0.20 T1 Overall Taped Package Thickness − 0.0567.
- Article by Jason Cipriani January 21, 2021 3:15 AM PST Xbox Series X restock news for Best Buy, Amazon, Target, Walmart and more Microsoft's next-gen console has been out of stock continuously.
- November 2020 Freddie Mac Learning Page 4 Condominium Unit Mortgages Topic Requirements Ineligible Projects (cont’d) Guide Section 5701.3 Project in which the unit owners do not possess sole ownership of the common elements – and do not have the right to the use of common elements, including all.
12/15/2020: SPEC has released an updated storage benchmark, SPECstorage Solution 2020. This benchmark includes new workloads for artificial intelligence (AI) and genomics, expanded custom workload capabilities, massively better scaling, and a statistical visualization mechanism for displaying benchmark results. More details are available in 'What's New in SPECstorage Solution 2020'.
11/20/2020: SPEC has released SPEC CPU 2017 v1.1.5, with improvements to the sysinfo utility, better compatibility with GCC version 10, and various minor bug fixes. More details are available in 'Changes in v1.1.5'. All users are encouraged to update their copy by using the runcpu update option.
10/14/2020: SPECgpc has released SPECviewperf 2020, with new and updated viewsets and models, support within all viewsets for both 2K and 4K resolution displays, and numerous user interface improvements.
09/30/2020: SPECapc has released a new benchmark for workstations running Solidworks 2020. The new benchmark includes 10 models and 50 tests exercising a full range of graphics and CPU functionality.
08/03/2020: The 12th ACM/SPEC International Conference on Performance Engineering, ICPE 2021, is set to be held April 19-23, 2021, in Rennes, France.
07/03/2020: SPEC is calling for nominations for the Kaivalya Dixit Distinguished Dissertation Award 2020. The program is open to dissertations that have been defended between October 2019 and September 2020. Deadline for submissions is September 30, 2020.
06/03/2020: The serverless computing paradigm delivers major benefits for cloud applications —low-cost, fine-grained deployment, and management-free operation. Read more in this SPEC Research Group report.
05/22/2020: Through the years, SPECviewperf has grown from a 55 MB download back in 2000 to a 7 GB download for the current SPECviewperf 13, to an estimated 18 GB download for the upcoming SPECviewperf 2020. Read about the full evolution of the benchmark over more than 25 years.
05/15/2020: Accurately assessing CAD workstation performance means taking into account variances such as dataset complexity, users' most critical tasks, and how the design is affected by downstream operations within the product development cycle. A new article featuring SPEC/GWPG members.
04/20/2020: Video presentations from the ACM/SPEC International Conference on Performance Engineering 2020 (ICPE 2020) are now live on YouTube!
03/20/2020: The 11th ACM/SPEC International Conference on Performance Engineering, scheduled for April 20-24, will not be held as planned.
02/25/2020: The Standard Performance Evaluation Corp. (SPEC) announces that it is offering rewards of up to $9,000 and a free benchmark license for application code and datasets accepted under its benchmark search program.
02/25/2020: The SPECworkstation® 3 benchmark has been updated with reengineered multi-threading code, enabling certain computational workloads to scale beyond 64 logical processors.
02/24/2020: The Kaivalya Dixit Distinguished Dissertation Award selection committee has chosen the winning dissertation. It was authored by Guanpeng Li of University of British Columbia, under the supervision of Prof. Karthik Pattabiraman. The selection committee was especially impressed with the quality and clarity of Dr. Li's dissertation. The award will be presented at the International Conference on Performance Engineering (ICPE) in April 2020.
Given the high quality of dissertations nominated for this award, the committee decided to also publicly recognize another dissertation authored by Dr. Bin Nie under the supervision of Prof. Evgenia Smirni at the College of William & Mary as the runner-up to the award. Honorable mentions were awarded to Pamela Delgado from École polytechnique fédérale de Lausanne (EPFL), under the supervision of Prof. Willy Zwaenepoel, and Dr. Johannes Hofmann from Friedrich-Alexander Universitat Erlangen-Nurnberg, under the supervision of Prof. Gerhard Wellein.
01/29/2020: The United States Department of Energy's (DOE) Environmental Protection Agency (EPA) issued a memo stating that organizations seeking ENERGY STAR certification are required to use SERT Version 2.0.3 for computer server testing from this date forward.
[Older items can be found in the archive.]
-->ASP.NET Core supports unit tests of Razor Pages apps. Tests of the data access layer (DAL) and page models help ensure:
- Parts of a Razor Pages app work independently and together as a unit during app construction.
- Classes and methods have limited scopes of responsibility.
- Additional documentation exists on how the app should behave.
- Regressions, which are errors brought about by updates to the code, are found during automated building and deployment.
This topic assumes that you have a basic understanding of Razor Pages apps and unit tests. If you're unfamiliar with Razor Pages apps or test concepts, see the following topics:
View or download sample code (how to download)
The sample project is composed of two apps:
App | Project folder | Description |
---|---|---|
Message app | src/RazorPagesTestSample | Allows a user to add a message, delete one message, delete all messages, and analyze messages (find the average number of words per message). |
Test app | tests/RazorPagesTestSample.Tests | Used to unit test the DAL and Index page model of the message app. |
The tests can be run using the built-in test features of an IDE, such as Visual Studio or Visual Studio for Mac. If using Visual Studio Code or the command line, execute the following command at a command prompt in the tests/RazorPagesTestSample.Tests folder:
Message app organization
The message app is a Razor Pages message system with the following characteristics:
- The Index page of the app (Pages/Index.cshtml and Pages/Index.cshtml.cs) provides a UI and page model methods to control the addition, deletion, and analysis of messages (find the average number of words per message).
- A message is described by the
Message
class (Data/Message.cs) with two properties:Id
(key) andText
(message). TheText
property is required and limited to 200 characters. - Messages are stored using Entity Framework's in-memory database†.
- The app contains a DAL in its database context class,
AppDbContext
(Data/AppDbContext.cs). The DAL methods are markedvirtual
, which allows mocking the methods for use in the tests. - If the database is empty on app startup, the message store is initialized with three messages. These seeded messages are also used in tests.
†The EF topic, Test with InMemory, explains how to use an in-memory database for tests with MSTest. This topic uses the xUnit test framework. Test concepts and test implementations across different test frameworks are similar but not identical.
Cached
Although the sample app doesn't use the repository pattern and isn't an effective example of the Unit of Work (UoW) pattern, Razor Pages supports these patterns of development. For more information, see Designing the infrastructure persistence layer and Test controller logic in ASP.NET Core (the sample implements the repository pattern).
Test app organization
The test app is a console app inside the tests/RazorPagesTestSample.Tests folder.
Test app folder | Description |
---|---|
UnitTests |
|
Utilities | Contains the TestDbContextOptions method used to create new database context options for each DAL unit test so that the database is reset to its baseline condition for each test. |
The test framework is xUnit. The object mocking framework is Moq.
Unit tests of the data access layer (DAL)
The message app has a DAL with four methods contained in the AppDbContext
class (src/RazorPagesTestSample/Data/AppDbContext.cs). Each method has one or two unit tests in the test app.
DAL method | Function |
---|---|
GetMessagesAsync | Obtains a List<Message> from the database sorted by the Text property. |
AddMessageAsync | Adds a Message to the database. |
DeleteAllMessagesAsync | Deletes all Message entries from the database. |
DeleteMessageAsync | Deletes a single Message from the database by Id . |
Unit tests of the DAL require DbContextOptions when creating a new AppDbContext
for each test. One approach to creating the DbContextOptions
for each test is to use a DbContextOptionsBuilder:
McDonald’s Organizational Structure & Its Characteristics ...
The problem with this approach is that each test receives the database in whatever state the previous test left it. This can be problematic when trying to write atomic unit tests that don't interfere with each other. To force the AppDbContext
to use a new database context for each test, supply a DbContextOptions
instance that's based on a new service provider. The test app shows how to do this using its Utilities
class method TestDbContextOptions
(tests/RazorPagesTestSample.Tests/Utilities/Utilities.cs):
Using the DbContextOptions
in the DAL unit tests allows each test to run atomically with a fresh database instance:
Each test method in the DataAccessLayerTest
class (UnitTests/DataAccessLayerTest.cs) follows a similar Arrange-Act-Assert pattern:
- Arrange: The database is configured for the test and/or the expected outcome is defined.
- Act: The test is executed.
- Assert: Assertions are made to determine if the test result is a success.
For example, the DeleteMessageAsync
method is responsible for removing a single message identified by its Id
(src/RazorPagesTestSample/Data/AppDbContext.cs):
There are two tests for this method. One test checks that the method deletes a message when the message is present in the database. The other method tests that the database doesn't change if the message Id
for deletion doesn't exist. The DeleteMessageAsync_MessageIsDeleted_WhenMessageIsFound
method is shown below:
First, the method performs the Arrange step, where preparation for the Act step takes place. The seeding messages are obtained and held in seedMessages
. The seeding messages are saved into the database. The message with an Id
of 1
is set for deletion. When the DeleteMessageAsync
method is executed, the expected messages should have all of the messages except for the one with an Id
of 1
. The expectedMessages
variable represents this expected outcome.
The method acts: The DeleteMessageAsync
method is executed passing in the recId
of 1
:
Finally, the method obtains the Messages
from the context and compares it to the expectedMessages
asserting that the two are equal:
In order to compare that the two List<Message>
are the same:
- The messages are ordered by
Id
. - Message pairs are compared on the
Text
property.
A similar test method, DeleteMessageAsync_NoMessageIsDeleted_WhenMessageIsNotFound
checks the result of attempting to delete a message that doesn't exist. In this case, the expected messages in the database should be equal to the actual messages after the DeleteMessageAsync
method is executed. There should be no change to the database's content:
Unit tests of the page model methods
Another set of unit tests is responsible for tests of page model methods. In the message app, the Index page models are found in the IndexModel
class in src/RazorPagesTestSample/Pages/Index.cshtml.cs.
Page model method | Function |
---|---|
OnGetAsync | Obtains the messages from the DAL for the UI using the GetMessagesAsync method. |
OnPostAddMessageAsync | If the ModelState is valid, calls AddMessageAsync to add a message to the database. |
OnPostDeleteAllMessagesAsync | Calls DeleteAllMessagesAsync to delete all of the messages in the database. |
OnPostDeleteMessageAsync | Executes DeleteMessageAsync to delete a message with the Id specified. |
OnPostAnalyzeMessagesAsync | If one or more messages are in the database, calculates the average number of words per message. |
The page model methods are tested using seven tests in the IndexPageTests
class (tests/RazorPagesTestSample.Tests/UnitTests/IndexPageTests.cs). The tests use the familiar Arrange-Assert-Act pattern. These tests focus on:
- Determining if the methods follow the correct behavior when the ModelState is invalid.
- Confirming the methods produce the correct IActionResult.
- Checking that property value assignments are made correctly.
This group of tests often mock the methods of the DAL to produce expected data for the Act step where a page model method is executed. For example, the GetMessagesAsync
method of the AppDbContext
is mocked to produce output. When a page model method executes this method, the mock returns the result. The data doesn't come from the database. This creates predictable, reliable test conditions for using the DAL in the page model tests.
The OnGetAsync_PopulatesThePageModel_WithAListOfMessages
test shows how the GetMessagesAsync
method is mocked for the page model:
When the OnGetAsync
method is executed in the Act step, it calls the page model's GetMessagesAsync
method.
Unit test Act step (tests/RazorPagesTestSample.Tests/UnitTests/IndexPageTests.cs):
IndexPage
page model's OnGetAsync
method (src/RazorPagesTestSample/Pages/Index.cshtml.cs):
The GetMessagesAsync
method in the DAL doesn't return the result for this method call. The mocked version of the method returns the result.
In the Assert
step, the actual messages (actualMessages
) are assigned from the Messages
property of the page model. A type check is also performed when the messages are assigned. The expected and actual messages are compared by their Text
properties. The test asserts that the two List<Message>
instances contain the same messages.
Other tests in this group create page model objects that include the DefaultHttpContext, the ModelStateDictionary, an ActionContext to establish the PageContext
, a ViewDataDictionary
, and a PageContext
. These are useful in conducting tests. For example, the message app establishes a ModelState
error with AddModelError to check that a valid PageResult is returned when OnPostAddMessageAsync
is executed:
Additional resources
- Unit Test Your Code (Visual Studio)
ASP.NET Core supports unit tests of Razor Pages apps. Tests of the data access layer (DAL) and page models help ensure:
- Parts of a Razor Pages app work independently and together as a unit during app construction.
- Classes and methods have limited scopes of responsibility.
- Additional documentation exists on how the app should behave.
- Regressions, which are errors brought about by updates to the code, are found during automated building and deployment.
This topic assumes that you have a basic understanding of Razor Pages apps and unit tests. If you're unfamiliar with Razor Pages apps or test concepts, see the following topics:
View or download sample code (how to download)
The sample project is composed of two apps:
App | Project folder | Description |
---|---|---|
Message app | src/RazorPagesTestSample | Allows a user to add a message, delete one message, delete all messages, and analyze messages (find the average number of words per message). |
Test app | tests/RazorPagesTestSample.Tests | Used to unit test the DAL and Index page model of the message app. |
The tests can be run using the built-in test features of an IDE, such as Visual Studio or Visual Studio for Mac. If using Visual Studio Code or the command line, execute the following command at a command prompt in the tests/RazorPagesTestSample.Tests folder:
Message app organization
The message app is a Razor Pages message system with the following characteristics:
- The Index page of the app (Pages/Index.cshtml and Pages/Index.cshtml.cs) provides a UI and page model methods to control the addition, deletion, and analysis of messages (find the average number of words per message).
- A message is described by the
Message
class (Data/Message.cs) with two properties:Id
(key) andText
(message). TheText
property is required and limited to 200 characters. - Messages are stored using Entity Framework's in-memory database†.
- The app contains a DAL in its database context class,
AppDbContext
(Data/AppDbContext.cs). The DAL methods are markedvirtual
, which allows mocking the methods for use in the tests. - If the database is empty on app startup, the message store is initialized with three messages. These seeded messages are also used in tests.
†The EF topic, Test with InMemory, explains how to use an in-memory database for tests with MSTest. This topic uses the xUnit test framework. Test concepts and test implementations across different test frameworks are similar but not identical.
Although the sample app doesn't use the repository pattern and isn't an effective example of the Unit of Work (UoW) pattern, Razor Pages supports these patterns of development. For more information, see Designing the infrastructure persistence layer and Test controller logic in ASP.NET Core (the sample implements the repository pattern).
Test app organization
The test app is a console app inside the tests/RazorPagesTestSample.Tests folder.
Test app folder | Description |
---|---|
UnitTests |
|
Utilities | Contains the TestDbContextOptions method used to create new database context options for each DAL unit test so that the database is reset to its baseline condition for each test. |
The test framework is xUnit. The object mocking framework is Moq.
Unit tests of the data access layer (DAL)
The message app has a DAL with four methods contained in the AppDbContext
class (src/RazorPagesTestSample/Data/AppDbContext.cs). Each method has one or two unit tests in the test app.
DAL method | Function |
---|---|
GetMessagesAsync | Obtains a List<Message> from the database sorted by the Text property. |
AddMessageAsync | Adds a Message to the database. |
DeleteAllMessagesAsync | Deletes all Message entries from the database. |
DeleteMessageAsync | Deletes a single Message from the database by Id . |
Unit tests of the DAL require DbContextOptions when creating a new AppDbContext
for each test. One approach to creating the DbContextOptions
for each test is to use a DbContextOptionsBuilder:
The problem with this approach is that each test receives the database in whatever state the previous test left it. This can be problematic when trying to write atomic unit tests that don't interfere with each other. To force the AppDbContext
to use a new database context for each test, supply a DbContextOptions
instance that's based on a new service provider. The test app shows how to do this using its Utilities
class method TestDbContextOptions
(tests/RazorPagesTestSample.Tests/Utilities/Utilities.cs):
Using the DbContextOptions
in the DAL unit tests allows each test to run atomically with a fresh database instance:
Each test method in the DataAccessLayerTest
class (UnitTests/DataAccessLayerTest.cs) follows a similar Arrange-Act-Assert pattern:
- Arrange: The database is configured for the test and/or the expected outcome is defined.
- Act: The test is executed.
- Assert: Assertions are made to determine if the test result is a success.
For example, the DeleteMessageAsync
method is responsible for removing a single message identified by its Id
(src/RazorPagesTestSample/Data/AppDbContext.cs):
There are two tests for this method. One test checks that the method deletes a message when the message is present in the database. The other method tests that the database doesn't change if the message Id
for deletion doesn't exist. The DeleteMessageAsync_MessageIsDeleted_WhenMessageIsFound
method is shown below:
First, the method performs the Arrange step, where preparation for the Act step takes place. The seeding messages are obtained and held in seedMessages
. The seeding messages are saved into the database. The message with an Id
of 1
is set for deletion. When the DeleteMessageAsync
method is executed, the expected messages should have all of the messages except for the one with an Id
of 1
. The expectedMessages
variable represents this expected outcome.
The method acts: The DeleteMessageAsync
method is executed passing in the recId
of 1
:
Finally, the method obtains the Messages
from the context and compares it to the expectedMessages
asserting that the two are equal:
In order to compare that the two List<Message>
are the same:
- The messages are ordered by
Id
. - Message pairs are compared on the
Text
property.
A similar test method, DeleteMessageAsync_NoMessageIsDeleted_WhenMessageIsNotFound
checks the result of attempting to delete a message that doesn't exist. In this case, the expected messages in the database should be equal to the actual messages after the DeleteMessageAsync
method is executed. There should be no change to the database's content:
Unit tests of the page model methods
Another set of unit tests is responsible for tests of page model methods. In the message app, the Index page models are found in the IndexModel
class in src/RazorPagesTestSample/Pages/Index.cshtml.cs.
Page model method | Function |
---|---|
OnGetAsync | Obtains the messages from the DAL for the UI using the GetMessagesAsync method. |
OnPostAddMessageAsync | If the ModelState is valid, calls AddMessageAsync to add a message to the database. |
OnPostDeleteAllMessagesAsync | Calls DeleteAllMessagesAsync to delete all of the messages in the database. |
OnPostDeleteMessageAsync | Executes DeleteMessageAsync to delete a message with the Id specified. |
OnPostAnalyzeMessagesAsync | If one or more messages are in the database, calculates the average number of words per message. |
The page model methods are tested using seven tests in the IndexPageTests
class (tests/RazorPagesTestSample.Tests/UnitTests/IndexPageTests.cs). The tests use the familiar Arrange-Assert-Act pattern. These tests focus on:
- Determining if the methods follow the correct behavior when the ModelState is invalid.
- Confirming the methods produce the correct IActionResult.
- Checking that property value assignments are made correctly.
This group of tests often mock the methods of the DAL to produce expected data for the Act step where a page model method is executed. For example, the GetMessagesAsync
method of the AppDbContext
is mocked to produce output. When a page model method executes this method, the mock returns the result. The data doesn't come from the database. This creates predictable, reliable test conditions for using the DAL in the page model tests.
The OnGetAsync_PopulatesThePageModel_WithAListOfMessages
test shows how the GetMessagesAsync
method is mocked for the page model:
When the OnGetAsync
method is executed in the Act step, it calls the page model's GetMessagesAsync
method.
Unit test Act step (tests/RazorPagesTestSample.Tests/UnitTests/IndexPageTests.cs):
Thin Client - Wikipedia
IndexPage
page model's OnGetAsync
method (src/RazorPagesTestSample/Pages/Index.cshtml.cs):
The GetMessagesAsync
method in the DAL doesn't return the result for this method call. The mocked version of the method returns the result.
In the Assert
step, the actual messages (actualMessages
) are assigned from the Messages
property of the page model. A type check is also performed when the messages are assigned. The expected and actual messages are compared by their Text
properties. The test asserts that the two List<Message>
instances contain the same messages.
Other tests in this group create page model objects that include the DefaultHttpContext, the ModelStateDictionary, an ActionContext to establish the PageContext
, a ViewDataDictionary
, and a PageContext
. These are useful in conducting tests. For example, the message app establishes a ModelState
error with AddModelError to check that a valid PageResult is returned when OnPostAddMessageAsync
is executed:
Unit 3: Characteristics Of Electricitymr. Mac's Page Sheet
Additional resources
Mack Gerhardt | The Unit Wiki | Fandom
- Unit Test Your Code (Visual Studio)
- JustMockLite: A mocking framework for .NET developers. (Not maintained or supported by Microsoft.)