Code export
In this section you will learn how to see the code generated for a test and export it to another language.
Show the generated code
Hover over a test in the Tests tab and click Code exporter. The Generated Test Script window shows the code of the test in the selected Language:
- Copy copies the code to the clipboard.
- Save as File saves it to a file.
- Commit — only with Mugnsoft Code — opens the monitor information to deploy the test to Mugnsoft.
You can also export a test from the test menu (right-click the test).
Note:
You can edit the code in this window, and Commit deploys the code as edited. The edits are not applied to the test: Pulse still plays the test from its steps, and the code is generated again from the steps the next time you open the window. Prefer changing the steps.
Languages
| Language | Framework |
|---|---|
| Mugnsoft Code | The script an EUM monitor runs in Mugnsoft |
| Csharp-Nunit | C# with NUnit |
| Csharp-Xunit | C# with xUnit |
| Java-Junit | Java with JUnit |
| Javascript-Mocha | JavaScript with Mocha |
| Python-Pytest | Python with pytest |
| Ruby-Rspec | Ruby with RSpec |
The exported code uses Selenium WebDriver. To run it, create a project for the language with its test framework and the Selenium WebDriver package, for example:
Python
pip install pytest selenium
pytest test_search.py
JavaScript
npm install --save-dev mocha selenium-webdriver
npx mocha search.spec.js
C#
dotnet new nunit -n PulseTests
dotnet add PulseTests package Selenium.WebDriver
dotnet test PulseTests
Ruby
gem install selenium-webdriver rspec
rspec search_spec.rb
For Java, add the junit and selenium-java dependencies to the pom.xml of a Maven project.
Commands specific to Mugnsoft — start transaction, stop transaction and free text — only have an effect in Mugnsoft Code.
See also
- Deploy to Mugnsoft — deploy the Mugnsoft Code as an EUM monitor
- Commands — what each step becomes in the code