0 of 0

File information

Last updated

Original upload

Created by

Chesko

Uploaded by

Chesko

Virus scan

Safe to use

6 comments

  1. Freso
    Freso
    • premium
    • 20 kudos
    I haven't done any Papyrus scripting, and I'm not sure I will, but I am a huge fan of automated testing, so I still got very excited when I saw this! You're a champ, man!
  2. scrivener07
    scrivener07
    • premium
    • 347 kudos
    Hey chesko, thanks for creating this for F04. I hit a little bump in getting started though. The wiki example https://github.com/chesko256/LilacFO4/wiki/4.-Example-Test-Suite does not compile because 'describe' and 'it' require a bool for the second parameter. So it is the responsibility of the suite and test functions to return a bool. I compiled the example by doing this on my machine. I simply return a literal true to indicate "completion" as Im not sure if I should return a bool indicating "success" somehow.

    bool function storyQuestSuite()
    it("should be able to start", questStartTest())
    it("should complete and shut down when objective is complete", questObjectiveTest())

    return true ; storyQuestSuite has finished
    endFunction
  3. fernicar
    fernicar
    • member
    • 7 kudos
    how should I test output type or if it can be called from which scope a function I know nothing about? like for example:
    player.GetLoadedAmmoCount
    should I implemnt it as native? I ran out of ideas...
    1. Chesko
      Chesko
      • supporter
      • 4,045 kudos
      Hey there,

      I'd like to help you write a meaningful test.

      What is the context of what you're trying to test?

      Player is an Actor, and Actor doesn't have a GetLoadedAmmoCount() function. Is this a function you yourself implemented?

      how should I test output type


      You'll have to be more specific. Do you mean, testing to make sure the type of a (returned) var is say, an integer? For that, you could do something like this (Warning, the forums destroy my code indentation, sorry):


      function TestSuites()
      describe('Type checking suite', TypeSuite())
      endFunction

      bool function TypeSuite()
      it('should make sure that the type of the var is an integer', TestCase_VerifyInt())

      return true
      endFunction

      bool function TestCase_VerifyInt()
      var foo = SomeFunctionThatReturnsSomething()

      expect( (foo is int), to, beEqualTo, true)

      return true
      endFunction


      or if it can be called from which scope a function I know nothing about?


      If you can't call a function on the object in question, you'd get a compiler error. I.e.


      ; I need to resolve this property or else I can't call DoSomething()!
      BarScript property bar auto

      bar.DoSomething()


      Or, do you mean something else?

      I hope this helps. More specifics on what you're wanting to test would be helpful.
    2. fernicar
      fernicar
      • member
      • 7 kudos
      In response to post #42432255. #42449805 is also a reply to the same post.


      Spoiler:  
      Show

      fernicar wrote: how should I test output type or if it can be called from which scope a function I know nothing about? like for example:
      player.GetLoadedAmmoCount
      should I implemnt it as native? I ran out of ideas...

      Chesko wrote: Hey there,

      I'd like to help you write a meaningful test.

      What is the context of what you're trying to test?

      Player is an Actor, and Actor doesn't have a GetLoadedAmmoCount() function. Is this a function you yourself implemented?




      You'll have to be more specific. Do you mean, testing to make sure the type of a (returned) var is say, an integer? For that, you could do something like this (Warning, the forums destroy my code indentation, sorry):



      function TestSuites()
      describe('Type checking suite', TypeSuite())
      endFunction

      bool function TypeSuite()
      it('should make sure that the type of the var is an integer', TestCase_VerifyInt())

      return true
      endFunction

      bool function TestCase_VerifyInt()
      var foo = SomeFunctionThatReturnsSomething()

      expect( (foo is int), to, beEqualTo, true)

      return true
      endFunction



      If you can't call a function on the object in question, you'd get a compiler error. I.e.



      ; I need to resolve this property or else I can't call DoSomething()!
      BarScript property bar auto

      bar.DoSomething()

      Or, do you mean something else?

      I hope this helps. More specifics on what you're wanting to test would be helpful.


      There is a list of functions sorted by ID number at:
      http://mod.gib.me/fallout4/functions.html
      compiled from the console command "help"
      I want to use the output value from function ID: 4852
      Calling the funtion in the console command geve me a message like this:
       

      Player.GetLoadedAmmoCount
      "Loaded ammo count for Nora: 24"

      Problem is, function ID: 4852 is not implemented yet.
      Since .AddItem is not implemented in Actor.pex, but inherited from:

      ObjectReference.pex
      Line 503: Function AddItem(Form akItemToAdd, int aiCount, bool abSilent) native

      I though I should be able to implement any Non-Implemented function from the list,
      including function ID: 4852, compile and test if any run, posible examples:

      Function GetLoadedAmmoCount() native
      int Function GetLoadedAmmoCount() native
      var Function GetLoadedAmmoCount() native
      string Function GetLoadedAmmoCount() native

      Hope this time is easier to understand.
  4. UnoWild
    UnoWild
    • BANNED
    • 23 kudos
    This looks promising