Skip to content

#66 - Show overall elapsed time during test run #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Run extends AbstractModel {
String serverOutput
LinkedHashMap<String, Test> tests
String status
Long start

new(String reporterId, String connectionName, List<String> pathList) {
this.reporterId = reporterId
Expand All @@ -46,6 +47,11 @@ class Run extends AbstractModel {
this.tests = new LinkedHashMap<String, Test>
}

def void setStartTime(String startTime) {
this.startTime = startTime
start = System.currentTimeMillis
}

def getName() {
val time = startTime.substring(11,19)
val conn = connectionName?.substring(15)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class UtplsqlRunner implements RealtimeReporterEventConsumer {
run.executionTime = event.executionTime
run.errorStack = event.errorStack
run.serverOutput = event.serverOutput
run.status = String.format(UtplsqlResources.getString("RUNNER_FINNISHED_TEXT"), event.executionTime)
run.status = UtplsqlResources.getString("RUNNER_FINNISHED_TEXT")
panel.update(reporterId)
}

Expand Down Expand Up @@ -182,7 +182,7 @@ class UtplsqlRunner implements RealtimeReporterEventConsumer {
} else {
test.startTime = sysdate
}
run.status = event.id
run.status = '''«event.id»...'''
run.currentTestNumber = event.testNumber
run.currentTest = test
panel.update(reporterId)
Expand Down Expand Up @@ -241,6 +241,8 @@ class UtplsqlRunner implements RealtimeReporterEventConsumer {
}
if (run.totalNumberOfTests < 0) {
run.status = UtplsqlResources.getString("RUNNER_NO_TESTS_FOUND_TEXT")
run.executionTime = new Double(System.currentTimeMillis - run.start)/1000
run.endTime = sysdate
run.totalNumberOfTests = 0
panel.update(reporterId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ import javax.swing.JButton
import javax.swing.JCheckBox
import javax.swing.JOptionPane
import javax.swing.JPanel
import javax.swing.JSeparator
import javax.swing.JSpinner
import javax.swing.JTabbedPane
import javax.swing.JTextField
import javax.swing.SpinnerNumberModel
import javax.swing.SwingConstants
import javax.swing.table.DefaultTableModel
import oracle.dbtools.raptor.templates.CodeTemplateUtil
import oracle.ide.panels.DefaultTraversablePanel
Expand Down Expand Up @@ -110,7 +108,7 @@ class PreferencePanel extends DefaultTraversablePanel {
runTab.add(
runTab.field.label.withText(UtplsqlResources.getString("PREF_USE_SMART_TIMES_LABEL")).component(
useSmartTimesCheckBox))
runTab.addRow(new JSeparator(SwingConstants.HORIZONTAL))
runTab.addVerticalGap
runTab.addRow(importSnippetsButton)
runTab.addVerticalSpring

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import javax.swing.JTabbedPane
import javax.swing.JTable
import javax.swing.RepaintManager
import javax.swing.SwingConstants
import javax.swing.Timer
import javax.swing.UIManager
import javax.swing.border.EmptyBorder
import javax.swing.event.HyperlinkEvent
Expand Down Expand Up @@ -85,6 +86,8 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
ToolbarButton clearButton
JComboBox<ComboBoxItem<String, String>> runComboBox
JLabel statusLabel
JLabel elapsedTimeLabel
Timer elapsedTimeTimer
JLabel testCounterValueLabel
JLabel errorCounterValueLabel
JLabel failureCounterValueLabel
Expand Down Expand Up @@ -360,6 +363,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
resetDerived
val item = new ComboBoxItem<String, String>(currentRun.reporterId, currentRun.name)
runComboBox.selectedItem = item
elapsedTimeTimer.start
}
}

Expand Down Expand Up @@ -765,7 +769,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
toolbar.add(clearButton)
c.gridx = 0
c.gridy = 0
c.gridwidth = 1
c.gridwidth = 2
c.gridheight = 1
c.insets = new Insets(0, 0, 0, 0) // top, left, bottom, right
c.anchor = GridBagConstraints::NORTH
Expand All @@ -780,12 +784,42 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
c.gridy = 1
c.gridwidth = 1
c.gridheight = 1
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
c.insets = new Insets(10, 10, 10, 0) // top, left, bottom, right
c.anchor = GridBagConstraints::WEST
c.fill = GridBagConstraints::HORIZONTAL
c.weightx = 1
c.weighty = 0
basePanel.add(statusLabel, c)
elapsedTimeLabel = new JLabel
elapsedTimeLabel.preferredSize = new Dimension(60, 0)
c.gridx = 1
c.gridy = 1
c.gridwidth = 1
c.gridheight = 1
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
c.anchor = GridBagConstraints::WEST
c.fill = GridBagConstraints::NONE
c.weightx = 0
c.weighty = 0
basePanel.add(elapsedTimeLabel, c)
elapsedTimeTimer = new Timer(100, new ActionListener() {
override actionPerformed(ActionEvent e) {
if (currentRun !== null && currentRun.start !== null) {
val time = new SmartTime
time.smart = useSmartTimes
if (currentRun.executionTime !== null) {
time.seconds = currentRun.executionTime
elapsedTimeTimer.stop
} else {
val long now = System.currentTimeMillis
time.seconds = new Double(now - currentRun.start) / 1000
}
elapsedTimeLabel.text = '''«time.toString»«IF !useSmartTimes» s«ENDIF»'''
} else {
elapsedTimeLabel.text = null
}
}
})

// Counters
// - Test counter
Expand Down Expand Up @@ -822,7 +856,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
// - add everything to basePanel
c.gridx = 0
c.gridy = 2
c.gridwidth = 1
c.gridwidth = 2
c.gridheight = 1
c.insets = new Insets(5, 0, 5, 0) // top, left, bottom, right
c.anchor = GridBagConstraints::WEST
Expand Down Expand Up @@ -854,7 +888,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
progressBar.UI = new BasicProgressBarUI
c.gridx = 0
c.gridy = 3
c.gridwidth = 1
c.gridwidth = 2
c.gridheight = 1
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
c.anchor = GridBagConstraints::WEST
Expand Down Expand Up @@ -1206,7 +1240,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
horizontalSplitPane.resizeWeight = 0.5
c.gridx = 0
c.gridy = 4
c.gridwidth = 1
c.gridwidth = 2
c.gridheight = 1
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
c.anchor = GridBagConstraints::WEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SmartTime {
this.smart = smart
}

def setMillis(Double seconds) {
def setSeconds(Double seconds) {
this.seconds = seconds
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RUNNER_WARNINGS_LABEL=Warnings
RUNNER_INFO_LABEL=Info
RUNNER_INITIALIZING_TEXT=Initializing...
RUNNER_RUNNING_TEXT=Running tests...
RUNNER_FINNISHED_TEXT=Finished after %.3f seconds.
RUNNER_FINNISHED_TEXT=Finished.
RUNNER_NO_TESTS_FOUND_TEXT=No tests found.
RUNNER_RUN_MENUITEM=Run test
RUNNER_RUN_WORKSHEET_MENUITEM=Run test in new worksheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUNNER_WARNINGS_LABEL=Warnungen
RUNNER_INFO_LABEL=Info
RUNNER_INITIALIZING_TEXT=Initialisierung...
RUNNER_RUNNING_TEXT=Starte Tests...
RUNNER_FINNISHED_TEXT=Beendet nach %.3f Sekunden.
RUNNER_FINNISHED_TEXT=Beendet.
RUNNER_NO_TESTS_FOUND_TEXT=Keine Tests gefunden.
RUNNER_RUN_MENUITEM=Run testTest ausf�hren
RUNNER_RUN_WORKSHEET_MENUITEM=Test in neuem Arbeitsblatt ausf�hruen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class UtplsqlRunnerPanelTest {
run.counter.success = run.counter.success + 1
run.status="utplsql.test.e"
val end = System.currentTimeMillis
run.status = String.format(UtplsqlResources.getString("RUNNER_FINNISHED_TEXT"), new Double(end-start)/1000)
run.executionTime = new Double(end-start)/1000
run.status = UtplsqlResources.getString("RUNNER_FINNISHED_TEXT")
panel.update(run.reporterId)
Thread.sleep(2000);
frame.dispose
Expand Down