Metamation Developer Notes

  • Developer Notes
  • Resource Map
  • Tools
    • Code Formatting
    • Configuring Git
    • Assignments
    • Testing with Windows Sandbox
    • Single Binary Applications
    • Self-Updating Applications
  • Flux Workflow
    • Flux Workflow
    • Flux Development Style Guide
    • Release notes for Flux
    • SonarCloud analysis for Flux
    • Build a Flux SDK Program
    • Shipping Flux
    • Flux.Test
      • BasicBendAuto Test
      • LaserAuto.cs Detailed Documentation
      • Laserexample:Test1
  • Technical Notes
    • File formats
      • .FX File Format
      • Au(Gold) streams
      • .GEO File Format
      • .LST File Format
      • .LST file - technology
      • .BNC File Format
      • .WAD Files: Flux Resource Packages
      • .Curl Files: ASCII config information
    • Folders App
      • Data\Bendtools
      • Data\Machines
    • FluxCode
      • Welcome & Repo Map
      • Architecture & System Context
      • Subsystem *Bend* (Press Brake)
      • Subsystem *BCell* (Bend Cell Automation)
      • API Maps
      • Data Model Catalog
      • Design Patterns -- A Reader's Guide
      • Tests and Golden Paths
      • Guided Code Tours
      • CAM Glossary with Code Mapping
      • Assignments
      • Flux Onboarding Handbook
    • Data flow
      • Part
        • Part.Dwg
        • Part.Load
        • Part.Load to Part.Dwg
      • BendTech.cs
      • Bend Technology
      • Laser Cutting Technology
    • LTS (Long term support mechanism)
    • Machine ID Scheme
  • FluxTester
    • Commands and Scripts
    • Command Cookbook
    • Script Commands
    • BendTooling.cs Test Inventory
    • LaserTooling.cs Test Steps
    • Fluxtester Recipe Book
    • Nesting.cs Overview
    • Nesting.cs Recipe Book
    • Job.cs Overview
    • Job.cs Recipe Book
  • Software license
  • 3d party software
    • Python
  • Documentation
    • Bento documentation
      • Structure of a Bento page
      • Attributes
    • Software
      • Software Requirement
      • Installation
      • Git workflow for documentation contributors
    • Quick start guide
    • Workflow
      • Roles and responsibilities
      • Analyze
      • Edit
      • Proofread
      • Pre-Publish
      • Publish
      • Release cycle
      • Information required for Documentation Team
      • Checklist for Documenters
    • Styleguide
    • Flavoring
    • Translation
      • Ordering translation for a new document
    • Citations
    • Annotation
FluxTester
/
Job.cs Overview

Job.cs Overview

Purpose

Job.cs is a comprehensive test fixture for validating Job and Layout management functionality in the Flux cutting application. It tests job creation, part management, sheet handling, and advanced nesting operations with priority, rotation, and grouping.


Fixture Details

Property Value

Fixture ID

1500

Name

“Nesting Job Tests”

Module

FluxCut

Subsystem

NestJob

Test Machines

2230001, 97

Primary File

123.fx

Pattern

IDisposable (auto-cleanup)


Setup & Teardown

Constructor (IDisposable Pattern)

public Job () {
    Utils.ConfigureMachine (TESTMACHINEID1);  // Machine 2230001
    Utils.ConfigureMachine (TESTMACHINEID2);  // Machine 97
}

public void Dispose () {
    Utils.UninstallMachine (TESTMACHINEID1);
    Utils.UninstallMachine (TESTMACHINEID2);
    Utils.DeleteTempFile ();
}

Key: Uses IDisposable pattern instead of [FixtureInitialize]/[FixtureCleanUp] for more flexible resource management.


Test Methods (24 Tests)

Layout Management

C150732 (Test 401) - “Adding and deleting layouts”

  • Opens job file (TwinJob.fxjob)

  • Tests adding 6 layouts (1 → 7 total)

  • Tests deleting 3 layouts (7 → 4 total)

  • Tests deleting middle layout (4 → 3 total)

  • Validates layout counts

C150733 (Test 402) - “Moving layouts”

  • Adds layout to job

  • Tests move up operation

  • Tests move down operation

  • Compares automation tree dumps with reference files

Job Creation & Dialog Management

C122130 (Test 1528) - “Selecting ‘New Job’ toolbar button opens a pop-up dialog”

  • Opens Flux application

  • Clicks “new job” button

  • Verifies NewJobDlg appears

C122132 (Test 1529) - “In ‘New Job’ dialog without adding mandatory fields clicking ‘Cancel’ should close the dialog”

  • Opens Flux and New Job dialog

  • Tests Cancel button functionality

  • Verifies dialog closes

Part Management

C200408 (Test 1530) - “Save Parts(s) from the job”

  • Creates new job

  • Adds 2 parts (123.fx, InnerContour.fx)

  • Saves parts to temp directory

  • Verifies file existence

  • Cleans up saved files

C122176 (Test 1531) - “Add and delete parts in the job”

  • Creates new job

  • Adds multiple parts

  • Verifies parts appear in parts table

  • Tests deleting parts

  • Validates deletion

C122179 (Test 1532) - “Increase the quantity of the part”

  • Opens job (TwinJob.fxjob)

  • Adds extra parts

  • Modifies part quantities via textbox

  • Handles material warning dialog

  • Renests with new quantities

  • Validates parts count in layout

Sheet Management

C150396 (Test 1534) - “Add and delete sheets in the sheets tab of a new job”

  • Creates new job

  • Adds 5 sheets (1 → 6 total)

  • Verifies 6 sheets with size “3000x1500”

  • Deletes all 6 sheets

  • Validates deletion

C162420 (Test 1535) - “Export remainder sheet”

  • Opens job (TwinJob.fxjob)

  • Creates remainder sheet

  • Opens export dialog

  • Exports to DXF file

  • Compares with reference file

  • Cleans up temporary file

C162522 (Test 1536) - “Import remainder sheet”

  • Opens job (TwinJob.fxjob)

  • Checks initial parts count (5)

  • Deletes existing sheet

  • Imports remainder sheet from DXF

  • Verifies imported sheet dimensions (1460.85x1500)

  • Renests and validates parts count (4)

Part Properties & Configuration

C122180 (Test 3527) - “Set the priority for the part”

  • Opens job (NestingJobSample.fxjob)

  • Tests 4 priority combinations: [1,2,3], [2,1,3], [3,2,1], [0,1,2]

  • Sets priorities via parts table

  • Renests after each priority change

  • Validates layout with priority arrangement

  • Generates multiple layouts

C122181 (Test 3528) - “Set the part rotation”

  • Opens job (AsymmetricalPolygon.fxjob)

  • Tests 6 rotation options

  • Handles material warning dialog

  • Sets rotation via context menu

  • Renests after each rotation change

  • Validates layout with different rotations

C122182 (Test 3529) - “Group different parts”

  • Opens job (NestingJobSample.fxjob)

  • Tests 4 group combinations: [1,2,3], [2,1,3], [3,2,1], [0,1,2]

  • Sets group IDs via parts table

  • Renests after each grouping

  • Validates layouts with different groupings

Copy/Paste/Cut Operations

C145731 (Test 3530) - “Cut/Copy & Paste parts in layout sheets”

  • Opens job (AsymmetricalPolygon.fxjob)

  • Tests Copy/Paste workflow

    • Copies part (Ctrl+C)

    • Pastes part (Ctrl+V)

    • Validates parts within sheet margin

    • Compares layout

  • Tests Cut/Paste workflow

    • Cuts part (Ctrl+X)

    • Pastes part (Ctrl+V)

    • Validates parts within sheet margin

    • Compares layout

Add Dialog: Search & Sorting

C200439 (Test 3531) - “Search the parts by its name in add button”

  • Opens job (NestingJobSample.fxjob)

  • Tests searching by part name

  • Tests case-insensitive search

  • Tests empty search (shows all)

  • Tests invalid search term

  • Tests placeholder text behavior

C200440 (Test 3532) - “Sorting the parts by their name in the Add”

  • Tests sort by Name

  • Tests ascending sort

  • Tests descending sort

  • Validates sort order

C200441 (Test 3533) - “Sorting the parts by their area in the Add”

  • Tests sort by Area

  • Calculates area (width × height)

  • Tests ascending/descending toggle

  • Validates sort order by area

C200442 (Test 3534) - “Sorting the parts by their width in the Add”

  • Tests sort by Width

  • Tests ascending/descending

  • Validates sort order by width

C200443 (Test 3535) - “Sorting the parts by their height in the Add”

  • Tests sort by Height

  • Tests ascending/descending

  • Validates sort order by height

C200444 (Test 3536) - “Sorting the parts by their remaining quantity in the Add”

  • Tests sort by Remaining Quantity

  • Extracts quantity from part info

  • Tests ascending/descending toggle

  • Note: Logic inverted (ascending shows descending order)

C200446 (Test 3537) - “Add dialog thumbnail shows search bar, filters, and sort options”

  • Verifies search box presence

  • Verifies sort option presence

  • Verifies all sort options available

  • Tests Add dialog UI elements


Helper Methods

Job Operations

CreateNewJob(string name = "")              // Create new job with empty layout
OpenJob(string fileName)                    // Open job file from test data
GetNewJobWindow()                           // Get NewJobWindow after loading
SwitchToLayoutPage()                        // Navigate to layout tab
WaitTillNestingCompletes(int waitTime = 6) // Wait for nesting completion

Validation Methods

CheckNC(string folder, filename = "test")           // NC code validation
CheckScreenWith(string folder, filename = "test")   // Screen bitmap comparison
CheckPartsCountInLayout(int expected, int layoutIdx = 0)  // Validate part count

UI Element Access

GetComboBox()                     // Get Sort By dropdown
GetSearchBox()                    // Get search textbox
GetSortToggleCheckBox()           // Get sort direction toggle
GetParts()                        // Get all parts in Add dialog
GetNewJobWindow()                 // Get job window after loading

Data Extraction

ExtractPartNames(AutomationElement[] parts)      // Extract names from parts
GetMeasurements(bool height = true)               // Extract width/height values
GetRemQuantities()                                // Extract remaining quantities
GetAreas()                                        // Calculate areas (width × height)

Sorting & Comparison

IsSorted<T>(T[] array, bool ascending = true)     // Check sort order
SortAscendingly(bool b)                           // Toggle sort direction
OpenAddDialog(string fileName)                    // Open job and Add dialog

UI Interaction

AddPartsOrLayouts(ELoadOption.Part, string[] parts)  // Add parts/layouts
Nesting.CheckPartsInLayout(folder, filename)        // External nesting validation
Nesting.AreAllPartsNestedWithinSheet()              // Check margin fit

Key Enums & Patterns

Machine IDs

const string TESTMACHINEID1 = "2230001";  // Primary machine
const string TESTMACHINEID2 = "97";       // Secondary machine

ELoadOption

ELoadOption.Part      // Load parts
ELoadOption.Layout    // Load layouts

TestType

Type = Functional     // Functional test

Key Patterns Used

IDisposable Pattern

public class Job : IDisposable {
    public Job () {
        // Setup in constructor
        Utils.ConfigureMachine (...);
    }

    public void Dispose () {
        // Cleanup
        Utils.UninstallMachine (...);
    }
}

Advantage: Automatic cleanup via using statement or test framework

UI Automation

// Find job window
var job = Utils.MainWin.FindFirstChild ("NewJobWindow");

// Access tabs
job.FindFirstChild (a => a.ByName ("parts")).Click ();
job.FindFirstChild (a => a.ByName ("sheets")).Click ();
job.FindFirstChild (a => a.ByName ("layouts")).Click ();

// Access buttons
job.FindFirstChild ("cAddLayout").Click ();
job.FindFirstChild ("cRemovePattern").Click ();
job.FindFirstChild ("cNesting").Click ();

Keyboard Navigation

Utils.Type ('p');              // Switch to parts view
Utils.Type ('l');              // Switch to layout view
Utils.Type ('a');              // Open Add dialog
Utils.Type (ESC);              // Close dialogs/escape
Utils.Type ('c', CONTROL);     // Copy
Utils.Type ('v', CONTROL);     // Paste
Utils.Type ('x', CONTROL);     // Cut

Dialog Handling

// Create job dialog
Utils.MainWin.FindFirstChild ("CmdBar").FindFirstChild (a => a.ByName ("new job")).Click ();
var dlg = mainWin.FindFirstChild (a => a.ByName ("NewJobDlg"));
dlg.FindFirstChild (a => a.ByName ("OK")).Click ();

// Warning dialogs
Utils.MainWin.FindFirstDescendant (a => a.ByName ("Ignore and convert all"))?.Click ();

Table Operations

// Parts table
var partsTable = job.FindFirstChild (a => a.ByClassName ("PartsTable"))
    .FindFirstChild ();
var parts = partsTable.FindAllChildren ();

// Sheets table
var pane = job.FindFirstChild (a => a.ByClassName ("SheetsTable"))
    .FindFirstChild ();

// Find by index
partsTable.FindChildAt (index);

// Find by name
partsTable.FindFirstChild (a => a.ByName ("partName"));

Combobox Operations

var combo = element.AsComboBox ();
combo.Expand ();
combo.Items[index].Click ();
combo.Select ("Option Name");

Script Integration

// Get parts from job
List<string> commands = [
    "StringBuilder sb = new ();",
    "foreach (var part in Flux.JobEditor.Current.Job.Parts) sb.Append(part.Name + \",\");",
    "var result = sb.ToString();"
];
string result = Utils.RunScriptWithOutput (commands);

// Get layout part count
Utils.RunScriptWithOutput ("var result = Flux.Layout.Current.PartCount.ToString();");

Test Data Requirements

File Purpose

TwinJob.fxjob

Twin-line nesting job file

NestingJobSample.fxjob

Job with multiple parts for priority/grouping tests

AsymmetricalPolygon.fxjob

Job with asymmetrical parts for rotation tests

123.fx

Standard test part file

InnerContour.fx

Part with inner contour

Test_C150733/test.txt

Reference for layout order (move up)

Test_C150733/testDown.txt

Reference for layout order (move down)

Test_C162420/test_ExportRemSheet.dxf

Reference remainder sheet export

Test_C122180/

References for priority test layouts

Test_C122181/

References for rotation test layouts

Test_C122182/

References for grouping test layouts

C145731/test_CopyPaste, test_CutPaste

References for copy/paste operations


Testing Areas

✅ Layout Management - Add/delete layouts - Move layouts up/down

✅ Job Management - Create new job - Open job files - Job dialog operations

✅ Part Management - Add parts to job - Delete parts - Save parts to disk - Modify quantities - Set priorities - Set rotation options - Create groupings

✅ Sheet Management - Add sheets - Delete sheets - Export remainder sheets - Import sheets from DXF

✅ Advanced Operations - Copy/Paste parts - Cut/Paste parts - Priority-based nesting - Rotation-based nesting - Group-based nesting

✅ Add Dialog Features - Search by part name - Sort by name, area, width, height, quantity - Ascending/descending toggle - UI element validation


Architecture Highlights

  • IDisposable Pattern: Automatic cleanup on test completion

  • Modular Helpers: Reusable methods for common operations

  • External Validation: Uses Nesting class for layout validation

  • Script Integration: Heavy use of Flux scripting for validation

  • UI Automation: Comprehensive FlaUI usage for WPF controls

  • Reference-Based Testing: Compares against baseline files

  • Multi-scenario Testing: Tests various combinations (priorities, rotations, groups)

  • Dialog Management: Handles multiple dialog types and warnings


Key Differences from Nesting.cs

Aspect Job.cs Nesting.cs

Focus

Job/Layout management

Layout layout/positioning

Cleanup Pattern

IDisposable

FixtureCleanUp

Machines

2 machines configured

1 machine configured

Job File

Works with .fxjob files

Works with .fx files

Part Properties

Priority, rotation, grouping

Position, rotation (manual)

Dialog Testing

Extensive dialog tests

Minimal dialog testing

Search/Sort

Add dialog search/sort

No search functionality

Complexity

Higher (24 tests)

Medium (13 tests)


Quick Reference: Test Categories

Category Tests Purpose

Layout Ops

401-402

Add/delete/move layouts

Job Creation

1528-1529

Job dialog testing

Part Mgmt

1530-1532

Add/delete/save/quantity parts

Sheet Mgmt

1534-1536

Add/delete/import/export sheets

Part Config

3527-3529

Priority/rotation/grouping

Clipboard

3530

Copy/Cut/Paste operations

Add Dialog

3531-3537

Search/sort functionality

This is a sophisticated job management validation framework ensuring correct job creation, part handling, priority-based nesting, and advanced layout operations in the Flux application.

Contents

  • Purpose
  • Fixture Details
  • Setup & Teardown
  • Constructor (IDisposable Pattern)
  • Test Methods (24 Tests)
  • Layout Management
  • Job Creation & Dialog Management
  • Part Management
  • Sheet Management
  • Part Properties & Configuration
  • Copy/Paste/Cut Operations
  • Add Dialog: Search & Sorting
  • Helper Methods
  • Job Operations
  • Validation Methods
  • UI Element Access
  • Data Extraction
  • Sorting & Comparison
  • UI Interaction
  • Key Enums & Patterns
  • Machine IDs
  • ELoadOption
  • TestType
  • Key Patterns Used
  • IDisposable Pattern
  • UI Automation
  • Keyboard Navigation
  • Dialog Handling
  • Table Operations
  • Combobox Operations
  • Script Integration
  • Test Data Requirements
  • Testing Areas
  • Architecture Highlights
  • Key Differences from Nesting.cs
  • Quick Reference: Test Categories
Nesting.cs Recipe Book Job.cs Recipe Book

      Copyright © 2025 TRUMPF Metamation. All rights reserved.

    Compiled by Bento