SimpleDUTRemote
A simple automation solution
SimpleDUTRemote Documentation

Simple DUT Remote is a framework designed to make automation easier for subsystems. It does this by providing a simple communications framework for communicating with devices under test. if you need to interact with your DUT as part of your testing, this framework can help you.

I want to get started right away!

There is a tutorial located here, which includes examples and how to control to the server via PowerShell: Simple DUT Remote Tutorial

Client DLL documentation is located here: SimpleDUTClientLibrary.RpcClient

Server documentation is located within the SimpleDUTRemote namespace. Functions on the server that can be called via RPC are located here: SimpleDUTRemote.Functions

If you're looking for documentation on the JSON-RPC server, which can be used on its own, additional information on that library is located here: SimpleJsonRpc Library Docs

Building and Testing the Code

Building Everything

If you want to build everything, just run BuildAll.bat from the project root directory - this will produce client binaries for x64, will generate server binaries for supported architectures, will build the documentation (if doxygen is installed), and will build an installer package (if InnoInstall is installed).

BuildAll.bat relies on the command line .NET Core tools that are available here.

Building individual items and running tests

Most projects within this solution dual target the .NET Core Framework (v2.0) and .NET Framework (v4.6). Visual Studio 2017.3 has native support for both targets, and is a simple, graphical way to build the solution.

Alternatively, you can use the command line .NET Core tools that are available here.

This project relies on both the NLog and the Newtonsoft.Json frameworks for log management and json file parsing. When opening the project, Visual Studio should automatically fetch any packages that aren't on your system already. If using the command line, use the dotnet restore command.

Generating Self Contained EXEs

For .NET Core targets, you will want to compile as a self-contained deployment to generate an exe, which is done by specifying a runtime identifier (the -r option). In general, it is easier to do this from the command line.

To compile to Windows 10-x64, run this from the same directory as the .csproj file: dotnet publish -c Release -r win10-x64 -f netcoreapp2.0.

For instructions on how to compile for other platforms, follow the instructions here.

Running Tests

All functions on the server, and most functions on the client, have unit tests written for them. Unit tests are located in the DUTRemoteTests project. Use the Visual Studio Test Explorer to view and run unit tests, or use the dotnet test command.

Deploying

Setting up the Server (Device Under Test)

If you used the BuildAll.bat script, it will generate an output directory with client and server binaries. Simply copy these to the desired devices. If you compiled manually, you should copy the directory generated by the dotnet publish command.

Once you've copied the code, simply double click the exe. If you want to specify a port number for the server, you may provide it as the first argument when running the server.

Security Warning

SimpleRemote allows users to run programs and access files on the computer where it is run, and is a major security risk. It should be only run on test machines that are connected to secure networks.

When you start the server for the first time, it will display a security warning, and prompt you to acknowledge the security risks of using SimpleRemote. Once you acknowledge the warning, the server will write a blank file UserWarningAcknowledged in the same directory as the server executable, and will not display the prompt on future runs.

If you are deploying in a lab enviornment, acknowledge and accept the risks of using this software, and want to avoid manually acknowledging the prompt on each machine, you can either:

  • Place a blank file named UserWarningAcknowledged in the same directory as the server exe.
  • Start the server with the command line flag --SuppressUserWarning.

Setting up the Client

The client is a simple .NET DLL. Compile the SimpleDUTClientLibrary project in the release configuration, and copy the contents of the net46 output folder to your client machine. If you used the BuildAll.bat script, you will have a client folder in the output directory.

Client documentation can be found here: SimpleDUTClientLibrary.RpcClient

Additionally, the Simple DUT Remote Tutorial covers how to use the client in PowerShell.

Logging

Logging is handled by the Nlog framework on the server, and can be configured without recompiling the application. Simply adjust the Nlog.conf file that is in the project with the exe (or main DLL) application.

Status messages logged by the application are emitted at the INFO level. Timeouts and other non-critical issues are logged at WARN level. Exceptions are logged at the ERROR level. By default the logger will provide colored output to a terminal, but it can also be routed to files, or the Windows event log.

Details on how to configure can be found here.

Adding new functionality

Using the Plugin functions within SimpleDUTRemote.Functions, users can build custom actions into DLLs, and access the functionality directly from this communication library, without having to build the functions into an independent exe.

This is a better solution for operations that need to be done repeatedly, and the overhead of starting and stopping a process repeatedly is unacceptable.

There is an example plugin (located in the PluginExample directory) in this codebase.