Skip to main content

SeeTestAutomation- C# NUnit

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

To export a code to C# NUnit, you need to:

1. Get the test code in C# NUnit language

2. Integrate SeeTestAutomation and Visual studio.

Following is a step-by-step description of how to do it.

Step 1: Export test code in C# NUnit.

Step 2: Once created a script, select ‘Code’ tab in the main window

Step 3: Then choose "C# NUnit".

Step 4: Then click on ‘Copy to Clipboard’ icon  

The generated code has been copied to the clipboard of your system.

Step 5: Now paste the code to the NUnit testing environment you are using.

Following is an example of such an exported code:

Code Example

using System;
using System.Text;
using NUnit.Framework;
using experitestClient;
namespace Experitest
{
[TestFixture]
public class ShlomoTest1
{
private string host = "localhost";
private int port = 8889;
private string projectBaseDirectory = "C:\\Users\\Dell\\workspace\\project18";
protected Client client = null;

[SetUp]
public void SetupTest()
{
client = new Client(host, port, true);
client.SetProjectBaseDirectory(projectBaseDirectory);
client.SetReporter("xml", "reports", "ShlomoTest1");
}
[Test]
public void TestShlomoTest1()
{
client.SetDevice("adb:Xiaomi MI 3W");
client.Launch("com.experitest.ExperiBank/.LoginActivity", true, true);
client.ElementSendText("NATIVE", "xpath=//*[@hint='Username']", 0, "company");
client.ElementSendText("NATIVE", "xpath=//*[@hint='Password']", 0, "company");
client.Click("NATIVE", "xpath=//*[@text='Login']", 0, 1);
}
[TearDown]
public void TearDown()
{
// Generates a report of the test case.
// For more information - https://docs.digital.ai/bundle/TDB/page/seetestautomation-_report_of_executed_test.html
client.GenerateReport(false);
// Releases the client so that other clients can approach the agent in the near future.
client.ReleaseClient();
}
}
}

Step 6:

Integrate to Visual Studio C# Environment:

To integrate the script into Visual Studio you need to integrate SeeTestAutomation using the built-in .dll files which are located in the client folder in your  installation directory(.../clients/C#).

Following are the required .dll files:

  1. CookComputing.XmlRpcV2.dll
  2. imageClient.dll

Step 7:

In order to run NUnit tests you will need to download and install NUnit framework from http://nunit.org/ .

Step 8:

After installation is complete, you will need to add reference to the nunit.framework.dll file.

The file can be located under the NUnit installation directory, for example:

< ...\NUnit 2.6.4\bin\framework >

Step 9:

Verify that you have the NUnit Test Adapter installed.

It could be downloaded through the VS menu:

Tools -> Extensions and updates -> Online