Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there any way I can specify the current system time for my testcase?

specify system testcase time
0
Posted

Is there any way I can specify the current system time for my testcase?

0

The simplest way is to use the ReplacementTable/ReplacementDataSet. ITable actualTable = … // Load actual table from database or somewhere else ITable table = new XmlDataSet(new FileInputStream(“myFile.xml”)).getTable(“TABLE”); ReplacementTable replacementTable = new ReplacementTable(table); replacementTable.addReplacementObject(“special-now”, new java.util.Date(System.currentTimeMillis())); Assertion.assertEquals(replacementTable, actualTable); Every “special-now” column value from your XML-dataset will be replaced by the current systime represented by a java.util.Date object.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123