Book a Demo

Author Topic: TestCase adding a test Date problem  (Read 3354 times)

msherman

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
TestCase adding a test Date problem
« on: April 08, 2010, 12:17:22 am »
I originally setup all my tests as UML <<testcase>>, now I need to change them to SysML <<testCase>>. That's going swimmingly; however for one small hitch. The DateRun attribute of the test is not copying from the original test. First, I should say I'm a little peeved with the inconsistency of script attributes and UI names. Why can't this be called Last Run in both? or Date Run?

At this stage, I don't have real data in the LastRun field. In the UI, the UML test shows Last Run as unchecked and has today's date grayed out. If I print out the DateRun attribute of the UML test from the script, it shows a hardcoded date of Sat Dec 30 00:00:00 CST 1899. If I copy it over to the SysML <<testCase>>, it shows in the UI with the 1899 date and is checked.

I'd be satisfied to have it show today's date, or nothing, or anything but the 1899 date. I'd also like it to be unchecked. The following attempts did not work:

var d = new Date();
newTest.DateRun = d;

newTest.DateRun = new Date();

newTest.DateRun = null;

newTest.DateRun = d.<anything>;


elTest = testEnum.item();
newTest.DateRun = elTest.DateRun; <--- gets the 1899 date

Any suggestions?


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: TestCase adding a test Date problem
« Reply #1 on: April 08, 2010, 08:24:56 am »
Well, the 1899 date comes from the beginning of the epoch for COM dates.  Meaning it's a date with the value of zero.  You're probably getting that from the system because the date itself is null.

If I was in your situation I would detect that date and set it to something a little more useful.  (Or possibly detect it and not set the DateRun in that situation)

What language are you using?

msherman

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: TestCase adding a test Date problem
« Reply #2 on: April 08, 2010, 11:13:53 pm »
I'm using JScript. I've tried a few approaches as noted in the first post to set the DateRun value, but I get error messages from the system.

Is there any way to clear the checkbox as well? These tests have not been run, so a null value is fine, but when I create a new test with the script, they are defaulting to that 1899 date. I'd just like for them to appear the same way they do when you create a test in the UI. I presume the underlying value of a newly created test is the 1899 date, as that's what is displayed when I print out the value from the script, but it does show up in the UI with today's date in gray and an unchecked box.

Thank you